Base Risk Constraints
PortfolioOptimisers.scalarise_risk_expression! Function
scalarise_risk_expression!(model::Model, _::SumScalariser)Collapse the risk_vec expression array stored in model into a single scalar risk JuMP expression.
The SumScalariser method sums all entries into a linear or quadratic expression. The LogSumExpScalariser method introduces auxiliary variables and exponential cone constraints to encode a log-sum-exp scalarisation. The MaxScalariser method introduces a variable and linear constraints to encode the maximum over all entries.
Arguments
model::JuMP.Model: The JuMP optimisation model.sca: Scalariser instance (one ofSumScalariser,LogSumExpScalariser, orMaxScalariser).
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_constraints! Method
set_risk_constraints!(
model::Model,
r::RiskMeasure,
opt::JuMPOptimisationEstimator,
pr::AbstractPriorResult,
pl::Union{Nothing, AbstractPhylogenyConstraintResult, AbstractVector{<:AbstractPhylogenyConstraintResult}},
fees::Union{Nothing, Fees},
args...;
kwargs...
)Dispatch to index-aware set_risk_constraints! for a single risk measure or iterate over a vector of risk measures.
The single-measure overload calls set_risk_constraints!(model, 1, r, ...). The vector overload calls set_risk_constraints!(model, i, rs[i], ...) for each element.
Arguments
model::JuMP.Model: The JuMP optimisation model.r: ARiskMeasureinstance, orrsa vector of risk measures.opt::JuMPOptimisationEstimator: JuMP optimisation estimator.pr: Prior result.pl: Optional phylogeny constraints.fees: Optional fees structure.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_upper_bound! Function
set_risk_upper_bound!(args...)Add an upper-bound constraint on a risk expression to model.
The fall-through method (args...) does nothing. The Front_NumVec overload records the expression and its frontier bound vector in model[:risk_frontier] for later use in Pareto frontier solves. The Number overload adds the constraint sc * (r_expr - ub * k) <= 0 directly to the model.
Arguments
model::JuMP.Model: The JuMP optimisation model.r_expr::JuMP.AbstractJuMPScalar: The risk JuMP expression to bound.ub: Upper bound; a scalar number or a frontier specification.key::Symbol: Symbol used to name the constraint in the model.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_expression! Function
set_risk_expression!(
model::Model,
r_expr::AbstractJuMPScalar,
scale::Number,
rke::Bool
)Push a scaled risk expression onto the risk_vec array in model.
If rke is false the function does nothing. Otherwise it initialises risk_vec if needed and appends scale * r_expr.
Arguments
model::JuMP.Model: The JuMP optimisation model.r_expr::JuMP.AbstractJuMPScalar: The risk JuMP expression to add.scale::Number: Scaling factor applied to the expression.rke::Bool: Whenfalsethis method is a no-op.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_risk_bounds_and_expression! Function
set_risk_bounds_and_expression!(
model::Model,
opt::RiskJuMPOptimisationEstimator,
r_expr::AbstractJuMPScalar,
settings::RiskMeasureSettings,
key
)Apply an upper-bound constraint and register the risk expression for the objective.
Calls set_risk_upper_bound! with settings.ub and set_risk_expression! with settings.scale and settings.rke.
Arguments
model::JuMP.Model: The JuMP optimisation model.opt::RiskJuMPOptimisationEstimator: Risk-based optimisation estimator.r_expr::JuMP.AbstractJuMPScalar: Risk JuMP expression.settings::RiskMeasureSettings: Settings carrying upper bound, scale, andrkeflag.key::Symbol: Symbol used to name constraints or expressions in the model.
Returns
nothing.
Related
sourcePortfolioOptimisers.set_drawdown_constraints! Function
set_drawdown_constraints!(
model::Model,
X::AbstractMatrix{<:Union{var"#s19", var"#s18"} where {var"#s19"<:Number, var"#s18"<:AbstractJuMPScalar}}
) -> AnyAdd portfolio drawdown tracking variables and constraints to model.
Creates the dd variable array (length T + 1) together with three constraints: cdd_start (initial drawdown is zero), cdd_geq_0 (drawdowns are non-negative), and cdd (drawdown recurrence relation). Returns the dd array; returns the existing one if already present in model.
Arguments
model::JuMP.Model: The JuMP optimisation model.X::MatNum: Asset returns matrix (T × N).
Returns
dd: JuMP variable array of lengthT + 1tracking portfolio drawdowns.
Related
source