Base Risk Constraints
PortfolioOptimisers.scalarise_risk_expression! Function
scalarise_risk_expression!(model, r, X, T, ...) -> nothingScalarise a risk expression and add it to the JuMP model objective.
Generic function stub; concrete methods are defined in constraint and risk measure files. Each method adds the appropriate risk objective term for a given risk measure type r.
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.flag::Bool: If true, sets upper bound; if false sets lower bound (default:true).
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
)
set_risk_bounds_and_expression!(
model::Model,
opt::RiskJuMPOptimisationEstimator,
r_expr::AbstractJuMPScalar,
settings::RiskMeasureSettings,
key,
flag::Bool
)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.flag::Bool: If true, sets upper bound; if false sets lower bound (default:true).
Returns
nothing.
Related
sourcePortfolioOptimisers.set_drawdown_constraints! Function
set_drawdown_constraints!(
model::Model,
X::AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}};
prefix
) -> 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.
Mathematical definition
Drawdown recurrence:
Where:
: Portfolio drawdown at time . : Portfolio return at time . : Cumulative portfolio wealth at time .
where
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
sourcePortfolioOptimisers.NonFRCJuMPOpt Type
const NonFRCJuMPOpt = Union{<:MeanRisk, <:NearOptimalCentering, <:RiskBudgeting}Alias for JuMP optimisers that do not use factor risk contribution.
Matches MeanRisk, NearOptimalCentering, or RiskBudgeting. Used for dispatch in risk constraint generation functions that apply to these optimiser types but not to factor risk contribution.
Related
source