HLPL / VerTeX Modelling Language Documentation

← formulations

# Chance constraint via scenario binaries
#
# Requires a capacity limit to hold in at least a given fraction of
# scenarios rather than all of them. Each scenario gets an indicator that
# buys it out of the constraint, and a cardinality row caps how many may be
# bought out — the deterministic equivalent of "hold with probability at
# least 1 − alpha" when the scenarios are equally likely.
#
# Technique: A per-scenario binary z_s relaxes the constraint by big-M when
#            the scenario is allowed to fail, and sum z_s bounds how many
#            may.
#
# On this instance the optimum is 13 (maximisation), confirmed
# independently by exhaustive enumeration before publication.
#
# Reference: Charnes, A. and Cooper, W. W. (1959). Chance-constrained
# programming. Management Science 6(1), 73–79.
model m
set I = {1, 2, 3, 4}
set S = {1, 2, 3, 4}
const v = {8, 5, 2, 5}, forall i in I
const a = {{1, 4, 2, 3},
           {1, 3, 1, 4},
           {1, 4, 2, 3},
           {2, 2, 5, 1}}, forall s in S, forall i in I
const lim = 5
const M = 25

bin x, forall i in I
bin z, forall s in S

max sum_{i in I}{v_{i} * x_{i}}

# z_s = 1 buys scenario s out of the capacity limit
constr sum_{i in I}{a_{s,i} * x_{i}} <= lim + M * z_{s}, forall s in S
# at most 2 scenario(s) may be violated
constr sum_{s in S}{z_{s}} <= 2
end

import elytica

Read this through MCP: read with path: "formulations/chance-constraint", or resource hlpl://formulations/chance-constraint.