Moment Risk Constraints
PortfolioOptimisers.calc_risk_constraint_target Function
calc_risk_constraint_target(
_::Union{HighOrderMoment{var"#s9123", var"#s9122", Nothing, var"#s9121"}, LowOrderMoment{var"#s9123", var"#s9122", Nothing, var"#s9121"}} where {var"#s9123", var"#s9122", var"#s9121"},
w::AbstractVector{<:Union{var"#s19", var"#s18"} where {var"#s19"<:Number, var"#s18"<:AbstractJuMPScalar}},
mu::AbstractVector{<:Union{var"#s19", var"#s18"} where {var"#s19"<:Number, var"#s18"<:AbstractJuMPScalar}},
args...
) -> AnyCompute the target return used as the reference level for lower/upper moment risk constraints.
Dispatches on the type of r.mu: when nothing, uses the prior mean vector mu; when a VecNum, uses r.mu; when a VecScalar, combines the vector and scalar parts with k; when a scalar Number, scales it by k.
Arguments
r::LoHiOrderMoment: Risk measure carrying the target specification.w: Portfolio weight vector.mu::VecNum: Prior mean return vector.k: Leverage/scale variable from the model.
Returns
- The scalar target return used as the lower moment reference.
Related
sourcePortfolioOptimisers.set_risk_constraints! Method
set_risk_constraints!(
model::Model,
i,
r::LowOrderMoment{<:Any, <:Any, <:Any, <:FirstLowerMoment},
opt::RiskJuMPOptimisationEstimator,
pr::AbstractPriorResult,
args...;
kwargs...
) -> AnyAdd first lower moment, mean absolute deviation, or second moment risk constraints to model.
Each overload introduces auxiliary non-negative variables (semi-deviations or lower exceedances) for T observations, computes an observation-weighted mean, and adds an inequality constraint linking the auxiliary variables to the portfolio returns minus the target. The second-moment overload additionally supports full and lower-half formulations and multiple variance encodings via set_second_moment_risk!.
Arguments
model::JuMP.Model: The JuMP optimisation model.i: Constraint index for unique variable and constraint naming.r::LowOrderMoment: Risk measure instance.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr::AbstractPriorResult: Prior result containingX(returns matrix) andmu.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_constraints! Method
set_risk_constraints!(
model::Model,
i,
r::LowOrderMoment{<:Any, <:Any, <:Any, <:MeanAbsoluteDeviation},
opt::RiskJuMPOptimisationEstimator,
pr::AbstractPriorResult,
args...;
kwargs...
) -> AnyAdd JuMP risk constraints for LowOrderMoment with MeanAbsoluteDeviation semi-deviation to model.
Introduces auxiliary mad variables and adds constraints encoding the mean absolute deviation of portfolio returns relative to the target benchmark. Registers the risk expression and upper-bound constraint.
Arguments
model::JuMP.Model: The JuMP optimisation model.i: Constraint index for unique variable and constraint naming.r::LowOrderMoment{<:Any, <:Any, <:Any, <:MeanAbsoluteDeviation}: The MAD risk measure.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_constraints! Method
set_risk_constraints!(
model::Model,
i,
r::LowOrderMoment{<:Any, <:Any, <:Any, <:SecondMoment},
opt::RiskJuMPOptimisationEstimator,
pr::AbstractPriorResult,
args...;
kwargs...
) -> AnyAdd JuMP risk constraints for LowOrderMoment with SecondMoment (semi-variance / semi-deviation) to model.
Introduces a sqrt_second_moment variable and adds SOC or quadratic constraints encoding the second central moment of portfolio returns relative to the target benchmark. Registers the risk expression and upper-bound constraint.
Arguments
model::JuMP.Model: The JuMP optimisation model.i: Constraint index for unique variable and constraint naming.r::LowOrderMoment{<:Any, <:Any, <:Any, <:SecondMoment}: The second-moment risk measure.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.pr: Prior result.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_second_moment_risk! Function
set_second_moment_risk!(
model::Model,
_::QuadRiskExpr,
_,
factor::Number,
second_moment,
key::Symbol,
args...
) -> Tuple{Any, Any}Build the second-moment risk JuMP expression in one of four encodings.
The QuadRiskExpr overload encodes variance as a quadratic dot product. The RSOCRiskExpr overload uses a rotated second-order cone to encode the squared norm. The SquaredSOCRiskExpr overload squares an existing SOC variable. The SOCRiskExpr overload returns the SOC variable directly (standard deviation form). All methods return the risk expression and a scaling factor.
Arguments
model::JuMP.Model: The JuMP optimisation model.i: Constraint index for unique variable and constraint naming.factor::Number: Variance correction factor (e.g.1 / (T - 1)).second_moment: Return deviation vector or matrix.key::Symbol: Symbol used to name constraints or expressions in the model.keyt,keyc: Symbols for the auxiliary variable and its constraint.tsecond_moment: Pre-existing SOC variable (used by SquaredSOC/SOC overloads).
Returns
- A 2-tuple
(r_expr, factor)of the risk JuMP expression and its scaling factor.
Related
sourcePortfolioOptimisers.second_moment_bound_val Function
second_moment_bound_val(
alg::SecondMomentFormulation,
ub::Frontier,
factor::Number
) -> Frontier{<:Integer, <:Number, Bool}Convert an upper-bound value to the appropriate scale for the second-moment bounding variable.
Scales ub by inv(factor) and, when the formulation is not SOCRiskExpr, applies a square-root transformation to convert from variance to standard-deviation units. Returns nothing when ub is nothing.
Arguments
alg::SecondMomentFormulation: Second-moment risk formulation (e.g.SOCRiskExpr).ub: Upper bound value (scalar, vector,Frontier, ornothing).factor::Number: Variance correction factor.
Returns
- The rescaled upper bound, or
nothingwhenubisnothing.
Related
source