Skip to content
18

Weight norm constraints

PortfolioOptimisers.set_weight_norm_2_constraints! Function
julia
set_weight_norm_2_constraints!(model::JuMP.Model, val::Number)
set_weight_norm_2_constraints!(args...)

Constrain the 2-norm of the weights.

val is a direct upper bound on w2, expressed relative to the budget k: the constraint is w2valk. Smaller val forces the weights to spread more evenly across the assets.

Mathematical definition

l2cw2,l2cvalk.

Where:

  • l2c: Auxiliary variable upper-bounding w2.

  • w: Portfolio weights vector N×1.

  • k: Budget scaling / homogenisation variable.

  • val: Upper bound on the 2-norm of the weights.

Diversification interpretation

The 2-norm and the effective number of assets are reciprocally related: for a fully invested portfolio (k=1), ENA(w)=1/w22. To require at least m effective assets, set val = 1 / sqrt(m):

w21mENA(w)=1w22m.

Arguments

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

  • val::Number: Upper bound on the 2-norm of the weights.

Returns

  • nothing.

Details

  • val::Number: Introduces the auxiliary variable l2c, bounds it below by w2 with a SecondOrderCone constraint, and adds the linear constraint l2c <= val * k.

  • args...: No-op, used when no 2-norm weight constraint is configured.

Related

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

Constrain the p-norm of the weights.

Generalises set_weight_norm_2_constraints! to an arbitrary norm order p>1. Each term supplies its own norm order and bound, so several may be imposed at once.

Each term is an LpRegularisation, reused here as a constraint rather than a penalty: its p field is the norm order, and its val field is a direct upper bound on wp, expressed relative to the budget k. Smaller val forces a more evenly spread portfolio.

Mathematical definition

tp,iwpi,tp,ivalik.

Where:

  • tp,i: Auxiliary variable upper-bounding wpi.

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

  • vali: Upper bound on the pi-norm of the weights, its val field.

  • w: Portfolio weights vector N×1.

  • k: Budget scaling / homogenisation variable.

Diversification interpretation

For a fully invested portfolio (k=1), the p-norm effective number of assets is ENAp(w)=1/wpp. To require at least m p-norm effective assets, set val = m^(-1/p):

wpm1/pENAp(w)=1wppm.

Arguments

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

  • lps::LpReg_VecLpReg: One or more p-norm weight constraints.

Returns

  • nothing.

Details

  • lps::LpReg_VecLpReg: For each term, introduces the auxiliary variables t_lpc_i and r_lpc_i, bounds wpi above by t_lpc_i with a set of MOI.PowerCone constraints, and adds the linear constraint t_lpc_i <= val * k. Variables and constraints are suffixed by the term's index, so terms do not collide, and are named distinctly from those of set_lp_regularisation! so a model may carry both an Lp penalty and a p-norm constraint.

  • args...: No-op, used when no p-norm weight constraint is configured.

Related

source
PortfolioOptimisers.set_weight_norm_inf_constraints! Function
julia
set_weight_norm_inf_constraints!(model::JuMP.Model, val::Number)
set_weight_norm_inf_constraints!(args...)

Constrain the ∞-norm of the weights, capping the largest absolute weight.

The limiting case of set_weight_norm_p_constraints!. val is a direct upper bound on the largest absolute weight, expressed relative to the budget k: the constraint is wvalk. So a fully invested portfolio (k=1) constrained with val = 0.2 holds no position larger than 20%. Smaller val forces a more evenly spread portfolio.

Mathematical definition

tw,tvalk.

Where:

  • t: Auxiliary variable upper-bounding w.

  • val: Upper bound on the largest absolute weight.

  • w: Portfolio weights vector N×1.

  • k: Budget scaling / homogenisation variable.

Diversification interpretation

Capping the largest weight spreads the portfolio across a minimum number of assets. To spread across at least m assets, set val = 1 / m: no single position can then exceed a 1/m share of a fully invested portfolio.

Arguments

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

  • val::Number: Upper bound on the largest absolute weight.

Returns

  • nothing.

Details

  • val::Number: Introduces the auxiliary variable t_linfc, bounds it below by w with a MOI.NormInfinityCone constraint, and adds the linear constraint t_linfc <= val * k.

  • args...: No-op, used when no ∞-norm weight constraint is configured.

Related

source