Class SOCPSelfFinancing
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
-
- tech.nmfin.portfoliooptimization.socp.constraints.SOCPSelfFinancing
-
- All Implemented Interfaces:
Function<Vector,Double>,RealScalarFunction
public class SOCPSelfFinancing extends SOCPPortfolioConstraint
Transforms a self financing constraint into the compact SOCP form.
The self financing constraint is: \[ \sum_{j=1}^{n}x_{j}=0. \] By letting \(y=x+w^{0}\), the self financing constraint can be written as: \[ e^{\top}x=0, \] where \(e\in\mathbb{R}^{n}=(1,\cdots,1)^{\top}\). And it is equivalent to: \[ ||e^{\top}(y-w_0)||_{2}\leq 0.\\ ||e^{\top}y-e^{\top}w_0||_{2}\leq 0. \] As a result the standard SOCP form of the zero value constraint can be written as: \[ ||e^{\top}y||_{2}\leq 0\Longleftrightarrow ||A^{\top}z+C||_{2}\leq b^{\top}z+d\\ A^{\top}=e^{\top},\; C=-e^{\top}w_0,\; b=0_{n\times 1},\; d=0,\; z=y. \]- See Also:
- "Reformulate the Portfolio Optimization Problem as a Second Order Cone Programming Problem, Version 7."
-
-
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
Constructors Constructor Description SOCPSelfFinancing(Vector w_0)Constructs a zero value constraint.SOCPSelfFinancing(Vector w_0, double epsilon)Constructs a zero value 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.doublebias(Vector y)Computes the amount of deviation from self financing, hence bias.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
-
-
-
-
Constructor Detail
-
SOCPSelfFinancing
public SOCPSelfFinancing(Vector w_0, double epsilon)
Constructs a zero value constraint.- Parameters:
w_0- the initial positionepsilon- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
SOCPSelfFinancing
public SOCPSelfFinancing(Vector w_0)
Constructs a zero value constraint.- Parameters:
w_0- the initial position
-
-
Method Detail
-
bias
public double bias(Vector y)
Computes the amount of deviation from self financing, hence bias.- Parameters:
y- the positions- Returns:
- the sector bias
-
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
-
-