Tracking Risk Measure Constraints

The methods below are public. The other names of this topic are private, and the private page documents them.

PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::TrackingRiskMeasure{<:Any, <:Any, <:L1Norm},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    args...;
    prefix,
    kwargs...
) -> Any

Add tracking risk constraints to model.

The L1Norm overload uses an L1-norm cone. The L2Norm / SquaredL2Norm overload uses an SOC. The LpNorm overload uses power cones parameterised by r.alg.p. The LInfNorm overload uses an infinity-norm cone. The independent-variable overload shifts the weight vector by a benchmark before it builds the inner risk under a nested prefix. The dependent-variable overload computes a benchmark risk and adds an L1-norm cone on the risk difference to the inner risk, which it builds under a nested prefix.

Mathematical definition

\[\begin{align} \mathrm{TR}_p(\boldsymbol{w}) &= \frac{\lVert \mathbf{X}\boldsymbol{w} - \boldsymbol{b}\,k \rVert_p}{c_p}\,. \end{align}\]

Where:

  • $\mathrm{TR}_p(\boldsymbol{w})$: Tracking risk measure.
  • $\mathbf{X}$: Return matrix $T \times N$.
  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $\boldsymbol{b}$: Benchmark return series.
  • $k$: Rebalancing factor (0 or 1).
  • $c_p$: Normalisation constant depending on the norm order $p$.

where $\boldsymbol{b}$ is the benchmark return series, $k$ is the budget scaling variable, and $c_p$ is the norm-order scaling factor, norm_factor of r.alg ($T - d$, $\sqrt{T-d}$, $1$, etc.).

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r: Tracking risk measure instance.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr::AbstractPriorResult: Prior result containing the returns matrix X.
  • pl: Optional phylogeny constraints.
  • fees: Optional fees structure.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::TrackingRiskMeasure{<:Any, <:Any, <:Union{L2Norm, SquaredL2Norm}},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    args...;
    prefix,
    kwargs...
) -> Any

Add JuMP risk constraints for TrackingRiskMeasure with L2Norm or SquaredL2Norm to model.

Introduces a scalar variable and an SOC constraint to encode the L2 (root mean squared) tracking error between portfolio and benchmark returns. The cone variable is the L2 norm for both norms, so it is divided by norm_factor of an L2Norm with the same ddof. set_tracking_risk! then squares it for a SquaredL2Norm.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r::TrackingRiskMeasure{<:Any, <:Any, <:Union{L2Norm, SquaredL2Norm}}: The tracking risk measure.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr: Prior result.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::TrackingRiskMeasure{<:Any, <:Any, <:LpNorm},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    args...;
    prefix,
    kwargs...
) -> Any

Add JuMP risk constraints for TrackingRiskMeasure with LpNorm to model.

Introduces a scalar variable and power-cone constraints to encode the Lp-norm tracking error between portfolio and benchmark returns, scaled by (T - ddof)^(1/p).

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r::TrackingRiskMeasure{<:Any, <:Any, <:LpNorm}: The tracking risk measure.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr: Prior result.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::TrackingRiskMeasure{<:Any, <:Any, <:LInfNorm},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    args...;
    prefix,
    kwargs...
) -> Any

Add JuMP risk constraints for TrackingRiskMeasure with LInfNorm to model.

Introduces a scalar variable and an infinity-norm cone constraint to encode the L∞-norm (maximum) tracking error between portfolio and benchmark returns. Its norm_factor is 1.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r::TrackingRiskMeasure{<:Any, <:Any, <:LInfNorm}: The tracking risk measure.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr: Prior result.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:IndependentVariableTracking},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    pl::Union{Nothing, AbstractPhylogenyConstraintResult, AbstractVector{<:AbstractPhylogenyConstraintResult}},
    fees::Union{Nothing, Fees},
    args...;
    prefix,
    kwargs...
) -> Any

Add JuMP risk constraints for RiskTrackingRiskMeasure with IndependentVariableTracking to model.

Stores the benchmark-shifted weights w - wb*k at Symbol(tprefix, :w) under the composed tracking prefix tprefix = nested_prefix(prefix, :tr_iv_, i), builds the inner risk on those weights with set_risk_constraints! at the index 1 under tprefix, then applies risk bounds and expression registration. The prefix namespacing replaces the former save/restore swap and is re-entrant.

The inner build reads and writes its Model State keys (:w, :net_X, the scratch of each measure) under tprefix, so they cannot collide with the keys of the enclosing build. Its prefix alone separates them, so the index 1 seeds only the measure axis, as at the outer level, because state_key resolves both axes. The lifted matrix :W and the marks :variance_flag and :rc_variance belong to the namespace that owns the weights, weights_prefix. For the shifted weights here, that is tprefix. The prefixes compose through nested_prefix, so a tracking measure inside a tracking measure is free of collisions.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:IndependentVariableTracking}: The risk-tracking risk measure.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr: Prior result.
  • pl: Optional phylogeny constraints.
  • fees: Optional fees structure.

Returns

  • The tracking risk JuMP expression.

Related

source
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
    model::Model,
    i,
    r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:DependentVariableTracking},
    opt::Union{AbstractProgrammeAllocationSet, RiskJuMPOptimisationEstimator},
    pr::AbstractPriorResult,
    pl::Union{Nothing, AbstractPhylogenyConstraintResult, AbstractVector{<:AbstractPhylogenyConstraintResult}},
    fees::Union{Nothing, Fees},
    args...;
    prefix,
    kwargs...
) -> VariableRef

Add JuMP risk constraints for RiskTrackingRiskMeasure with DependentVariableTracking to model.

Computes the benchmark's expected risk value, stores the (unshifted) portfolio weights at Symbol(tprefix, :w) under the composed tracking prefix tprefix = nested_prefix(prefix, :tr_dv_, i), builds the inner portfolio risk with set_risk_constraints! at the index 1 under tprefix, then adds an L1-norm cone constraint on the difference between the portfolio's risk expression and the benchmark's expected risk scaled by the allocation variable k. The prefix namespacing replaces the former save/restore swap and is re-entrant.

The weights under tprefix are the weights under prefix, so the method also registers w_owner, the namespace that owns them, weights_prefix. The inner build then reads the enclosing build's lifted matrix $\mathbf{W}$ and its marks variance_flag and rc_variance. A semidefinite phylogeny on the head constrains the inner variance. The inner variance is no term of the objective, because the tracking constructor clears its rke, so it does not remove the phylogeny's p · tr(W) penalty, mark_objective_variance!.

JuMP formulation

Variables

  • w, k: read from the model.
  • tracking_risk_i: created, the tracking risk.

Expressions

  • r_dv_i: $d = \rho(\boldsymbol{w}) - r_b k$.

Constraints

  • crtr_noc_i: $[s_c t;\ s_c d] \in \mathcal{K}_{1}$, that is $t \geq \lvert d \rvert$.

Relaxation

The encoding is not exact: the entries below bound the quantity instead of reproducing it, and the bound is tight only under the condition stated here.

  • Direction. tracking_risk_i can lie below $\lvert R(\boldsymbol{w}) - r_b k \rvert$ when the inner model expression $\rho(\boldsymbol{w})$ lies above the exact risk $R(\boldsymbol{w})$. Every inner measure that the model states through an epigraph has $\rho(\boldsymbol{w}) \geq R(\boldsymbol{w})$, and the solver can raise $\rho$ to $r_b k$ at no cost. For ConditionalValueatRisk it raises the auxiliary variables, for StandardDeviation and LowOrderMoment the cone variable. A Variance in the semidefinite form has $\rho = \mathrm{tr}(\boldsymbol{\Sigma}\mathbf{W})$, and the step $\mathbf{W} + t\,\boldsymbol{e}_i\boldsymbol{e}_i^\intercal$ keeps every row. With no price on that rise, the model value is $\max(0,\ R(\boldsymbol{w}) - r_b k)$: it penalises a portfolio riskier than the benchmark, and it can report zero for one that is less risky.
  • Quantity. tracking_risk_i and r_dv_i.
  • Condition. The model value equals the exact value when $\rho(\boldsymbol{w}) = R(\boldsymbol{w})$ at the solution. When $R(\boldsymbol{w}) \geq r_b k$ it is not below the exact value. The inner build owns its auxiliary variables under tprefix, so no other term prices them, and an epigraph measure stays one-sided. The semidefinite Variance is the one exception, because its $\mathbf{W}$ is the head's. In the objective, $\mathbf{W}$ stays tight when the phylogeny's penalty and the variances that the objective minimises on the same weights price the step at least as much as the tracking term gains, $p + s_v \Sigma_{ii} \geq s \Sigma_{ii}$ for every $i$. With no minimised variance that is $p \geq s \max_i \Sigma_{ii}$. As a bound, settings.ub, no condition makes it tight, so the bound is the ceiling $R(\boldsymbol{w}) \leq (r_b + u)\,k$ for every inner measure.

Where:

  • $\boldsymbol{w}$: Portfolio weights vector $N \times 1$.
  • $k$: Variable that scales the budget in the homogenised problem.
  • $s_c$: Constraint scale. It multiplies both sides of a row, so a positive value leaves the feasible set unchanged.
  • $t$: The tracking risk, tracking_risk_i.
  • $\rho(\boldsymbol{w})$: The inner measure's model expression, built under tprefix.
  • $R(\boldsymbol{w})$: The inner measure's exact risk.
  • $r_b$: The benchmark's expected risk, the inner measure at r.tr.w.
  • $\mathcal{K}_{1}$: The norm-one cone of dimension 2.
  • $\boldsymbol{\Sigma}$: The covariance matrix of the inner variance.
  • $\mathbf{W}$: The lifted matrix of the weights, set_sdp_constraints!.
  • $p$: The penalty of the SemiDefinitePhylogeny, set_sdp_phylogeny_constraints!.
  • $s$: The scale of the tracking measure, r.settings.scale.
  • $u$: The upper bound of the tracking measure, r.settings.ub.
  • $s_v$: The scale of a variance that the objective minimises on the same weights.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.
  • i: Constraint index for unique variable and constraint naming.
  • r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:DependentVariableTracking}: The risk-tracking risk measure.
  • opt::RiskConstraintOwner: The owner of the risk constraint, a risk-based JuMP optimisation estimator or a programme Allocation Set.
  • pr: Prior result.
  • pl: Optional phylogeny constraints.
  • fees: Optional fees structure.

Returns

  • The tracking risk JuMP expression.

Related

source