Class SOCPSectorExposure
java.lang.Object
dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
tech.nmfin.portfoliooptimization.socp.constraints.ybar.SOCPSectorExposure
- All Implemented Interfaces:
Function<Vector,
,Double> RealScalarFunction
Transforms a sector exposure constraint into the compact SOCP form.
The sector exposure constraint is: \[ \sum_{j\in S_i}|w_j^0+x_j|\leq u_i,\quad i=1,\ldots,k, \] where \(S_i\) is the \(i\)th section indicator. By letting \(\bar{y}=|x+w^{0}|\), the sector exposure constraint can be written as: \[ \sum_{j\in S_i}\bar{y}_{j}\leq u_i, i=1,\cdots,k. \] And it is equivalent to: \[ ||0||_{2}\leq -\sum_{j\in S_{i}}\bar{y}_{j}+u_{i},\; i=1,\cdots,k. \] As a result the standard SOCP form of the sector exposure constraints can be written as: \[ ||0||_{2}\leq -\sum_{j\in S_{i}}\bar{y}_{j}+u_{i}\Longleftrightarrow ||A_{i}^{\top}z+C_{i}||_{2}\leq b^{\top}_{i}z+d_{i},\quad i=1,\cdots,k\\ A_{i}^{\top}=0_{1\times n},\; C_{i}=0,\; b_{i}=-\sum_{j\in S_{i}}e_{j},\; d_{i}=u_{i},\; z=\bar{y}, \] where \(e_{j}\) is a \(n\) dimensional vector whose \(j\)th entry is \(1\) and the other entries are \(0\).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
SOCPPortfolioConstraint.ConstraintViolationException, SOCPPortfolioConstraint.Variable
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
Constructor Summary
ConstructorsConstructorDescriptionSOCPSectorExposure
(Vector w_0, Vector[] S, Vector u) Constructs a sector exposure constraint.SOCPSectorExposure
(Vector w_0, Vector[] S, Vector u, double epsilon) Constructs a sector exposure constraint. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether all SOCP constraints represented by this portfolio constraint are satisfied.int
Get the number of variables the function has.int
Get the dimension of the range space of the function.Evaluate the function f at x, where x is from the domain.Methods inherited from class dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
generalConstraints, getVariables, linearEqualities, linearInequalities, newSOCPGeneralConstraints, newSOCPLinearEqualities, newSOCPLinearInequalities
-
Constructor Details
-
SOCPSectorExposure
Constructs a sector exposure constraint.- Parameters:
w_0
- the initial positionS
- the sector indicatorsu
- the sector exposuresepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
SOCPSectorExposure
Constructs a sector exposure constraint.- Parameters:
w_0
- the initial positionS
- the sector indicatorsu
- the sector exposures
-
-
Method Details
-
areAllConstraintsSatisfied
public boolean areAllConstraintsSatisfied(Vector y) throws SOCPPortfolioConstraint.ConstraintViolationException Description copied from class:SOCPPortfolioConstraint
Checks whether all SOCP constraints represented by this portfolio constraint are satisfied.- Specified by:
areAllConstraintsSatisfied
in classSOCPPortfolioConstraint
- Parameters:
y
- a portfolio solution or allocation; the asset weights- Returns:
true
if and only if all SOCP constraints are satisfied- Throws:
SOCPPortfolioConstraint.ConstraintViolationException
-
evaluate
Description copied from interface:Function
Evaluate the function f at x, where x is from the domain.- Parameters:
y
- x- Returns:
- f(x)
-
dimensionOfDomain
public int dimensionOfDomain()Description copied from interface:Function
Get the number of variables the function has. For example, for a univariate function, the domain dimension is 1; for a bivariate function, the domain dimension is 2.- Returns:
- the number of variables
-
dimensionOfRange
public int dimensionOfRange()Description copied from interface:Function
Get the dimension of the range space of the function. For example, for a Rn->Rm function, the dimension of the range is m.- Returns:
- the dimension of the range
-