Class SOCPLinearZeroValue
java.lang.Object
dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
tech.nmfin.portfoliooptimization.socp.constraints.SOCPLinearZeroValue
- All Implemented Interfaces:
Function<Vector,
,Double> RealScalarFunction
A zero value constraint.
\[
\sum_{j=1}^{n}y_{j} = 0
\]
where \(y\) is the new weights. Thus,
\[
e^T y = 0
\]
-
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 -
Constructor Summary
ConstructorsConstructorDescriptionSOCPLinearZeroValue
(int nAssets) Creates a zero value constraint.SOCPLinearZeroValue
(int nAssets, double epsilon) Creates a zero value 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
-
Field Details
-
DEFAULT_EPSILON
public static final double DEFAULT_EPSILON- See Also:
-
-
Constructor Details
-
SOCPLinearZeroValue
public SOCPLinearZeroValue(int nAssets) Creates a zero value constraint.- Parameters:
nAssets
- the number of assets in the portfolio
-
SOCPLinearZeroValue
public SOCPLinearZeroValue(int nAssets, double epsilon) Creates a zero value constraint.- Parameters:
nAssets
- the number of assets in the portfolioepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
-
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
-