Inventory & Lot Sizing
Classical and modern inventory management models covering economic order quantities, dynamic lot sizing, multi-echelon systems, and safety stock optimization. These foundational models underpin modern inventory management, production planning, and ERP systems.
EOQ → Dynamic Lot Sizing → Capacitated Lot Sizing → Multi-Echelon → Safety Stock → Vehicle Loading
View on GitHubProblem Collection
Six inventory, production planning, and logistics models
Economic Order Quantity
The foundational inventory model determining the optimal order quantity that minimizes total holding and ordering costs. Includes extensions for planned backorders (allowing stockouts with a penalty cost) and quantity discounts (all-units and incremental).
Q* = √(2DK / h) TC(Q) = DK/Q + hQ/2
EOQ with Backorders (shortage cost b per unit/yr):
Q* = √(2DK/h) · √((h+b)/b) S* = Q*·b/(h+b)
TC = DK/Q + h(Q−S)²/(2Q) + bS²/(2Q)
Quantity Discounts (all-units price breaks):
Evaluate Q* at each price tier; select tier with lowest TC(Q) = Dc + DK/Q + hQ/2
D = annual demand, K = order cost, h = holding cost/unit/yr, b = backorder cost/unit/yr, c = unit price
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| EOQ Formula | Exact | O(1) | Classic closed-form with backorder & discount extensions — Harris (1913) |
Dynamic Lot Sizing
Determine production/order quantities over a finite planning horizon with time-varying demand. Wagner-Whitin provides the optimal DP solution; Silver-Meal and Part Period Balancing offer fast heuristic alternatives for large-scale instances.
f(t) = min_{1 ≤ s ≤ t} { f(s-1) + K + h · ∑_{k=s}^{t} (k-s) · d_k }
Zero-inventory property: it is optimal to order only when inventory reaches zero
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| Wagner-Whitin DP | Exact | O(T²) | Optimal forward DP exploiting zero-inventory ordering — Wagner & Whitin (1958) |
| Silver-Meal | Heuristic | O(T²) | Minimize average cost per period; performs well on smooth demand — Silver & Meal (1973) |
| Part Period Balancing | Heuristic | O(T²) | Order until cumulative holding cost ≈ setup cost — DeMatteis (1968) |
Capacitated Lot Sizing
Extension of dynamic lot sizing with production capacity constraints per period. The capacity constraint makes the problem NP-hard (Bitran & Yanasse, 1982), requiring heuristic approaches. Models realistic manufacturing settings where production resources are limited.
s.t. I_{t-1} + x_t = d_t + I_t ∀t
x_t ≤ C_t · y_t ∀t
x_t, I_t ≥ 0, y_t ∈ {0,1}
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| MIP Solver (HiGHS) | Exact | NP-hard | Standard ILP formulation via SciPy HiGHS — Pochet & Wolsey (2006) |
| Greedy Lookahead | Heuristic | O(T²) | Forward pass consolidating future demand up to capacity — Pochet & Wolsey (2006) |
| Lot-for-Lot + Forward Greedy | Heuristic | O(T²) | Baseline lot-for-lot with greedy capacity-aware merging — Maes & Van Wassenhove (1988) |
Multi-Echelon Inventory
Inventory management across multiple levels of a supply chain (e.g., warehouse to distribution center to retail). Optimizes base-stock levels considering lead times, demand variability, and inter-echelon dependencies for system-wide cost minimization.
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| Echelon Base Stock | Exact* | O(L) | Optimal for serial systems with backlogging — Clark & Scarf (1960) |
| Greedy Allocation | Heuristic | O(L²) | Marginal cost allocation across echelons — Roundy (1985) |
*Echelon base-stock is optimal for serial systems (Clark & Scarf, 1960); treated as heuristic for general distribution networks.
View Source CodeSafety Stock Optimization
Determine optimal safety stock levels to buffer against demand uncertainty while meeting target service levels. Supports continuous review (Q, R) and periodic review (s, S) policies with normal demand distributions.
SS = z_α · σ_D · √L
Assumes: normally distributed demand per period, constant lead time L. z_α = Φ¹(α) where α is the target CSL. Fill rate requires the standard normal loss function L(z), not this formula.
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| Analytical Safety Stock | Analytical | O(1) | Closed-form normal-approximation for cycle service level targets |
Vehicle / Container Loading
Pack items with both weight and volume constraints into vehicles with limited weight and volume capacities, minimizing the number of vehicles used. Generalizes 1D bin packing to two resource dimensions.
| Algorithm | Type | Complexity | Details |
|---|---|---|---|
| First-Fit Decreasing (FFD) | Heuristic | O(n²) | Sort by weight descending, first-fit placement — Johnson (1973) |
Algorithm Overview
Method distribution across the inventory & lot sizing family
| Problem | Exact / Analytical | Heuristic |
|---|---|---|
| EOQ | EOQ Formula | — |
| Dynamic Lot Sizing | Wagner-Whitin DP | Silver-Meal PPB |
| Capacitated Lot Sizing | MIP | Greedy Lookahead Lot-for-Lot |
| Multi-Echelon | Base Stock* | Greedy Alloc. |
| Safety Stock | Analytical | — |
| Vehicle Loading | — | FFD |
Try It Yourself
Interactive EOQ solver with cost curve visualization
EOQ Solver
Lot Sizing Solver
Enter period-by-period demands to compare Wagner-Whitin (optimal DP), Silver-Meal, and Part Period Balancing side by side.
Benchmark Instances
Standard test instances used across the family
| Problem | Instance | Size | Source |
|---|---|---|---|
| EOQ | Classic / Backorder / Discount | Analytical (closed-form) | Harris (1913), textbook standard |
| Dynamic Lot Sizing | Wagner-Whitin 4-period / 6-period / 10-period | T = 4–10 | Wagner & Whitin (1958) |
| CLSP | tight_6 / loose_4 / variable_8 | T = 4–8 | Trigeiro et al. (1989) style |
| Multi-Echelon | 2-echelon serial / 3-echelon distribution | L = 2–4 stages | Clark & Scarf (1960) style |
| Safety Stock | Normal demand / CSL targets | Analytical | Silver, Pyke & Peterson (1998) |
| Vehicle Loading | 2D weight+volume instances | n = 10–20 items | Christensen et al. (2017) style |