Class PortfolioRiskExactSigma

All Implemented Interfaces:
Function<Vector,Double>, RealScalarFunction

public class PortfolioRiskExactSigma extends SOCPRiskConstraint
Constructs the constraint coefficient arrays of the portfolio risk term in the compact form. The constraints are generated during the transformation of the objective function.

The portfolio risk in the objective function is transformed into the following constraints: $(x+w^{0})^{\top}\Sigma(x+w^{0})\leq t_1.$ By letting $$y=x+w^{0}$$, it can be written as: $y^{\top}\Sigma\;y\leq t_1$ When the exact covariance matrix $$\Sigma$$ is used, then the portfolio risk constraint is equivalent to: $y^{\top}\Sigma\;y\leq t_1 \Longleftrightarrow y^{\top}\Sigma\;y+(\frac{t_{1}-1}{2})^{2}\leq(\frac{t_{1}+1}{2})^{2}\Longleftrightarrow ||\left(\begin{array}{c}\Sigma^{\frac{1}{2}}y\\\frac{t_{1}-1}{2}\end{array}\right)||_{2}\leq \frac{t_{1}+1}{2}.$ And the standard SOCP form of the portfolio risk constraint in this case are: $||\left(\begin{array}{c}\Sigma^{\frac{1}{2}}y\\\frac{t_{1}-1}{2}\end{array}\right)||_{2}\leq \frac{t_{1}+1}{2}\Longleftrightarrow ||A_{1}^{\top}z+C_{1}||_{2}\leq b^{\top}_{1}z+d_{1}\\ A_{1}^{\top}=\left(\begin{array}{cc}\Sigma^{\frac{1}{2}} invalid input: '&' 0_{n\times 1}\\0_{1\times n} invalid input: '&' 1/2\end{array}\right)\nonumber,\; C_{1}=\left(\begin{array}{c}0_{n\times 1}\\-1/2\end{array}\right),\; b_{1}=\left(\begin{array}{c}0_{n\times 1}\\1/2\end{array}\right)\; d_{1}=\frac{1}{2},\; z=\left(\begin{array}{c}y\\t_{1}\end{array}\right).$
• Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
static class
PortfolioRiskExactSigma.DefaultRoot
Computes the matrix root by Cholesky and on failure by MatrixRootByDiagonalization.
static class
PortfolioRiskExactSigma.Diagonalization
Computes the matrix root by MatrixRootByDiagonalization.
static interface
PortfolioRiskExactSigma.MatrixRoot
Specifies the method to compute the root of a matrix.

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
PortfolioRiskExactSigma(Matrix Sigma)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
PortfolioRiskExactSigma(Matrix Sigma, Matrix sigmaRoot)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
PortfolioRiskExactSigma(Matrix Sigma, PortfolioRiskExactSigma.MatrixRoot root)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
• Method Summary

Modifier and Type
Method
Description
boolean
areAllConstraintsSatisfied(Vector y)
Checks whether all SOCP constraints represented by this portfolio constraint are satisfied.
int
dimensionOfDomain()
Get the number of variables the function has.
int
dimensionOfRange()
Get the dimension of the range space of the function.
Double
evaluate(Vector y)
Evaluate the function f at x, where x is from the domain.
Matrix
root()

Matrix
Sigma()

Methods inherited from class dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint

generalConstraints, getVariables, linearEqualities, linearInequalities, newSOCPGeneralConstraints, newSOCPLinearEqualities, newSOCPLinearInequalities

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Constructor Details

• PortfolioRiskExactSigma

public PortfolioRiskExactSigma(Matrix Sigma, PortfolioRiskExactSigma.MatrixRoot root)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
Parameters:
Sigma - the covariance matrix
root - the method to compute the root of a matrix
• PortfolioRiskExactSigma

public PortfolioRiskExactSigma(Matrix Sigma, Matrix sigmaRoot)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
Parameters:
Sigma - the covariance matrix
sigmaRoot - the root of a matrix
• PortfolioRiskExactSigma

public PortfolioRiskExactSigma(Matrix Sigma)
Transforms the portfolio risk term, $$y^{\top}\Sigma\;y\leq t_1$$, into the standard SOCP form when the exact covariance matrix is used.
Parameters:
Sigma - the covariance matrix
• Method Details

• Sigma

public Matrix Sigma()
Specified by:
Sigma in class SOCPRiskConstraint
• root

public Matrix root()
• areAllConstraintsSatisfied

public boolean areAllConstraintsSatisfied(Vector y)
Checks whether all SOCP constraints represented by this portfolio constraint are satisfied. The constraint generated by objective function to find the optimal solution. It cannot be "violated".
Specified by:
areAllConstraintsSatisfied in class SOCPPortfolioConstraint
Parameters:
y - a portfolio solution or allocation; the asset weights
Returns:
true
• evaluate

public Double evaluate(Vector y)
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