Threshold Constraints
PortfolioOptimisers.set_threshold_constraints! Function
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:
where 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:
Where:
, : Long and short gates ( long_gate,short_gate)., : 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., : Long and short minimum-holding thresholds. : 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 ofsp.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 byset_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