Tracking Risk Measure Constraints: private API
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::TrackingRiskMeasure{<:Any, <:Any, <:L1Norm},
opt::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 delegating to set_risk_tracking_risk_constraints!. The dependent-variable overload computes a benchmark risk and adds an L1-norm cone on the risk difference via set_risk_tracking_risk_constraints!.
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 ($T$, $\sqrt{T-d}$, etc.).
Arguments
model::JuMP.Model: The JuMP optimisation model.i: Constraint index for unique variable and constraint naming.r: Tracking risk measure instance.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr::AbstractPriorResult: Prior result containing the returns matrixX.pl: Optional phylogeny constraints.fees: Optional fees structure.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::TrackingRiskMeasure{<:Any, <:Any, <:Union{var"#s7082", var"#s7081"} where {var"#s7082"<:L2Norm, var"#s7081"<:SquaredL2Norm}},
opt::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.
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::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::TrackingRiskMeasure{<:Any, <:Any, <:LpNorm},
opt::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::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::TrackingRiskMeasure{<:Any, <:Any, <:LInfNorm},
opt::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, scaled by T - ddof.
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::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:IndependentVariableTracking},
opt::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), delegates to set_risk_tracking_risk_constraints! to build the inner risk on those weights under tprefix, then applies risk bounds and expression registration. The prefix namespacing replaces the former save/restore swap and is re-entrant.
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::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.pl: Optional phylogeny constraints.fees: Optional fees structure.
Returns
- The tracking risk JuMP expression.
Related
PortfolioOptimisers.set_risk_constraints! — Method
set_risk_constraints!(
model::Model,
i,
r::RiskTrackingRiskMeasure{<:Any, <:Any, <:Any, <:DependentVariableTracking},
opt::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), delegates to set_risk_tracking_risk_constraints! to build the inner portfolio risk 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.
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::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.pl: Optional phylogeny constraints.fees: Optional fees structure.
Returns
- The tracking risk JuMP expression.
Related
PortfolioOptimisers.set_tracking_risk! — Function
set_tracking_risk!(
model::Model,
r::TrackingRiskMeasure{<:Any, <:Any, <:L2Norm},
opt::RiskJuMPOptimisationEstimator,
tracking_risk::AbstractJuMPScalar,
i;
prefix
) -> AbstractJuMPScalar
Finalise the L2 or squared-L2 tracking risk expression and apply bounds.
The L2Norm overload calls set_risk_bounds_and_expression! directly with the SOC variable. The SquaredL2Norm overload squares it and applies a sqrt-converted upper bound to the original SOC variable.
Arguments
model::JuMP.Model: The JuMP optimisation model.r::TrackingRiskMeasure: Tracking risk measure instance.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.tracking_risk::JuMP.AbstractJuMPScalar: Normalised tracking-risk SOC variable.i: Constraint index for unique variable and constraint naming.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_tr_constraints! — Function
set_risk_tr_constraints!(
model::Model,
r::RiskMeasure,
opt::JuMPOptimisationEstimator,
pr::AbstractPriorResult,
pl::Union{Nothing, AbstractPhylogenyConstraintResult, AbstractVector{<:AbstractPhylogenyConstraintResult}},
fees::Union{Nothing, Fees},
args...;
kwargs...
) -> Any
Dispatch to indexed set_risk_constraints! for a single measure or iterate over a vector of measures.
The nested build's entries are separated from the enclosing build's by its prefix alone. The index seeds only the measure axis, exactly as it does at the outer level, because state_key resolves both axes. Seeding the index with the prefix as well — which this did in an earlier design — carried the same fact twice.
Arguments
model::JuMP.Model: The JuMP optimisation model.r: ARiskMeasureor a vector of risk measures.opt::JuMPOptimisationEstimator: JuMP optimisation estimator.pr: Prior result.pl: Optional phylogeny constraints.fees: Optional fees structure.
Returns
nothing.
Related
PortfolioOptimisers.set_risk_tracking_risk_constraints! — Function
set_risk_tracking_risk_constraints!(
model::Model,
r,
opt::RiskJuMPOptimisationEstimator,
pr::AbstractPriorResult,
pl::Union{Nothing, AbstractPhylogenyConstraintResult, AbstractVector{<:AbstractPhylogenyConstraintResult}},
fees::Union{Nothing, Fees},
tprefix::Symbol,
args...;
kwargs...
) -> Any
Build the inner risk expression for risk tracking under a namespaced tprefix.
The caller stores the tracking-difference weights under tprefix, so the inner set_risk_tr_constraints! build reads and writes ALL of its model-state keys (:w, :net_X, :W, :variance_flag, the per-measure scratch, …) under tprefix and cannot collide with the outer model's keys. This replaces the former save/unregister/restore swap: the prefix isolates the nested build structurally. Because tracking prefixes COMPOSE (tprefix = nested_prefix(prefix, :tr_iv_, i)), tracking-nested-in-tracking is collision-free.
Arguments
model::JuMP.Model: The JuMP optimisation model.r: Inner risk measure (or vector of measures).opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.pl: Optional phylogeny constraints.fees: Optional fees structure.tprefix::Symbol: Composed tracking prefix namespacing the nested build's keys.
Returns
- The inner risk JuMP expression.
Related