Skip to content
18

Regularisation Constraints

PortfolioOptimisers.set_l1_regularisation! Function
julia
set_l1_regularisation!(model::JuMP.Model, l1_val::Number)
set_l1_regularisation!(args...)

Add an L1 regularisation penalty to the objective function.

The penalty is applied as given, so l1_val must be commensurate with the scale of the objective it is added to.

Mathematical definition

penalty=λ1w1.

Where:

  • λ1: L1 regularisation coefficient.

  • w: Portfolio weights vector N×1.

Arguments

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

  • l1_val::Number: L1 regularisation coefficient.

Returns

  • nothing.

Details

  • l1_val::Number: Introduces the auxiliary variable t_l1, bounds it with [t_l1; w] in MOI.NormOneCone, and adds l1_val * t_l1 to the objective penalty via add_to_objective_penalty!.

  • args...: No-op, used when no L1 regularisation is configured.

Related

source
PortfolioOptimisers._set_l2_regularisation! Function
julia
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
                        l2::L2Regularisation{<:Any, <:SOCRiskExpr}, sc::Number)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
                        l2::L2Regularisation{<:Any, <:SquaredSOCRiskExpr}, sc::Number)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
                        l2::L2Regularisation{<:Any, <:QuadRiskExpr}, args...)
_set_l2_regularisation!(model::JuMP.Model, i::Integer, w::VecNum,
                        l2::L2Regularisation{<:Any, <:RSOCRiskExpr}, sc::Number)

Add the i-th L2 regularisation penalty to the objective, in the formulation given by l2.alg.

The coefficient l2.val is applied as given, so it must be consistent with the formulation it multiplies: SOCRiskExpr penalises w2, whereas SquaredSOCRiskExpr, QuadRiskExpr and RSOCRiskExpr penalise w22. The same val therefore does not produce the same penalty across formulations.

QuadRiskExpr yields a quadratic objective term rather than a conic one; add_to_objective_penalty! promotes an affine penalty expression to a JuMP.QuadExpr to accommodate it.

Mathematical definition

penalty=λ2w2,penalty=λ2w22.

Where:

  • λ2: L2 regularisation coefficient, the val field of l2.

  • w: Portfolio weights vector N×1.

Arguments

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

  • i::Integer: Index of the term, used to suffix the variables and constraints it creates so that multiple terms do not collide.

  • w::VecNum: Portfolio weights variable.

  • l2::L2Regularisation: The L2 regularisation term.

  • sc::Number: Constraint scale factor.

Returns

  • nothing.

Details

  • l2::L2Regularisation{<:Any, <:SOCRiskExpr}: Introduces t_l2_i, constrains [t_l2_i; w] in SecondOrderCone so that t_l2_i >= norm(w, 2), and penalises val * t_l2_i.

  • l2::L2Regularisation{<:Any, <:SquaredSOCRiskExpr}: Introduces t_l2_i, constrains [t_l2_i; w] in SecondOrderCone so that t_l2_i >= norm(w, 2), and penalises val * t_l2_i^2.

  • l2::L2Regularisation{<:Any, <:QuadRiskExpr}: Introduces no auxiliary variable, and penalises val * dot(w, w) directly.

  • l2::L2Regularisation{<:Any, <:RSOCRiskExpr}: Introduces t_l2_i, constrains [t_l2_i; 0.5; w] in RotatedSecondOrderCone so that t_l2_i >= norm(w, 2)^2, and penalises val * t_l2_i.

Related

source
PortfolioOptimisers.set_l2_regularisation! Function
julia
set_l2_regularisation!(model::JuMP.Model, l2s::L2Reg_VecL2Reg)
set_l2_regularisation!(args...)

Add one or more L2 regularisation penalties to the objective function.

Each L2Regularisation carries its own coefficient and cone formulation, so several may be combined in a single model. The penalties are applied as given, so each coefficient must be commensurate with the scale of the objective it is added to, and with the formulation used to express it.

Mathematical definition

penalty=iλ2,iw2.

Where:

  • λ2,i: L2 regularisation coefficient of the i-th term.

  • w: Portfolio weights vector N×1.

Arguments

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

  • l2s::L2Reg_VecL2Reg: One or more L2 regularisation terms.

Returns

  • nothing.

Details

  • l2s::L2Reg_VecL2Reg: Dispatches each term to _set_l2_regularisation!, which selects the cone formulation from the term's alg field. Variables and constraints are suffixed by the term's index, so terms do not collide.

  • args...: No-op, used when no L2 regularisation is configured.

Related

source
PortfolioOptimisers.set_lp_regularisation! Function
julia
set_lp_regularisation!(model::JuMP.Model, lps::LpReg_VecLpReg)
set_lp_regularisation!(args...)

Add one or more Lp regularisation penalties to the objective function.

Each LpRegularisation carries its own norm order and coefficient, so several may be combined in a single model. The penalties are applied as given, so each coefficient must be commensurate with the scale of the objective it is added to.

The same estimator also specifies a p-norm constraint when it is placed in the wnp field of JuMPOptimiser instead of the lp field, in which case its val field is a bound rather than a coefficient. See set_weight_norm_p_constraints!.

Mathematical definition

penalty=iλp,iwpi.

Where:

  • λp,i: Regularisation coefficient of the i-th term, its val field.

  • pi: Norm order of the i-th term, its p field.

  • w: Portfolio weights vector N×1.

Arguments

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

  • lps::LpReg_VecLpReg: One or more Lp regularisation terms.

Returns

  • nothing.

Details

  • lps::LpReg_VecLpReg: For each term, introduces the auxiliary variables t_lp_i and r_lp_i, bounds wpi above by t_lp_i with a set of MOI.PowerCone constraints, and adds val * t_lp_i to the objective penalty via add_to_objective_penalty!. Variables and constraints are suffixed by the term's index, so terms do not collide.

  • args...: No-op, used when no Lp regularisation is configured.

Related

source
PortfolioOptimisers.set_linf_regularisation! Function
julia
set_linf_regularisation!(model::JuMP.Model, linf::Number)
set_linf_regularisation!(args...)

Add an L∞ regularisation penalty to the objective function.

The penalty is applied as given, so linf must be commensurate with the scale of the objective it is added to and with the range of values the weights can take.

Mathematical definition

penalty=λw.

Where:

  • λ: L∞ regularisation coefficient.

  • w: Portfolio weights vector N×1.

Arguments

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

  • linf::Number: L∞ regularisation coefficient.

Returns

  • nothing.

Details

  • linf::Number: Introduces the auxiliary variable t_linf, bounds it with [t_linf; w] in MOI.NormInfinityCone, and adds linf * t_linf to the objective penalty via add_to_objective_penalty!.

  • args...: No-op, used when no L∞ regularisation is configured.

Related

source
julia
set_linf_regularisation!(model::Model, linf::Number)

Sets the L∞ regularisation term in the objective function. The penalty value is not adjusted so it must be consistent with the range of values the weights can take.

source
PortfolioOptimisers.AbstractRegularisationEstimator Type
julia
abstract type AbstractRegularisationEstimator <: AbstractEstimator

Abstract supertype for all portfolio weight regularisation estimators.

Related

source
PortfolioOptimisers.LpRegularisation Type
julia
struct LpRegularisation{__T_p, __T_val} <: AbstractRegularisationEstimator

Lp-norm regularisation term added to the optimisation objective.

Penalises concentrated portfolios by encouraging weight smoothness for p>1.

The same estimator serves double duty. In the lp field of JuMPOptimiser it is a penalty, and val is the coefficient multiplying the norm. In the wnp field it is a constraint, and val is instead a lower bound on the p-norm effective number of assets. The norm order p means the same thing in both. See set_lp_regularisation! and set_weight_norm_p_constraints!.

Mathematical definition

penalty=valwp.

Where:

  • val: Regularisation coefficient.

  • p>1: Norm order.

  • w: Portfolio weights vector N×1.

Fields

  • p: Norm order, p > 1.

  • val: Penalty coefficient when the estimator is used as a regularisation term (the lp field of JuMPOptimiser), or the lower bound on the p-norm effective number of assets when it is used as a weight norm constraint (the wnp field).

Constructors

julia
LpRegularisation(; p::Number = 3, val::Number = 1e-3) -> LpRegularisation

Keywords correspond to the struct's fields.

Validation

  • isfinite(p).

  • p > 1.

  • val > 0 and finite.

Related

source
PortfolioOptimisers.VecL2Reg Type
julia
const VecL2Reg = AbstractVector{<:L2Regularisation}

Alias for a vector of L2Regularisation objects.

Represents a collection of L2-norm regularisation terms to be added to the optimisation objective.

Related

source
PortfolioOptimisers.L2Regularisation Type
julia
struct L2Regularisation{__T_val, __T_alg} <: AbstractRegularisationEstimator

L2-norm regularisation term added to the optimisation objective.

Penalises concentrated portfolios by shrinking the weights towards zero. The alg field selects the formulation used to express the penalty, which determines both the cones the solver sees and the power of the norm being penalised, so val must be interpreted in the light of the chosen formulation — see _set_l2_regularisation!.

Mathematical definition

penalty=λ2w2,penalty=λ2w22.

Where:

  • λ2: L2 regularisation coefficient, the val field.

  • w: Portfolio weights vector N×1.

The first form is used by SOCRiskExpr; the second by SquaredSOCRiskExpr, QuadRiskExpr and RSOCRiskExpr.

Fields

  • val: L2 regularisation penalty coefficient.

  • alg: Second-moment formulation used to express the L2 penalty.

Constructors

julia
L2Regularisation(;
    val::Number = 1e-4,
    alg::SecondMomentFormulation = SOCRiskExpr()
) -> L2Regularisation

Keywords correspond to the struct's fields.

Validation

  • val > 0 and finite.

Related

source
PortfolioOptimisers.L2Reg_VecL2Reg Type
julia
const L2Reg_VecL2Reg = Union{<:L2Regularisation, <:VecL2Reg}

Alias for a single or vector of L2 regularisation terms.

Matches either a single L2Regularisation or a vector of them (VecL2Reg).

Related

source
PortfolioOptimisers.VecLpReg Type
julia
const VecLpReg = AbstractVector{<:LpRegularisation}

Alias for a vector of LpRegularisation objects.

Represents a collection of Lp-norm regularisation terms to be added to the optimisation objective.

Related

source
PortfolioOptimisers.LpReg_VecLpReg Type
julia
const LpReg_VecLpReg = Union{<:LpRegularisation, <:VecLpReg}

Alias for a single or vector of Lp regularisation terms.

Matches either a single LpRegularisation or a vector of them (VecLpReg).

Related

source