Lot Sizing Optimization
Wagner-Whitin / Silver-Meal — Dynamic Programming
A production planner must decide in which periods to produce and how many units per batch, trading off fixed setup costs ($2,500 per run) against holding costs ($45/unit/period). Over a 52-week horizon, poor lot sizing wastes 8–15% of total production cost.
Where This Decision Fits
Manufacturing planning chain — the highlighted step is what this page optimizes
The Problem
Minimizing total setup and holding cost over a finite horizon
Consider a single product over a 10-period planning horizon. Each period t has a known demand dt that must be satisfied (no backlogging). The manufacturer incurs a fixed setup cost K = $2,500 each time a production run is initiated, plus a holding cost h = $45 per unit per period for any inventory carried from one period to the next.
The decision is: in which periods should we produce, and how much? Producing every period avoids holding cost but incurs 10 setup costs ($25,000). Producing everything in period 1 requires only one setup ($2,500) but maximizes holding cost. The optimal policy balances these two opposing forces.
This is the classic uncapacitated lot-sizing problem, solvable exactly by the Wagner-Whitin algorithm (1958) using dynamic programming in O(n²) time, exploiting the zero-inventory ordering property: an optimal policy only produces when starting inventory is zero.
subject to
It = It-1 + xt − dt // inventory balance
xt ≤ M · yt // production only if setup (yt ∈ {0,1})
It ≥ 0 // no backlogging
I0 = 0 // initial inventory
// DP recurrence: f(t) = min over j≤t { f(j-1) + K + h · Σk=j..t-1 (t-k) · dk }
Where yt is the binary setup indicator, xt is production quantity, It is ending inventory, and dt is the demand in period t.
Try It Yourself
Optimize a 10-period lot sizing schedule
Lot Sizing Optimizer
K=$2,500 · h=$45/unit/periodReady. Click “Solve & Compare All Algorithms” to run.
| Algorithm | Setups | Setup Cost | Holding Cost | Total |
|---|---|---|---|---|
| Click Solve & Compare All Algorithms | ||||
The Algorithms
Three approaches to dynamic lot sizing
Wagner-Whitin (Dynamic Programming)
O(n²) | Guarantees global optimumThe Wagner-Whitin algorithm exploits the zero-inventory ordering property: in an optimal solution, production only occurs when beginning inventory is zero. This reduces the search space from exponential to O(n²). For each period t, it considers all possible last-production periods j ≤ t and picks the one minimizing cumulative cost. The DP recurrence builds the optimal solution forward, and backtracking recovers the production schedule. This is the gold standard for uncapacitated single-item lot sizing.
Silver-Meal
O(n) | Greedy cost-per-period minimizerThe Silver-Meal heuristic adds periods to the current production lot as long as the average cost per period (setup cost amortized plus accumulated holding cost) is decreasing. Once adding the next period would increase the average, the lot is closed and a new lot begins. This forward-looking greedy strategy typically achieves within 1–3% of optimal for smooth demand patterns but can deviate more significantly with lumpy or highly variable demand.
Lot-for-Lot
O(n) | Zero inventory, maximum setupsThe simplest policy: produce exactly the demand for each period, every period. This eliminates all holding cost but incurs a setup cost in every period with nonzero demand. Lot-for-Lot serves as an upper bound on setup cost and a lower bound on holding cost, making it a useful baseline for comparison. It is optimal only when holding cost is so high that carrying any inventory is more expensive than an additional setup.
Real-World Complexity
Why production lot sizing goes beyond a simple DP
Beyond the Basic Model
- Capacity constraints — Production capacity limits per period make the problem NP-hard; requires Lagrangian relaxation or MIP solvers
- Multiple products — Shared setups, joint replenishment, and resource contention across product families add combinatorial complexity
- Stochastic demand — Uncertain demand requires safety stock calculations and robust or stochastic programming formulations
- Setup carry-over — If the same product was produced last period, setup may be avoided (sequence-dependent setups)
- Quantity discounts — Volume-based pricing from suppliers creates nonlinear cost structures that break DP optimality
- Perishability — Shelf-life constraints limit how far ahead production can cover future demand
- Multi-level BOM — Component dependencies in multi-echelon production (MRP) couple lot-sizing decisions across levels
Key References
Foundational works in lot sizing optimization
- (1958). “Dynamic version of the economic lot size model.” Management Science, 5(1), 89–96.
- (1973). “A heuristic for selecting lot size quantities for the case of a deterministic time-varying demand rate and discrete opportunities for replenishment.” Production and Inventory Management, 14(2), 64–74.
- (2006). “Production Planning by Mixed Integer Programming.” Springer Series in Operations Research and Financial Engineering.
Need to optimize production planning?
From single-item lot sizing to multi-product, multi-level production scheduling, mathematical modeling can transform manufacturing operations. Let’s discuss how Operations Research can work for you.