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 of r, created with no key, only for an LpNorm of an order other than 2 and Inf.

Constraints

The rows that alg selects:

  • L1Norm: $(s_c t,\, s_c \boldsymbol{r}) \in \mathcal{K}_{1}$.
  • L2Norm and SquaredL2Norm: $(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 of L2Norm or of LInfNorm.

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 scale sc.
  • 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. csum and z are nothing off the power cone route.

Related

source
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

  1. Read the budget s as sum(w).
  2. Move w into the bounds with opt_weight_bounds.
  3. Check the moved weights with weights_meet_bounds: they are finite, they lie in the bounds, and they sum to s, each to a tolerance.
  4. Return an OptimisationSuccess when the check passes, else an OptimisationFailure that names wf and wb, 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

source