Skip to content
18

Relaxed risk budgeting

PortfolioOptimisers.RelaxedRiskBudgetingAlgorithm Type
julia
abstract type RelaxedRiskBudgetingAlgorithm <: OptimisationAlgorithm

Abstract supertype for relaxed risk budgeting algorithm variants.

Related Types

source
PortfolioOptimisers.BasicRelaxedRiskBudgeting Type
julia
struct BasicRelaxedRiskBudgeting <: RelaxedRiskBudgetingAlgorithm

Basic Relaxed Risk Budgeting formulation.

Uses the basic Second Order Cone (SOC) relaxation of the risk budgeting problem without additional regularisation.

Related Types

source
PortfolioOptimisers.RegularisedRelaxedRiskBudgeting Type
julia
struct RegularisedRelaxedRiskBudgeting <: RelaxedRiskBudgetingAlgorithm

Regularised Relaxed Risk Budgeting formulation.

Extends the basic SOC formulation with a regularisation term to improve numerical stability.

Related Types

source
PortfolioOptimisers.RegularisedPenalisedRelaxedRiskBudgeting Type
julia
struct RegularisedPenalisedRelaxedRiskBudgeting{__T_p} <: RelaxedRiskBudgetingAlgorithm

Regularised and penalised Relaxed Risk Budgeting formulation.

Extends the regularised formulation with a penalty on deviations from target risk budgets, controlled by parameter p.

Fields

  • p: Power or order parameter.

Constructors

julia
RegularisedPenalisedRelaxedRiskBudgeting(;
    p::Number = 1.0
) -> RegularisedPenalisedRelaxedRiskBudgeting

Keywords correspond to the struct's fields.

Validation

  • isfinite(p) and p > 0.

Related Types

source
PortfolioOptimisers.RelaxedRiskBudgeting Type
julia
struct RelaxedRiskBudgeting{__T_opt, __T_rba, __T_wi, __T_alg, __T_fb} <: JuMPOptimisationEstimator

Relaxed Risk Budgeting (RRB) portfolio optimiser.

RelaxedRiskBudgeting implements a relaxed formulation of the risk budgeting problem using a Second Order Cone constraint on the portfolio variance. Unlike RiskBudgeting, it does not require a logarithmic or mixed-integer formulation, making it computationally more tractable.

Fields

  • opt: JuMP optimiser configuration.

  • rba: Risk budget algorithm.

  • wi: Initial portfolio weights for warm-starting the solver.

  • alg: Relaxed risk budgeting algorithm variant.

  • fb: Fallback result or estimator.

Constructors

julia
RelaxedRiskBudgeting(;
    opt::JuMPOptimiser,
    rba::TD{<:RiskBudgetingAlgorithm} = AssetRiskBudgeting(),
    wi::TD_Option{<:VecNum} = nothing,
    alg::RelaxedRiskBudgetingAlgorithm = BasicRelaxedRiskBudgeting(),
    fb::TDO_Option{<:OptE_Opt} = nothing
) -> RelaxedRiskBudgeting

Keywords correspond to the struct's fields. Fields typed TD, TD_Option or TDO_Option may hold a TimeDependent per-fold schedule instead of a static value: the budgeting algorithm (and with it the risk budget), warm start and fallback are problem definition, so a cross-validation fold loop resolves them per fold, and a fold-less optimise runs with each at its static default (nothing for wi and fb). The relaxation variant alg is formulation control and stays static.

Validation

  • If wi is provided: !isempty(wi).

  • fb schedules: bind !== :nearest.

Mathematical definition

The Relaxed Risk Budgeting (RRB) formulation replaces the non-convex risk-parity constraint with a second-order cone (SOC) relaxation. Let G be the Cholesky factor of Σ (so GG=Σ). Introduce auxiliary variables ζ=Σw, ψ0, γ0:

minw,ψ,γ,ζψγ,s.t.ζ=Σw,(wi+ζi2γbiwiζi)KSOC,i.

The risk cone constraint (basic variant): (ψ,Gw)KSOC, i.e. ψGw2=wΣw.

Where:

  • w: Portfolio weight vector.

  • ψ, γ: Scalar auxiliary variables.

  • ζ: Auxiliary vector equal to Σw.

  • bi: Risk budget for asset i.

  • G: Cholesky factor of Σ (so GG=Σ).

  • Σ: Covariance matrix.

  • KSOC: Second-order cone.

Notes

Because this is a relaxation of the risk budgeting problem, the realised risk contributions will not adhere to the target risk budget as tightly as the exact logarithmic-barrier or mixed-integer formulations in RiskBudgeting. In well-behaved problems the deviation is negligible, but in pathological cases (e.g. ill-conditioned covariance matrices or extreme budget allocations) it can be noticeable. The trade-off is that the SOC formulation is convex and composes cleanly with additional constraints, making it the friendlier choice when the risk budget is one of several objectives rather than a hard requirement. Use RiskBudgeting when strict adherence to the risk budget is essential.

Propagated parameters

When factory is called on this type, the following @fprop-tagged fields are automatically propagated:

  • opt: Recursively updated via factory.

  • fb: Recursively updated via factory.

Related

source
PortfolioOptimisers.needs_previous_weights Method
julia
needs_previous_weights(opt::RelaxedRiskBudgeting) -> Any

Return true if the JuMP optimiser or fallback requires previous portfolio weights.

source
PortfolioOptimisers.relaxed_risk_budgeting_td_defaults Function
julia
relaxed_risk_budgeting_td_defaults(

) -> @NamedTuple{rba::AssetRiskBudgeting{Nothing, Nothing, LogRiskBudgeting{Nothing}}}

Return the static defaults of the RelaxedRiskBudgeting fields that may hold a TimeDependent.

Shared by the constructor's test-substitution pass and time_dependent_field_defaults, so the fold-less value of a field is declared once. Fields whose static default is nothing are omitted.

Related

source
PortfolioOptimisers.factory Method
julia
factory(a::Union{Nothing, <:AbstractEstimator, <:AbstractAlgorithm,
                 <:AbstractResult}, args...; kwargs...) -> a

No-op factory function for constructing objects with a uniform interface.

Defining methods which dispatch on the first argument allows for a consistent factory interface across different types.

factory and port_opt_view are the two propagation mechanisms in this library. They are duals: factory threads runtime values (prior moments, observation weights, previous portfolio weights) down through a composed struct tree; port_opt_view threads an index selection (a subset of assets or observations) down through the same tree.

Arguments

  • a: Indicates no object should be constructed.

  • args...: Arbitrary positional arguments (ignored).

  • kwargs...: Arbitrary keyword arguments (ignored).

Returns

  • a: The input unchanged.

Examples

julia
julia> factory(nothing, 1, 2; x = 3)

julia> factory(MeanValue())
MeanValue
  w ┴ nothing

Related

source
julia
factory(
    opt::Union{NonFiniteAllocationOptimisationEstimator, NonFiniteAllocationOptimisationResult},
    _
) -> SubsetResamplingResult

Return opt unchanged.

Default pass-through factory for optimisation estimators and results. Overridden for estimators that carry parameters requiring update at each optimisation step.

Related

source
PortfolioOptimisers.port_opt_view Method
julia
port_opt_view(
    rrb::RelaxedRiskBudgeting,
    i,
    X::AbstractMatrix{<:Union{var"#s29", var"#s28"} where {var"#s29"<:Number, var"#s28"<:AbstractJuMPScalar}},
    args...
) -> RelaxedRiskBudgeting{JuMPOptimiser{__T_pe, __T_slv, __T_wb, __T_bgt, __T_sbgt, __T_lt, __T_st, __T_lcse, __T_cte, __T_gcarde, __T_sgcarde, __T_smtx, __T_sgmtx, __T_slt, __T_sst, __T_sglt, __T_sgst, __T_tn, __T_fees, __T_sets, __T_tr, __T_ple, __T_ret, __T_sca, __T_ccnt, __T_cobj, __T_sc, __T_so, __T_ss, __T_card, __T_scard, __T_wn2, __T_wnp, __T_wninf, __T_l1, __T_l2, __T_linf, __T_lp, __T_brt, __T_cle_pr, __T_strict}, _A, _B, <:RelaxedRiskBudgetingAlgorithm} where {__T_pe, __T_slv, __T_wb, __T_bgt, __T_sbgt, __T_lt, __T_st, __T_lcse, __T_cte, __T_gcarde, __T_sgcarde, __T_smtx, __T_sgmtx, __T_slt, __T_sst, __T_sglt, __T_sgst, __T_tn, __T_fees, __T_sets, __T_tr, __T_ple, __T_ret, __T_sca, __T_ccnt, __T_cobj, __T_sc, __T_so, __T_ss, __T_card, __T_scard, __T_wn2, __T_wnp, __T_wninf, __T_l1, __T_l2, __T_linf, __T_lp, __T_brt, __T_cle_pr, __T_strict, _A, _B}

Return a cluster-sliced copy of RelaxedRiskBudgeting for asset index set i and returns matrix X.

source
PortfolioOptimisers.set_relaxed_risk_budgeting_alg_constraints! Function
julia
set_relaxed_risk_budgeting_alg_constraints!(alg, model, w, sigma, chol)

Add algorithm-specific second-order cone constraints for Relaxed Risk Budgeting.

Dispatches based on the RRB algorithm variant. Adds second-order cone constraints implementing the basic, regularised, or regularised-penalised RRB formulation.

Arguments

Returns

  • nothing.

Related

source
PortfolioOptimisers._set_relaxed_risk_budgeting_constraints! Method
julia
_set_relaxed_risk_budgeting_constraints!(model, ...)

Internal function to set relaxed risk budgeting constraints in the JuMP model.

Configures inequality constraints for the relaxed risk budgeting formulation, allowing small deviations from exact budget targets.

Arguments

  • model: JuMP model.

  • Additional relaxed risk budgeting parameters.

Returns

  • nothing.

Related

source
PortfolioOptimisers.set_relaxed_risk_budgeting_constraints! Function
julia
set_relaxed_risk_budgeting_constraints!(model, rrb, pr, wb, args...)

Add Relaxed Risk Budgeting (RRB) constraints and weight variables to the JuMP model.

Dispatches based on the risk budgeting algorithm type. Configures weight variables, budget constraints, second-order cone constraints, and weight bounds.

Arguments

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

  • rrb::RelaxedRiskBudgeting: RRB estimator configuration.

  • pr::AbstractPriorResult: Prior result with asset moments.

  • wb::WeightBounds: Weight bounds configuration.

  • args...: Additional arguments (e.g. returns data for factor risk budgeting).

Returns

  • Processed risk budgeting attributes.

Related

source
PortfolioOptimisers.optimise Function
julia
optimise(rrb::RelaxedRiskBudgeting{<:Any, <:Any, <:Any, <:Any, Nothing},
         rd::ReturnsResult = ReturnsResult(); dims::Int = 1,
         str_names::Bool = false, save::Bool = true, kwargs...) -> RiskBudgetingResult

Run the Relaxed Risk Budgeting portfolio optimisation.

Arguments

  • rrb: The relaxed risk budgeting optimiser to use.

  • rd: The returns result to use. If isa(rrb.opt.pe, AbstractPriorResult), rd is not necessary if doing a standalone optimisation, but may be required/desired by fallbacks and/or clusterisation.

  • dims: The dimension along which observations advance in time.

  • str_names: Whether to use string names for the assets in the optimisation.

  • save: Whether to save the JuMP model in the optimisation result.

  • kwargs: Additional keyword arguments passed to the optimisation function.

Related

source