Class PortfolioRiskExactSigma
- java.lang.Object
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPRiskConstraint
-
- dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.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}} & 0_{n\times 1}\\0_{1\times n} & 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 classPortfolioRiskExactSigma.DefaultRootComputes the matrix root by Cholesky and on failure by MatrixRootByDiagonalization.static classPortfolioRiskExactSigma.DiagonalizationComputes the matrix root by MatrixRootByDiagonalization.static interfacePortfolioRiskExactSigma.MatrixRootSpecifies 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
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.Matrixroot()MatrixSigma()-
Methods inherited from class dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
generalConstraints, getVariables, linearEqualities, linearInequalities, newSOCPGeneralConstraints, newSOCPLinearEqualities, newSOCPLinearInequalities
-
-
-
-
Constructor Detail
-
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 matrixroot- 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 matrixsigmaRoot- 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 Detail
-
Sigma
public Matrix Sigma()
- Specified by:
Sigmain classSOCPRiskConstraint
-
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:
areAllConstraintsSatisfiedin classSOCPPortfolioConstraint- Parameters:
y- a portfolio solution or allocation; the asset weights- Returns:
true
-
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
-
-