Multi-echelon lot sizing with constant demand: the two-level serial system and the -stage serial system of Sect. 9.2
DefinitionInventoryControl_serialThe deterministic multi-echelon lot-sizing models of Axsäter, Inventory Control, Sect. 9.2,
built on the chapter 4 cost function (eoqCost A d h Q).
Customer demand for the end item is constant and continuous, lead-times are zero, no
shortages are allowed, and batch quantities are constant over time.
Two levels (Sect. 9.2.1). Item 1 is the final product, made from one unit of item 2. With ordering costs , installation holding costs and echelon holding costs , , and with for a positive integer (Eq. 9.4), the total cost per time unit is (Eq. 9.6)
which is twoLevelCostInst d A1 A2 h1 h2 Q1 k, or equivalently in echelon form (Eq. 9.9)
which is twoLevelCost d A1 A2 e1 e2 Q1 k, literally eoqCost (A1 + A2/k) d (e1 + k e2) Q1.
The optimal cost for a given (Eq. 9.11) is twoLevelOptCost d A1 A2 e1 e2 k .
stages (Sect. 9.2.2). Installation produces item from one unit of item ; item 1 faces the final demand. With ordering costs and echelon holding costs , the cost of batch quantities is (Eq. 9.17)
which is serialCost A e d Q. SerialNested Q is the relaxed constraint (9.18),
; SerialPowerOfTwo Q is Roundy's constraint (9.16),
for nonnegative integers . potRound q Q is the integer nearest to ,
so that is the power-of-two multiple of within a factor of ; it is the
rounding step (9.22).
Formalization Note Stages are indexed by Fin N and "consecutive" means indices differing
by one; for both constraints are vacuous. No positivity is built into the
definitions; the theorems assume and positive batch quantities. Divisions by
and are Lean's total division, so or give junk values that every
statement excludes.
import Definitions.Def_InventoryControl_eoq
namespace InventoryControl
/-- Eq. (9.9): the two-level serial cost in echelon form, `k` being the ratio `Q₂ / Q₁`.
Definitionally `eoqCost (A₁ + A₂/k) d (e₁ + k e₂) Q₁`, cf. Eq. (9.14)-(9.15). -/
noncomputable def twoLevelCost (d A1 A2 e1 e2 Q1 k : ℝ) : ℝ :=
eoqCost (A1 + A2 / k) d (e1 + k * e2) Q1
/-- Eq. (9.6): the same cost written with installation holding costs `h₁, h₂`. -/
noncomputable def twoLevelCostInst (d A1 A2 h1 h2 Q1 k : ℝ) : ℝ :=
(h1 + (k - 1) * h2) * Q1 / 2 + (A1 + A2 / k) * d / Q1
/-- Eq. (9.11): the optimal two-level cost for a given ratio `k`. -/
noncomputable def twoLevelOptCost (d A1 A2 e1 e2 k : ℝ) : ℝ :=
Real.sqrt (2 * (A1 + A2 / k) * d * (e1 + k * e2))
/-- Eq. (9.17): the cost of a serial system with `N` stages, ordering costs `A`, echelon holding
costs `e`, final demand `d` and batch quantities `Q`. -/
noncomputable def serialCost {N : ℕ} (A e : Fin N → ℝ) (d : ℝ) (Q : Fin N → ℝ) : ℝ :=
∑ i, eoqCost (A i) d (e i) (Q i)
/-- Eq. (9.18): nested batch quantities, `Q_{i-1} ≤ Q_i`. -/
def SerialNested {N : ℕ} (Q : Fin N → ℝ) : Prop :=
∀ i j : Fin N, j.val = i.val + 1 → Q i ≤ Q j
/-- Eq. (9.16): each batch quantity is a nonnegative power of two times the previous one. -/
def SerialPowerOfTwo {N : ℕ} (Q : Fin N → ℝ) : Prop :=
∀ i j : Fin N, j.val = i.val + 1 → ∃ k : ℕ, Q j = (2 : ℝ) ^ k * Q i
/-- The rounding step (9.22): the exponent `m` with `2^m q` nearest to `Q` on the log₂ scale. -/
noncomputable def potRound (q Q : ℝ) : ℤ := ⌊Real.logb 2 (Q / q) + 1 / 2⌋
end InventoryControl