Skip to content
18

Threshold Constraints

PortfolioOptimisers.set_threshold_constraints! Function
julia
set_threshold_constraints!(
    model::Model,
    sp::AbstractMIPSpace,
    ind::HeldIndicators,
    wx,
    lt::Union{Nothing, Threshold},
    lt_flag::Bool
)

Add minimum-holding threshold constraints to the JuMP optimisation model.

A threshold says an asset, if held, must carry at least lt (long) or st (short) of the budget — never a sliver. The constraint therefore has to be gated by the held/sign indicator, which is why it lives with the indicator bundle rather than with the plain weight bounds, and why its shape depends on which bundle the builder produced.

Mathematical definition

For HeldIndicators the held gate multiplies the threshold directly, so a single constraint suffices and there is no short side:

wigii,

where gi is the held gate (held), which relaxes to a continuous variable when the budget is free.

For LongShortIndicators the long and short thresholds are separate, each switched off by a big-M slack when the asset is on the other side:

wigiliM(1bil),wigissi+M(1bis).

Where:

  • gil, gis: Long and short gates (long_gate, short_gate).

  • bil, bis: Long and short binaries (long_bin, short_bin), which switch the constraint off — they must be the binaries, not the gates, so the switch is exactly 0 or 1 even when the gates relax.

  • i, si: Long and short minimum-holding thresholds.

  • M: Big-M constant.

Arguments

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

  • sp::AbstractMIPSpace: Weight space the constraints act on.

  • ind::AbstractMIPIndicators: Indicator bundle the thresholds gate on.

  • wx: Weight expression in the space of sp.

  • lt::Option{<:Threshold}: Long-side minimum-holding threshold.

  • st::Option{<:Threshold}: Short-side minimum-holding threshold (long-short method only).

  • ss: Big-M expression (long-short method only), as registered by set_mip_ss_expr!.

  • lt_flag::Bool: Whether to add the long threshold.

  • st_flag::Bool: Whether to add the short threshold (long-short method only).

Returns

  • nothing.

Related

source