Poisson, Erlang and base-stock cost functions
DefinitionLostSalesRQ_poisson_functionsapproximation-guaranteeinventorylost-salesoperations-research
Deterministic functions of a lead-time demand mean used throughout the paper.
- Poisson mass , distribution function , upper tail and expected shortfall , where is Poisson with mean .
- For base stock : the loss fraction , the Erlang normalizer , the mean on-hand inventory , and the variance of the on-hand inventory , whose law is for .
- The zero-setup normalized cost of base stock and its minimum over integer levels,
- The intersection penalty of the cost lines of base stocks and .
- The integer lot and the batching surcharge .
These are the closed-form quantities that the selection algorithm computes and that the analytic comparisons manipulate.
Formalization Note is the real infimum over all ; the family is bounded below, so it is the true infimum (attained, by the paper's argument). Divisions are Lean's total divisions; for every is positive.
Definition code
import Mathlib.Analysis.SpecialFunctions.Exp
import Mathlib.Analysis.Real.Sqrt
import Mathlib.Data.Nat.Factorial.Basic
/-!
# Poisson, Erlang and base-stock functions
Deterministic functions of the lead-time demand mean `μ` used in
M. Hu, "A 1.932 Guarantee for (r,Q) Policies in Continuous-Review Lost-Sales
Inventory Systems" (Section 3.4, Appendix A, Section 4.6).
-/
namespace LostSalesRQ
open Finset
/-- Poisson probability mass `p_j(t) = e^{-t} t^j / j!`. -/
noncomputable def poisMass (t : ℝ) (j : ℕ) : ℝ :=
Real.exp (-t) * t ^ j / (Nat.factorial j : ℝ)
/-- Poisson distribution function `F_j(t) = ∑_{i=0}^{j} p_i(t)`. -/
noncomputable def poisCdf (t : ℝ) (j : ℕ) : ℝ :=
∑ i ∈ range (j + 1), poisMass t i
/-- Poisson upper tail `P(N(t) ≥ l) = 1 - ∑_{i<l} p_i(t)` (equal to `1` when `l = 0`). -/
noncomputable def poisTail (t : ℝ) (l : ℕ) : ℝ :=
1 - ∑ i ∈ range l, poisMass t i
/-- Expected shortfall `G_l(t) = E (l - N(t))^+ = ∑_{i=0}^{l} (l - i) p_i(t)`. -/
noncomputable def expectedShortfall (t : ℝ) (l : ℕ) : ℝ :=
∑ i ∈ range (l + 1), ((l : ℝ) - (i : ℝ)) * poisMass t i
/-- Loss fraction `e_j = p_j / F_j` of base stock `j` (Erlang loss probability) at lead-time
demand mean `μ`. -/
noncomputable def lossFraction (μ : ℝ) (j : ℕ) : ℝ :=
poisMass μ j / poisCdf μ j
/-- Erlang normalizer `A_j = F_j / p_j` (the reciprocal of `e_j`). -/
noncomputable def erlangNormalizer (μ : ℝ) (j : ℕ) : ℝ :=
poisCdf μ j / poisMass μ j
/-- Mean on-hand inventory of base stock `j`: `H_j = j - μ + μ e_j`. -/
noncomputable def meanOnHand (μ : ℝ) (j : ℕ) : ℝ :=
(j : ℝ) - μ + μ * lossFraction μ j
/-- Variance `v_j = Var(I_j)` of the stationary on-hand inventory `I_j` of base stock `j`,
where `P(I_j = l) = p_{j-l}(μ) / F_j(μ)` for `0 ≤ l ≤ j`. -/
noncomputable def onHandVariance (μ : ℝ) (j : ℕ) : ℝ :=
∑ l ∈ range (j + 1), ((l : ℝ) - meanOnHand μ j) ^ 2 * (poisMass μ (j - l) / poisCdf μ j)
/-- Normalized zero-setup cost of base stock `j`: `L_j(a) = H_j + a e_j`. -/
noncomputable def baseStockCost (μ a : ℝ) (j : ℕ) : ℝ :=
meanOnHand μ j + a * lossFraction μ j
/-- Minimum base-stock cost `U_μ(a) = min_{j ≥ 0} L_j(a)` (infimum over all integer levels). -/
noncomputable def minBaseStockCost (μ a : ℝ) : ℝ :=
⨅ j : ℕ, baseStockCost μ a j
/-- Intersection penalty `a_j = (e_j - e_{j+1})^{-1} - μ` of the cost lines of base stocks
`j` and `j + 1`. -/
noncomputable def intersectionPenalty (μ : ℝ) (j : ℕ) : ℝ :=
(lossFraction μ j - lossFraction μ (j + 1))⁻¹ - μ
/-- Integer lot size `Q_k = max{1, ⌊√(2k)⌋}`. -/
noncomputable def lotSize (k : ℝ) : ℕ :=
max 1 ⌊Real.sqrt (2 * k)⌋₊
/-- Batching surcharge `b_k = (Q_k - 1)/2 + k / Q_k`. -/
noncomputable def batchSurcharge (k : ℝ) : ℝ :=
((lotSize k : ℝ) - 1) / 2 + k / (lotSize k : ℝ)
end LostSalesRQ
Source
M. Hu, "A 1.932 Guarantee for (r,Q) Policies in Continuous-Review Lost-Sales Inventory Systems", arXiv:2610.34576, 2026; Section 3.4 (p. 8), Appendix A (pp. A1-A2), eq. (15) (p. 16), Section 4.6.1 (p. 21).