Class SOCPMaximumLoan
java.lang.Object
dev.nm.solver.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioConstraint
tech.nmfin.portfoliooptimization.socp.constraints.SOCPMaximumLoan
- All Implemented Interfaces:
Function<Vector,
,Double> RealScalarFunction
Transforms a maximum loan constraint into the compact SOCP form. The maximum
loan constraint is:
\[
x_j+\max(0,w_j^0)\geq l_j,\quad l_j\leq 0,\quad j=1,\ldots,n.
\]
By letting \(y=x+w^{0}\), the maximum loan constraints are changed to:
\[
y_j-w_{j}^{0}+\max(0,w_j^0)\geq l_j,\quad l_j\leq 0,\quad j=1,\ldots,n.
\]
Because \(\max(0,w_j^0)\Longleftrightarrow \frac{|w_j^0|+w_j^0}{2}\), we have
\[
||0||_{2}\leq y_{j}+\frac{|w_j^0|-w_j^0}{2}-l_{j},\quad l_j\leq 0,\quad
j=1,\ldots,n.
\]
And the above constraints can be transformed into the standard SOCP form:
\[
||0||_{2}\leq y_{j}+\frac{|w_j^0|-w_j^0}{2}-l_{j}\Longleftrightarrow
||A_{j}^{\top}z+C_{j}||_{2}\leq b^{\top}_{j}z+d_{j},\quad j=1,\cdots,n\\
A_{j}^{\top}=0_{1\times n},\;
C_{j}=0,\;
b_{j}=e_{j},\;
d_{j}=\frac{|w_j^0|-w_j^0}{2}-l_{j},\;
z=y,
\]
where \(e_{j}\) is a \(n\) dimensional vector whose \(j\)th entry is \(1\)
and the rest entries are \(0\).
- See Also:
-
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
ConstructorsConstructorDescriptionSOCPMaximumLoan
(Vector w_0, Vector l) Constructs a maximum loan constraint.SOCPMaximumLoan
(Vector w_0, Vector l, double epsilon) Constructs a maximum loan 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
-
Constructor Details
-
SOCPMaximumLoan
Constructs a maximum loan constraint.- Parameters:
w_0
- the initial positionl
- the maximum loanepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0
-
SOCPMaximumLoan
Constructs a maximum loan constraint.- Parameters:
w_0
- the initial positionl
- the maximum loan
-
-
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
-