Weight finalisers: private API
PortfolioOptimisers.set_norm_error_epigraph! — Function
set_norm_error_epigraph!(model::JuMP.Model, t, r::AbstractVector, alg::NormError)Adds the rows that bound the norm of r by t, $t \geq \lVert \boldsymbol{r} \rVert$, and returns them.
Every row is scaled by the constraint scale $s_c$ of model. The norm gives the order, and norm_epigraph! writes the rows.
JuMP formulation
Variables
z: One auxiliary variable for each entry ofr, created with no key, only for anLpNormof an order other than2andInf.
Constraints
The rows that alg selects:
L1Norm: $(s_c t,\, s_c \boldsymbol{r}) \in \mathcal{K}_{1}$.L2NormandSquaredL2Norm: $(s_c t,\, s_c \boldsymbol{r}) \in \mathcal{K}_{2}$.LInfNorm: $(s_c t,\, s_c \boldsymbol{r}) \in \mathcal{K}_{\infty}$.LpNorm: $(s_c z_{i},\, s_c t,\, s_c r_{i}) \in \mathcal{P}_{1/p}$ for each $i$, and $s_c (\boldsymbol{1}^\intercal \boldsymbol{z} - t) = 0$. At $p = 2$ and $p = \infty$ it is the row ofL2Normor ofLInfNorm.
Where:
- $t$: The bound on the norm.
- $\boldsymbol{r}$: The residual.
- $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
- $\mathcal{K}_{q} = \{(t, \boldsymbol{x}) : t \geq \lVert \boldsymbol{x} \rVert_{q}\}$: Norm cone of order $q$. $\mathcal{K}_{2}$ is the second-order cone.
- $\mathcal{P}_{a}$: The power cone $\{(x, y, z) : x^{a} y^{1 - a} \geq \lvert z \rvert,\, x, y \geq 0\}$.
Arguments
model: The JuMP model. It must already hold the constraint scalesc.t: The bound on the norm.r: The residual.alg: The norm.
Returns
(cone, csum, z): The cone row or rows, the sum row and the auxiliary variables.csumandzarenothingoff the power cone route.
Related
PortfolioOptimisers.finalise_weight_bounds — Function
finalise_weight_bounds(wf::WeightFinaliser, wb::WeightBounds, w::VecNum)Moves the weights into their bounds, and gives the return code that states whether the move succeeded.
A failure lets the fallback chain of optimise run. A set of bounds that cannot hold the budget, sum(lb) > sum(w) or sum(ub) < sum(w), always fails.
Algorithm
- Read the budget
sassum(w). - Move
winto the bounds withopt_weight_bounds. - Check the moved weights with
weights_meet_bounds: they are finite, they lie in the bounds, and they sum tos, each to a tolerance. - Return an
OptimisationSuccesswhen the check passes, else anOptimisationFailurethat nameswfandwb, together with the moved weights.
Arguments
wf::WeightFinaliser: The weight finaliser.wb::WeightBounds: The weight bounds.w::VecNum: The weights that the optimisation produced.
Returns
(retcode, w): The return code and the moved weights.
Related