# Fixed-charge (setup) cost
#
# Chooses production levels where each active line incurs a one-off setup
# cost plus a per-unit cost. The linking constraint uses the tightest valid
# upper bound, which is the line's own capacity rather than a generic big-M.
#
# Technique: Link a continuous activity to a binary setup with x ≤ U·y so
# the fixed cost is paid exactly when the activity is nonzero.
#
# On this instance the optimum is 29 (minimisation), confirmed
# independently by exhaustive enumeration before publication.
#
# Reference: Beale, E. M. L. and Tomlin, J. A. (1970). Special facilities in
# a general mathematical programming system for non-convex problems using
# ordered sets of variables. OR 69, 447–454.
model m
set I = {1, 2, 3}
const f = {7, 12, 5}, forall i in I
const c = {1, 2, 3}, forall i in I
const u = {4, 3, 2}, forall i in I
const d = 7
int 0 <= x <= 4, forall i in I
bin y, forall i in I
min sum_{i in I}{c_{i} * x_{i}} + sum_{i in I}{f_{i} * y_{i}}
# production only on an opened line, capped at that line's capacity
constr x_{i} <= u_{i} * y_{i}, forall i in I
constr sum_{i in I}{x_{i}} >= d
end
import elytica
Read this through MCP: read with path: "formulations/fixed-charge", or resource hlpl://formulations/fixed-charge.