Skip to content
13

Base Risk Constraints

PortfolioOptimisers.scalarise_risk_expression! Function
julia
scalarise_risk_expression!(model, r, X, T, ...) -> nothing

Scalarise 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

source
PortfolioOptimisers.set_risk_constraints! Method
julia
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: A RiskMeasure instance, or rs a vector of risk measures.

  • opt::JuMPOptimisationEstimator: JuMP optimisation estimator.

  • pr: Prior result.

  • pl: Optional phylogeny constraints.

  • fees: Optional fees structure.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_upper_bound! Function
julia
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

source
PortfolioOptimisers.set_risk_expression! Function
julia
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: When false this method is a no-op.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_risk_bounds_and_expression! Function
julia
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, and rke flag.

  • 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

source
PortfolioOptimisers.set_drawdown_constraints! Function
julia
set_drawdown_constraints!(
    model::Model,
    X::AbstractMatrix{<:Union{var"#s20", var"#s19"} where {var"#s20"<:Number, var"#s19"<:AbstractJuMPScalar}};
    prefix
) -> Any

Add 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:

dd0=0,ddt0,ddtddt1r^tddt=maxstVsVt.

Where:

  • ddt: Portfolio drawdown at time t.

  • r^t: Portfolio return at time t.

  • Vt: Cumulative portfolio wealth at time t.

where r^t=xtw and Vt=k+s=1tr^s.

Arguments

  • model::JuMP.Model: The JuMP optimisation model.

  • X::MatNum: Asset returns matrix (T × N).

Returns

  • dd: JuMP variable array of length T + 1 tracking portfolio drawdowns.

Related

source
PortfolioOptimisers.NonFRCJuMPOpt Type
julia
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