AlgoQuant, an integrated trading strategy research and backtesting system
com.numericalmethod.algoquant.model.portfoliooptimization.socp

## Class SOCPBlackList

• java.lang.Object
• com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
• com.numericalmethod.algoquant.model.portfoliooptimization.socp.SOCPBlackList
• All Implemented Interfaces:
com.numericalmethod.suanshu.analysis.function.Function<com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector,Double>, com.numericalmethod.suanshu.analysis.function.rn2r1.RealScalarFunction, Iterable<com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.SOCPGeneralConstraints>

public class SOCPBlackList
extends com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
Transforms a black list (not to trade a new position) constraint into the compact SOCP form. The black list constraint is: $x_{j}=0,$ for j in the black list. By letting $$y=x+w^{0}$$, the black list constraint are changed to: $y_{j}=w^{0}_{j},$ for j in the black list. Denote the black list index set as $$BL$$, i.e. $$BL=\{j|x_{j}=0\}$$. As $$y_{j}=x_{j}+w_{j}^{0}$$, the set $$BL$$ can be written as $$BL=\{j|y_{j}=w_{j}^{0}\}$$. The black list constraints can be written in the following form: $||D_{BL}(y-w^{0})||_{2}\leq0,$ where $$D_{BL}$$ is a diagonal matrix. The $$k$$th diagonal entry of $$D_{BL}$$, $$D_{BL}(k,k)$$, is $$1$$ if $$k\in BL$$, otherwise it is $$0$$. The constraint can be transformed into the standard SOCP form: $||D_{BL}(y-w^{0})||_{2}\leq0\Longleftrightarrow ||A_{1}^{\top}z+C_{1}||_{2}\leq b^{\top}_{1}z+d_{1}\\ A_{1}^{\top}=D_{BL},\; C_{1}=-D_{BL}\times w^{0},\; b_{1}=0_{n\times 1},\; d_{1}=0,\; z=y.$
"Reformulate the Portfolio Optimization Problem as a Second Order Cone Programming Problem, Version 7."

• ### Nested classes/interfaces inherited from class com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint

com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint.ConstraintViolationException, com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint.Variable
• ### Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function

com.numericalmethod.suanshu.analysis.function.Function.EvaluationException
• ### Constructor Summary

Constructors
Constructor and Description
SOCPBlackList(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector w_0, com.numericalmethod.suanshu.algebra.linear.matrix.doubles.Matrix D_BL0)
Constructs a black list constraint.
• ### Method Summary

All Methods
Modifier and Type Method and Description
boolean areAllConstraintsSatisfied(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector x)
int dimensionOfDomain()
int dimensionOfRange()
Double evaluate(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector x)
Note: x here is the trading size, not the position.
• ### Methods inherited from class com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint

getVariables, iterator, newSOCPGeneralConstraints
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Methods inherited from interface java.lang.Iterable

forEach, spliterator
• ### Constructor Detail

• #### SOCPBlackList

public SOCPBlackList(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector w_0,
com.numericalmethod.suanshu.algebra.linear.matrix.doubles.Matrix D_BL0)
Constructs a black list constraint.
Parameters:
w_0 - the initial position
D_BL0 - the black list matrix
• ### Method Detail

• #### areAllConstraintsSatisfied

public boolean areAllConstraintsSatisfied(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector x)
throws com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint.ConstraintViolationException
Specified by:
areAllConstraintsSatisfied in class com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
Throws:
com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint.ConstraintViolationException
• #### evaluate

public Double evaluate(com.numericalmethod.suanshu.algebra.linear.vector.doubles.Vector x)
Note: x here is the trading size, not the position.
Parameters:
x - trading size
Returns:
constraint value
• #### dimensionOfDomain

public int dimensionOfDomain()
• #### dimensionOfRange

public int dimensionOfRange()