Class SOCPLinearSectorNeutrality
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
-
- tech.nmfin.portfoliooptimization.socp.constraints.SOCPLinearSectorNeutrality
-
- All Implemented Interfaces:
Function<Vector,Double>,RealScalarFunction
public class SOCPLinearSectorNeutrality extends SOCPPortfolioConstraint
A sector neutrality means that the sum of weights for given sectors are zero. \[ \sum_{j \in S_i} y_j = 0, \quad i = 1, \ldots, k \] where \(S_i\)'s represent the given \(k\) sectors.
-
-
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
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_EPSILON
-
Constructor Summary
Constructors Constructor Description SOCPLinearSectorNeutrality(Vector[] S)Creates a sector neutrality constraint.SOCPLinearSectorNeutrality(Vector[] S, double epsilon)Creates a sector neutrality constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareAllConstraintsSatisfied(Vector y)Checks whether all SOCP constraints represented by this portfolio constraint are satisfied.intdimensionOfDomain()Get the number of variables the function has.intdimensionOfRange()Get the dimension of the range space of the function.Doubleevaluate(Vector y)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
-
-
-
-
Field Detail
-
DEFAULT_EPSILON
public static final double DEFAULT_EPSILON
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SOCPLinearSectorNeutrality
public SOCPLinearSectorNeutrality(Vector[] S)
Creates a sector neutrality constraint.- Parameters:
S- the sector indicators;S[i].get(j) == 1if asset \(j\) is in sector \(S_i\); 0 otherwise
-
SOCPLinearSectorNeutrality
public SOCPLinearSectorNeutrality(Vector[] S, double epsilon)
Creates a sector neutrality constraint.- Parameters:
S- the sector indicators;S[i].get(j) == 1if asset \(j\) is in sector \(S_i\); 0 otherwiseepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
-
Method Detail
-
areAllConstraintsSatisfied
public boolean areAllConstraintsSatisfied(Vector y) throws SOCPPortfolioConstraint.ConstraintViolationException
Description copied from class:SOCPPortfolioConstraintChecks whether all SOCP constraints represented by this portfolio constraint are satisfied.- Specified by:
areAllConstraintsSatisfiedin classSOCPPortfolioConstraint- Parameters:
y- a portfolio solution or allocation; the asset weights- Returns:
trueif and only if all SOCP constraints are satisfied- Throws:
SOCPPortfolioConstraint.ConstraintViolationException
-
evaluate
public Double evaluate(Vector y)
Description copied from interface:FunctionEvaluate 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:FunctionGet 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:FunctionGet 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
-
-