HLPL / VerTeX Modelling Language Documentation

← formulations

# Single-item lot sizing with setups
#
# Decides when to produce and how much, trading setup cost against holding
# cost. The balance constraint uses index arithmetic to reference the
# previous period, with the first period split out because t-1 would fall
# outside the set.
#
# Technique: Inventory balance across periods with index arithmetic s_{t} =
#            s_{t-1} + x_{t} - d_{t}, and production gated on a setup
#            binary.
#
# On this instance the optimum is 18 (minimisation), confirmed
# independently by exhaustive enumeration before publication.
#
# Reference: Wagner, H. M. and Whitin, T. M. (1958). Dynamic version of the
# economic lot size model. Management Science 5(1), 89–96.
# doi:10.1287/mnsc.5.1.89
model m
set T = {1, 2, 3, 4}
const d = {1, 1, 1, 1}, forall t in T
const f = 6
const h = 3
const M = 4

int 0 <= x <= 4, forall t in T
int 0 <= s <= 4, forall t in T
bin y, forall t in T

min f * sum_{t in T}{y_{t}} + h * sum_{t in T}{s_{t}}

# first period has no predecessor stock
constr s_{1} = x_{1} - d_{1}
# every later period carries stock forward from t-1
constr s_{t} = s_{t-1} + x_{t} - d_{t}, forall t in T setminus {1}
# producing in a period requires paying its setup
constr x_{t} <= M * y_{t}, forall t in T
end

import elytica

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