Skip to content

Chapter 6 — Inventory (MEIO, EOQ, K-curve)

6.1 — Chapter summary

⚙ Processes: the meio step (the multi-echelon inventory optimizer — sizing safety stock and reorder points per SKU; the zone pass runs inline inside it when enabled; the lt-distribution step feeds its lead-time inputs) and the eoq step (order sizing: Wilson/EOQ, the K-curve, or Wagner-Whitin per the inventory scenario's tag). Run: the ProcessRunner cards (each step standalone), or the full pipeline run (the API/CLI equivalents are in 6.D). Configured through the MEIO scenario (segment parameter sets + scenario param_overrides) and the inventory scenario (the EOQ branch).

Demand signal actuals ∓ forecast basis + indirect rates (netted or gross) → Lead-time distributions lane stats → receipts → route LT → scalar → Targets & budgets per segment + network group tgt_max clamps → V3 optimizer greedy marginal value (default — v3 /absent) → V4 rescue overlay one-hop lateral rescue ( meio_network_mode: 'v4' ) → Zone pass (optional — enable_zone_pass ; wraps either mode inline) → PIPE_meio_results + group + zone results safety_stock · rop · fill_rate

The one-sentence model: MEIO answers, per (item, site), how much safety stock buys which service level for the least money — a greedy loop that repeatedly commits the buffer step with the best fill-rate gain per dollar invested, under group targets, budgets, and per-SKU ceilings, with lead-time distributions deciding how much buffer the demand variability actually needs.

6.2 — Standard MEIO (V3): the model, with worked numbers

Service levels. The scenario's Service-level type (Pipelines → MEIO → open a scenario → Basic Info) decides which measure the optimizer drives to each group's target: Fill Rate (β), Line Fill Rate (βline), Stockout (α) or Asset Availability. The quickest way to see the difference is to score the same five orders on each of them.

The five orders

Order Asked Filled Short Served in full?
1 5 3 2 no
2 4 4 0 yes
3 40 39 1 no
4 4 3 1 no
5 10 10 0 yes
Total 63 59 4 2 of 5

Each measure below answers the same three questions: what it asks, what it gives on these five orders, and what the optimizer does with it. (Excel layout: A = order, B = asked, C = filled, D = short =B2-C2, rows 2–6.)

β — unit fill rate (Fill Rate (β), the default)

  • Asks: what share of the units did we deliver?
  • On the five orders: 59 ÷ 63 = 93.65%. It is volume-weighted: Order 3 is 63% of all the units, so its 39 of 40 dominates. Do not average the five per-order percentages (60, 100, 97.5, 75, 100 → 86.5%): that treats the 4-unit order like the 40-unit one.
  • In Excel: =SUM(C2:C6)/SUM(B2:B6)
  • The optimizer: predicts the same ratio for a given buffer — the share of the demand of a replenishment cycle that the buffer covers. Every order also covers demand while it runs, so a SKU that is ordered in batches (it has an order quantity) needs less buffer for the same β (table below).

βline — line fill rate (Line Fill Rate (βline))

  • Asks: what share of the order lines was delivered in full?
  • On the five orders: 2 ÷ 5 = 40% (Orders 2 and 5). Order 3 is 97.5% filled and still counts as a miss — a line served 39 of 40 is a missed line.
  • In Excel: =SUMPRODUCT(--(C2:C6>=B2:B6))/ROWS(B2:B6)
  • The optimizer: judges the buffer in whole order lines (the expected number of lines over the lead time, in steps of the average line size), so it asks for more stock than β on lumpy demand. It needs line-level history — lines per week and units per line, from the order layer (3.2). SKUs with no order history (warehouses, new items) are sized on β and marked as such in the results grid. It cannot be combined with the forecast demand basis.

α — stockout probability (Stockout (α))

  • Asks: how often does a stockout happen at all?
  • On the five orders: it counts events, not units — a shortage of 1 unit and a shortage of 100 count the same. Orders 1, 3 and 4 were short, so if each order stands for one replenishment cycle, 3 of 5 = 60% of the cycles stocked out. α is defined per replenishment cycle (the lead-time window between two replenishments) and the table has no cycle column, so the number depends on where you cut:
Orders grouped into cycles Cycles with a shortage α
each order is its own cycle 3 of 5 60%
{1} {2} {3, 4} {5} 2 of 4 50%
{1, 2, 3, 4, 5} 1 of 1 not a probability — you need many cycles (20 or more)
  • In Excel: =COUNTIF(D2:D6,">0")/ROWS(D2:D6)
  • The optimizer: checks the demand-over-lead-time curve at the buffer, P(demand over the lead time ≤ buffer), and ignores the order quantity. The target is entered as the chance of no stockout: 0.95 means "a stockout in at most 5% of the cycles".

Asset availability — spare pool for repairable parts (Asset Availability)

  • Asks: when a unit fails, is a spare on the shelf?
  • On the five orders: read each unit asked as one failure that needs one spare: 63 failures, 59 found a spare → 59 ÷ 63 = 93.65% measured availability. It is the same count as β, because every failure asks for exactly one unit. What differs is the prediction.
  • The optimizer: it does not use the demand-over-lead-time curve. A repairable spare is not consumed — it goes to repair and comes back — so the pool size comes from the Erlang-B formula: failures per week × weeks in repair = ρ units away on average, and availability = 1 − B(spares, ρ), the chance that all the spares are away when the next failure happens. Example: 2 failures a week, 3 weeks in repair → ρ = 6.
Spares in the pool 6 8 9 10 12 13 16
Availability 73.5% 87.8% 92.5% 95.7% 98.9% 99.5% 99.97%
  • In Excel: B0 = 1, then Bk = ρ*B(k-1)/(k+ρ*B(k-1)) down a column; availability = 1-B(s).
  • The target is for the whole asset. All the parts (LRUs) of an asset must be available together, so each part gets the geometric share: 99.5% over 10 parts → 0.995^(1/10) = 99.95% per part → 16 spares for the example above. A repair yield below 100% stretches the repair time (÷ yield). The fleet, failure rates and part list come from the causal scenario; the target (default 99.5%), the repair time (default 4 weeks) and the causal scenario are scenario settings — see the parameters reference.

The same demand, the same 95% target, three different buffers

A SKU with 5 units of demand a week and a 1-week lead time. The table gives the smallest buffer (reorder point) that reaches 95%, measured with the optimizer (for βline the same 5 units arrive as 2 order lines of 2.5 units):

Service-level type Smallest buffer reaching 95% Why
α 9 (96.8%) checks the demand curve at the buffer; no credit for the order quantity
β, no order quantity 9 (96.8%) with no order quantity, β reads the same curve as α
β, order quantity 5 7 (95.8%) each order also covers demand while it runs
βline 13 (98.3%) 5 whole lines × 2.5 = 12.5 — a line served 99% is still a miss

The optimizer searches in steps (a large order quantity makes coarse steps), so a stored reorder point can land a little above the smallest buffer. The order quantity effect is worked out in the EOQ example; the group metrics, budgets and ceilings that sit on top are described below.

The core arithmetic (the deterministic sizes the optimizer then improves):

safety stock:   SS = z(SL) x sigma_weekly x sqrt(LT_weeks)          (the classic quantile buffer)
reorder point:  ROP = lambda_weekly x LT_weeks + SS                               (cycle + safety)
example (real math, illustrative numbers):
   lambda = 50/wk   sigma = 20/wk   LT = 3 wk   SL = 95%  ->  z = 1.645
   SS  = 1.645 x 20 x sqrt(3)  ~=  57 units
   ROP = 50 x 3 + 57           =  207 units

The mechanics on a real SKU — the demo tenant, item 9102912 "the customer Standard Crate (Serviceable)" at site a tyre maker – Clermont-Ferrand (pipeline 4, scenario 43; a TRANSFER-replenished install base, the 5.7 circle's destination node):

Value Where it comes from
direct demand rate λ 526.5/wk the weekly demand signal (actuals basis here)
leg lead time 0.429 wk (3 days) the TRANSFER lane from the serving DC
wait time 0 the DC held stock in this run — no propagation delay (below)
safety stock 129.3 the optimizer's committed buffer for the group's FR target
ROP 355 355 = λ×LT 226 + SS 129.3 — verified on the stored row
achieved fill rate ↑ target the greedy commits in EOQ steps — the achieved FR lands at or above the segment target (0.95+ here)
ROP = lambda x (leg_LT + wait_time) + SS          (the cycle + the safety buffer)
     355  = 526.5 x 0.429 + 0  + 129.3  =  225.7 + 129.3   ✓ (the stored row)

The same calculation as an Excel remake — the planner's reconciliation sheet (one row per SKU; every input is a column, every result a formula):

Cell Content Excel formula / value Reconciles to
A: weekly demand the history rows (one column of weeks) paste from the series page or the demand export —
B1: λ (rate) average weekly demand =AVERAGE(A2:A53) direct_demand_rate 526.5
B2: σ (weekly) the demand variability =STDEV.S(A2:A53) ≈ 120 (derived below)
B3: LT (weeks) leg + wait 0.429 + 0 leg_lead_time 0.429, wait 0
B4: FR target the segment target 0.95 the MEIO group's fill_rate_target
B5: z the normal quantile of the target =NORM.S.INV(B4) → 1.645 —
B6: SS the safety stock =B5 * B2 * SQRT(B3) → 1.645 × 120 × 0.655 ≈ 129 safety_stock 129.3 ✓
B7: ROP the reorder point =B1 * B3 + B6 → 225.7 + 129.3 → 355 rop 355 ✓ (exact)

Reconcile note: the optimizer commits SS in EOQ steps under a budget/ceiling, so a stored row can land at or above the formula's SS — the formula is the floor the greedy improves on; when the row equals the formula (as here), the SKU was binding. The βline Excel remake: =POISSON.DIST(k, Λ, TRUE) walks the line CDF — find the smallest multiple of μ (the average line size) whose cumulative Poisson ≥ the target (the worked example: Λ = 2 lines, target 0.90 → k = 4 lines → buffer 4 × μ = 20).

How indirect demand is generated and used. Generation: the rollup (5.7) pushes each destination's demand upstream through its routes — the streams land as PIPE_indirect_demand rows (the customer circle: the tyre plants' demand becomes the DCs' good_replenishment; the soiling becomes the manufacturer's use_return; the collections become the DC's return_receipt). Use in MEIO: a warehouse node has NO direct demand rows (the forecast universe is actuals-based), so it enters the optimizer through its per-site indirect rate — the scenario's demand_scope decides what that rate is used for: 'direct' = the node is sized on its indirect rate alone (its own buffer against the rolled-up flow); 'total' = direct + indirect summed (σ combined as independent) AND the reward flips — the group metric weights it by the TOTAL rate so a pure warehouse earns a direct reward for the demand routed through it (the Rust total_demand_reward flag). The install-base move (3.5/5.7) keeps the sizing-preserving split: the IB portion counts as the serving site's direct demand.

The wait time — replenishment vs makes. The wait time is the expected delay a node imposes on whoever replenishes FROM it — its stock-out probability at its committed buffer times the resupply it needs — and it propagates: a downstream node's effective lead time is leg_LT + its source's wait_time. The concept — what the wait is, how it is computed, how the optimizer uses it to decide that a warehouse with no demand of its own still deserves stock — has its own page: Wait time.

Case How the wait is computed Real row (the demo tenant)
Replenishment · (BUY / TRANSFER) The source's own buffer covers its own demand; the wait it reports = the expected delay ABOVE the leg LT when IT is stocked out — added to the destination's leg LT (the a tyre maker row: the DC was stocked → wait 0, effective LT = 0.429) a tyre maker crate: leg 0.429 + wait 0 → effective 0.429 wk
Makes · (production / BOM) The finished good's wait = the component availability delay (its components' own stock-out delays, the assembly's expected idle time) — the FG cannot start until its parts are there, so the components' buffers become part of the FG's effective lead time "MEIO BOM FG (linked)" @ the Assembly Site: leg 2.0 (production LT) + wait 2.133 (the component delay) → ROP 209 = 20 × (2.0 + 2.133) + 126.3 ✓ — the wait sits INSIDE the FG's cycle

The two rows are real scenario-43 rows, verified arithmetically: ROP = λ×(leg+wait) + SS holds exactly on both (355 and 209). The downstream effect: any site replenished FROM the FG sees its wait in its own effective LT — the hierarchy the optimizer solves jointly (investing at the DC reduces every plant's ROP, not just the DC's fill rate).

The optimizer on top of the arithmetic: the greedy marginal-value loop (fill-rate gain per dollar), group target/budget completion (a budget-exhausted group freezes all its members; the demand-weighted __network__ aggregate group compensates across capped segments), the continuous tgt_max ceiling (min of sku_max_sl_qty/slices + LT), and the Phase-1 ASL floors. Zone-scenario runs swap the LT blend (the all-route blend) so warehouse nodes with no BUY/TRANSFER route get a real lead time.

Use Existing Inventory — the same two SKUs, with and without the setting

Ideally you would stock A (cheap: every dollar buys a lot of service) but you already hold B (expensive). The Use Existing Inventory toggle (Basic Info panel of the MEIO scenario) decides whether the optimizer plans around what you hold.

The setup. One group, β target 95%. Both SKUs sell 5 units a week with a 1-week lead time (cycle stock 5). A costs $10 and has nothing on hand; B costs $40 and has 9 on hand. Numbers measured with the optimizer:

A — $10, 0 on hand B — $40, 9 on hand Group fill rate Inventory value
Setting OFF ROP 10 · safety stock 5 · fill rate 98.6% · $100 ROP 8 · safety stock 3 · fill rate 93.2% · $320 95.9% $420
Setting ON ROP 8 · safety stock 3 · fill rate 93.2% · $80 ROP 14 · safety stock 9 · fill rate 99.98% · $560 96.6% $640
  • OFF — a clean sheet. The shelf is ignored and the optimizer buys service where it is cheapest: more of A, less of B. Compared with what you hold, A is 5 units short of its safety stock and B holds 6 units more than the 3 it needs.
  • ON — build on what you hold. B's stock is locked in as its safety stock before the optimization starts (reorder point = 9 held + 5 cycle stock = 14). Its 99.98% service counts toward the group, so A is allowed to fall to 93.2%. The group ends higher (96.6%) but costs $640 instead of $420, because the optimizer will not plan B below what you hold.

How much you hold changes the reaction (same two SKUs):

B on hand OFF ON
0 A 10 · B 8 → 95.9% · $420 identical — nothing to credit
3 same A 9 · B 8 → 95.0% · $410 — B's stock equals the safety stock it would get anyway, so it is simply credited
9 same A 8 · B 14 → 96.6% · $640
20 same A 8 · B 25 → 96.6% · $1,080

When the budget is tight — the stock you hold is paid for first

The group's budget (the segment's maximum budget) counts the value of every buffer the optimizer commits — the stock you already hold included. With the setting ON, the floor on B is committed first, before the optimizer looks at A, so B is paid for before A.

Same two SKUs, same 95% target — only the group's budget changes (B on hand 9):

Group budget OFF — fill rate · spend ON — reorder points · fill rate · spend
$1,000 95.9% · $420 A 8, B 14 · 96.6% · $640
$640 95.9% · $420 A 8, B 14 · 96.6% · $640 (just fits)
$600 95.9% · $420 A 4, B 14 · 80.8% · $600
$560 95.9% · $420 A 0, B 14 · 50.0% · $560
$500 95.9% · $420 A 0, B 12.5 · 49.9% · $500
$420 95.9% · $420 A 0, B 10.5 · 49.3% · $420

What happens step by step at a $500 budget with the setting ON:

  1. B's floor is committed first. B must hold what you have (9) plus its cycle stock (5) = 14 units = $560. Only \(500 is available, so the floor is cut to 12.5 units (\)500) — B's fill rate is 99.8%.
  2. The budget is gone and the group is far from its target. A is still at 0 (fill rate 0%), B at 99.8%, so the group stands at (0 + 99.8) ÷ 2 = 49.9%, against a 95% target. The group closes by budget.
  3. Every SKU of a group that closes by budget is frozen. A stays at 0. The cheapest service in the group (8 units for $80 take it from 0% to 93%) is never bought, because B's stock used the whole budget first.

With the setting OFF the same \(500 is plenty: A gets 10 units (\)100), B gets 8 ($320), the group reaches 95.9% for $420 and the budget never binds.

What to do. Give the group at least the cost of the floor plus what the other SKUs need ($640 in this example), or switch the setting OFF, or keep ON and make sure the segment's budget is sized on the stock you hold (a group that holds more than its budget can pay for will always close below target). The MEIO results show the symptom as an amber banner: N groups could not reach their fill-rate target due to budget constraints.

Where the on-hand figure comes from

The optimizer credits one on-hand figure per item (the item master's on hand), not the stock of each site — every site of the item receives the same floor. The ketteQ integration fills it with the usable stock summed over all sites. Where nothing fills it (today the demo tenant and the other non-ketteQ tenants hold zero on every item) the toggle changes nothing. The scenario toggle overrides any per-segment or per-item setting.

Use ON when the stock is sunk (it cannot be returned or redeployed) and you want the plan to build on it; use OFF to see the clean-sheet recommendation, for instance to spot surplus stock to redeploy.

Pipelines — MEIO tab: the MEIO scenario editor

Fig. 21 — Where MEIO is configured (the demo tenant): Pipelines → the MEIO tab — the MEIO scenarios (service-level type, demand basis, scope toggles, zone pass), the per-segment parameter sets (targets, budgets, per-SKU clamps), and the results grid. Captured 2026-11-10.

Dashboard — IO tab: the MEIO results view

Fig. 22 — Where MEIO is reviewed (the demo tenant): the Dashboard IO view — the per-SKU safety stock / reorder point results, fill rates, the segment and network-group progress, and the zone view (with the member tables when the zone pass ran). Captured 2026-11-10.

6.3 — Lateral support (V4 network mode) & the zone pass

⚙ Process: inside the meio step — V4 via the scenario's meio_network_mode: 'v4' (absent = byte-identical V3); the zone pass via enable_zone_pass (runs inline around either mode).

V4 lateral rescue — the concrete example

Two sibling locations stock the same item. Location A stocks out; location B holds surplus:

Location A (stocked out) Location B (has surplus)
Own demand rate 100/wk 100/wk
Own committed buffer 150 units 180 units
Own demand over LT 100 × 2 wk = 200 100 × 2 wk = 200
Free stock (buffer − own demand) −50 (stocked out) 180 − 200 = −20? — see the V3 vs V4 sizing below

Wait — location B's free stock is ALSO negative on its own demand. The V4 rescue only works when the sibling's buffer EXCEEDS its own demand-over-LT. Let me use the real numbers instead:

Location A
(the stocked-out node)
Location B
(the rescuer)
λ (own demand rate)50/wk50/wk
LT (replenishment lead time)2 wk2 wk
σ (weekly variability)1212
V3 standalone buffer
(z=1.645, β target 95%)
50×2 + 1.645×12×√2 = 100 + 28 = 128 same = 128
Own demand over LT100 units100 units
Free stock
(buffer − own demand over LT)
128 − 100 = 28 128 − 100 = 28
Demand correlation ρ
(A vs B, same item)
ρ = how often your rescuer is busy when you are — the Pearson correlation between the two locations' weekly demand for the SAME item over a 52-week window (shrunk n/(n+8); <12 overlapping weeks → ρ=0). ρ=0.7 here means both serve the same market: when A spikes, B spikes too (70% in sync) — so B's free stock is also being drained exactly when A needs it. See the availability table below.

Why ρ discounts the rescue: availability = FR_source × (1 − ρ) — the more correlated the two locations, the less the rescue is worth (the rescuer is likely also stressed):

ρ Meaning and rescue value
0 (independent) Meaning: B's demand is unrelated to A's spike.
Availability: 0.85 × 1.0 = 0.85.
Rescue value: B's full free stock is genuinely available.
0.7 (same market — our example) Meaning: B spikes 70% in sync with A.
Availability: 0.85 × 0.3 = 0.255.
Rescue value: only a quarter of B's free stock is reliably available; the rest is consumed by B's own spike.
1.0 (perfectly synced) Meaning: B spikes exactly when A does.
Availability: 0.85 × 0 = 0.
Rescue value: nothing; B is stocked out too and the rescue is an illusion.

What V4 changes: location A's effective horizon is no longer just its own 2-week LT — it can be rescued by B during its stockout, so the rescue window extends A's coverage. The destination's effective horizon blends: (1−r) × (leg + base_wait) + r × τ_rescue — the fraction r of A's stockout that B can cover arrives via the rescue lane's LT, not A's own replenishment. The rescue credit:

rescue_credit = allocated_free_stock x reliability x P(arrival <= horizon) x availability
where availability = FR_source x (1 - rho)  — the rescuer's own surplus probability, discounted by correlation
      = 0.85 x (1 - 0.7) = 0.255
A's V4 buffer = V3 128 - rescue_credit (the rescue lets A run leaner)
             = 128 - (28 x 1.0 x 0.8 x 0.255) ~= 128 - 6 ~= 122
B's V4 buffer = V3 128 (unchanged — the rescuer keeps its own buffer;
                                 V4 never sacrifices the source's own service)
V3 (no rescue) V4 (one-hop rescue) Delta
Location A buffer 128 ≈122 −6 (≈5% leaner — the rescue's discounted credit)
Location B buffer 128 128 0 (source-conserving: B never goes below its own V3 buffer)
Combined inventory 256 ≈250 −6 — the collaboration's real saving

V3 mode is the byte-identical baseline (no rescue credit, no correlation wiring). Stale-extension guards abort loudly if the rebuilt Rust module is missing the V4 wire fields. Route classification (master.route.network_role: rescue / standard / emergency / disabled) decides what counts as a rescue lane — cross-zone lanes are never rescue by default. Timed repair replaces the legacy repair netting (capacity-capped, yield-adjusted, accrued over the repair cycle; facility pools allocated per push_quota).

The zone pass — the concrete example (the demo tenant zone THAILANDE, real numbers)

Zone THAILANDE pools 3 member locations for the same item. The pooled envelope is smaller than the sum of the standalone buffers (the risk-pooling credit):

Member 1
(Bangkok)
Member 2
(Chonburi)
Member 3
(Rayong)
The zone
λ (demand rate)2,000/wk1,500/wk1,356/wk Σ 4,856/wk
σ (weekly)350280250 σ∥ = √(350²+280²+250²) = √245,600 ≈ 496
Zone LT (lane blend)cross-zone + supplier + repair regeneration → 17.98 wk17.98 wk
Standalone SS
(each alone: z·σ·√LT)
1.645×350×√17.98 = 2,433 1.645×280×√17.98 = 1,947 1.645×250×√17.98 = 1,738 if independent: Σ 6,118
Zone pooled SS
(one buffer: z·σ∥·√LT)
1.645 × 496 × √17.98 = 3,460 3,460
(−44% vs 6,118 = the pooling credit)
Split share
(λ·LT weight)
2,000/4,856 = 41%1,500/4,856 = 31%1,356/4,856 = 28% Σ = 100% ✓
Member pinned SS
(share × zone SS)
0.41 × 3,460 = 1,419 0.31 × 3,460 = 1,072 0.28 × 3,460 = 969 Σ 3,460 = zone SS ✓

The split weights are proportional to λₓ × LTₓ (each member's demand over its channel-blend lead time — the physical need each location actually sees). Σ member SS = zone SS by construction (the split caps pin every member at its share; a stricter member-level sku_max_sl_qty below the share wins with a loud WARNING — Σ then falls below the zone envelope, visible as cap_utilization < 100%). The alternative mode — require_member_target — opts the zone into per-member delivered-fill targets instead (each member reaches the zone's FR on ITS OWN blend, knowingly giving up the pooling credit; Σ may exceed the envelope).

6.4 — The distributions: empirical vs fitted, and the lead-time tier chain

⚙ Process: built inside the MEIO step (Processes → MEIO card → ▶ Run) and switched on per scenario in the MEIO scenario editor → Advanced → Empirical distributions. The full explanation, with a worked case for plenty of history, little history and too little, is the reference page Empirical demand distribution.

The two demand-side approaches, with a worked example

Same SKU — an intermittent item, 12 weeks of history, LT = 2 weeks, FR target 95%:

Week W1 W2 W3 W4 W5 W6 W7 W8 W9 W10 W11 W12
Demand 0 5 0 0 20 0 0 0 15 0 0 10

Path A — the golden formula (fitted / normal assumption)

mean = 50/12 = 4.17/wk      sigma = STDEV.S(history) = 7.0
SS = z x sigma x sqrt(LT) = 1.645 x 7.0 x sqrt(2) = 16.3 units
ROP = 4.17 x 2 + 16.3 = 24.7 units

The formula assumes the demand is normal and weeks are independent. On this lumpy series, the normal's symmetric bell doesn't match the real shape — the actual distribution has a spike at zero and a fat right tail.

This is the textbook formula, shown for comparison

A SKU without an empirical list is sized by the optimizer on a Poisson distribution by default (ROP 13 for this series), or — for an item with more than 25 demand streams, in practice never — on this same Normal formula (since 2 December 2026; it used to use a different spread). See the reference page for the whole ladder, with the same example growing from 2 to 12 weeks of history.

Path B — the empirical distribution (what runs when there is history)

Step 1 — build the demand-over-LT samples. One window per demand row: the demand between the row's date and the date it was received. Here the lead time is 2 weeks, so each window is a week plus the next; the last window holds only W12 because the history ends:

Window W1-2 W2-3 W3-4 W4-5 W5-6 W6-7 W7-8 W8-9 W9-10 W10-11 W11-12 W12
Sum 5 5 0 20 20 0 0 15 15 0 10 10
sorted: [0, 0, 0, 0, 5, 5, 10, 10, 15, 15, 20, 20]
mean = 8.33      the 95 % point is 20, the largest value
ROP_empirical = 20 units   (the first whole buffer whose fill rate reaches 95 %)
SS_empirical  = ROP - mean = 20 - 8.33 = 11.7 units

The empirical buffer is lower than the textbook one (ROP 20 against 24.7) because it follows the real shape. With only 12 windows the list also ends at 20, so the buffer can never exceed the largest value seen: treat such a result as a floor, not a promise (the reference page shows how fast this improves with history).

The convolution — for SKUs with only 3 to 9 windows

A list of fewer than 10 windows cannot see beyond its own largest value, so such a SKU is sized differently: the optimizer combines the weeks of demand with the lead times actually observed. Each Monte-Carlo trial draws a lead time (here always 2 weeks), then adds that many weekly demand values drawn at random from the history; after 5,000 trials the sorted totals form the list. On the first 8 weeks of the series above (0 5 0 0 20 0 0 0) a trial might draw 5 and 20 (= 25), or 0 and 0 (= 0). A lead time that is not a whole number of weeks is pro-rated, and the draws are seeded per SKU so a rerun gives the same list. The setting is empirical_min_windows (default 10; 3 restores the previous behaviour) and the per-scenario switch Few-order convolution. SKUs with 10 or more windows (such as the 12-window example above) are not affected; in their case the lead-time variability is already inside the list, because every window spans its own order's real lead time.

When to use which — the requirements and the honest limitations

The golden formula The empirical list
Minimum data required σ + λ + LT (any length — even 4 weeks) 3 windows is the hard minimum (fewer → the classical formula, silently). From 3 to 9 windows the weekly × lead-time convolution is used; 10 or more read the list; 30 or more is comfortable
Lead-time source A scalar LT is enough Not needed: each window spans the order's own received date. The lead-time tier chain below feeds the lead-time evidence and the Normal formula's lead-time term, not the list
Demand shape Works when demand is smooth and roughly normal — and that's when it's just as good Worth it when demand is intermittent, lumpy, seasonal with gaps, or has fat right tails — if the demand is smooth/normal, both paths give the same answer
Stationarity The formula can adapt (a recent σ window) Breaks on non-stationary demand — the samples assume the pattern repeats; a trend or a regime change means the empirical trains on the wrong pattern
Cost Trivial (one formula) Light: one pass over the order rows (Rust, parallel) and a table read per fill-rate evaluation — no simulation
Worth it for… C-class items, new items, short histories, smooth demand A-class and B-class items with real order history and a received date on each row

Under the forecast demand basis the σ chain swaps: temporal forecast σ primary, PI-noise fallback, zero + loud WARNING last. When σ is temporal the weekly forecast path itself becomes the list (it is not scaled to the lead time — open point 5 of the reference page); otherwise the list is dropped and the SKU is sized classically.

Lead-time side — the tier chain (highest priority first; the scenario's lane stats are exclusive when a lead-time scenario is active):

Tier Source
0 The lead-time step's lane statistics (PIPE_route_lt_stats sample blobs, pooled coverage-weighted per SKU — legacy tiers skipped entirely when the scenario is active)
1 The receipt history table (MASTER_supply_orders_hist — closed replenishment orders, volume-weighted by received qty)
2 PIPE_lead_time_actuals (observed arrival lead times)
3 Synthesized from master.route (lognormal, planned LT + lead_time_cv)
4 The V2 scalar fallback (config lt_stddev)

Persisted per SKU on PIPE_lead_time_stats with its lt_source provenance (the receipts tier's UI label unchanged). These statistics feed the lead-time evidence of the series IO tab and the lead-time term of the Normal formula; the empirical list does not read them, because every window already spans the lead time its order really had.

6.5 — Scope: demand basis, demand scope, universe, exclusions

The scenario keys that change WHAT the optimizer sizes: demand_basis (actuals | forecast — forecast-only new items join the universe via the same injection as WH nodes; demand_basis_direct gross|netted), demand_scope (direct | total — with the reward flip so pure-WH nodes earn a direct reward), universe_segment_ids (restrict the pass-2 run to listed segments), the install-base served sizing (a site serving IB destinations sizes on the GROSS served stream — MEIO-only, never the supply solve), and the exclusions view (unroutable SKUs dropped loudly; the wash-depot LT via the repair-cycle CTE).

Consumers of the outputs (verified against the code):

Consumer What it reads
Supply engines (MRP + LP) The safety_stock floor — the single documented column the engines consume (_load_sku_plans ×5; the LP's hard safety_stock_constraint from the fill week, with the two-step infeasibility ladder)
Exceptions (5 × readers) The IO data for inventory exceptions; the coverage/recency checks
Alerts (3 readers) Fill-rate and buffer alert rules over the results
API surfaces The IO views (aggregate_io, meio_diagnostic, meio_fr_heatmap, the overview map, supply bars, the MC distribution viewer), the series IO tab's per-SKU evidence (σ badge, SS ≈ z·σ·√LT with the counterfactuals), the K-curve EOQ items, sparklines
Replay The fill maps + demand-required dates for the replay's fill-rate computation
Auto-approval The target service level resolved from the group results (the SL-recovery guard's target source)
Zone rebalancing The zone SS levels (the rebalance loader)
Mirabelle / freeze / approval gate The "service level / fill rate / safety stock / wait time" query family; the archived snapshots; the result-approval baseline family

6.6c — Wagner-Whitin (the dynamic lot-sizing schedule)

⚙ Process: the same eoq step, branched when the inventory scenario's tag is wagner_whitin (kcurve/wagner_whitin.py — the O(T²) dynamic-programming algorithm).

The question it answers: given a KNOWN, TIME-VARYING demand schedule (not a constant rate), which weeks should I place an order, and how big should each order be, so total ordering + holding cost is exactly minimized?

The setup — 8 weeks of known demand, order cost S = 100, holding cost h = 1/unit/week:

Week W1 W2 W3 W4 W5 W6 W7 W8
Demand 50 0 30 0 0 80 0 20

The physical question: each demand unit must be in stock by its week. If it arrives earlier (via a bigger order placed earlier), it costs holding: 1 unit held for 1 extra week costs h=1. Placing an order costs S=100 flat, regardless of size.

How the algorithm works — the step-by-step DP table

The algorithm walks forward, week by week. At each week t it asks: "What is the CHEAPEST way to cover all demand from week 1 through week t?" — and it tries every possible placement of the last order:

Cover through
week t
Cost if the LAST order is placed in week j
f(t) = f(j-1) + S + holding(j→t)
f(t)
the best
Last order
at week
j=1j=2j=3j=4j=5j=6j=7j=8
t=1 0+100+0=100 — 100W1
t=2 0+100+0=100 100+100+0=200 — 100W1
t=3 0+100+60=160 100+100+30=230 100+100+0=200 — 160W1
t=4 0+100+60+0=160 100+100+30+0=230 100+100+0+0=200 160+100+0=260 — 160W1
t=5 0+100+60+0+0=160 100+100+30+0+0=230 100+100+0+0+0=200 160+100+0=260 160+100+0=260 — 160W1
t=6 0+100+460=560 100+100+350=550 100+100+240=440 160+100+160=420 160+100+80=340 160+100+0=260 — 260W6
t=7 0+100+460+0=560 100+100+350+0=550 100+100+240+0=440 160+100+160+0=420 160+100+80+0=340 160+100+0+0=260 260+100+0=360 — 260W6
t=8 0+100+600=700 100+100+490=690 100+100+340=540 160+100+260=520 160+100+180=440 160+100+40=300 260+100+20=380 260+100+0=360 300W6

Reading the table — what each cell means:

Cell The question it answers W1 through W3, order placed at W1 (j=1)
f(j-1) What did it cost to cover everything BEFORE week j? f(0) = 0 (nothing before W1)
+ S What does placing THIS order cost? + 100 (the setup cost)
+ holding(j→t) What does it cost to CARRY inventory from week j to each future week it covers? + 50×0 (W1 arrives, used immediately) + 0×1 (W2 has no demand) + 30×2 (W3's demand carried 2 weeks) = 0 + 0 + 60
= the cell The total cost of this particular plan 0 + 100 + 60 = 160

The optimal schedule — reading the "Last order" column backward from t=8:

StepWhat the DP foundWhy
t=8Last order at W6, cost 300 Ordering in W6 to cover W6+W8 is cheaper than extending the W1 order all the way (holding 80 units for 5 weeks costs 400 — a second order at 100 saves money)
t=5Before W6, the last order was at W1, cost 160 One order in W1 covering W1-W3 (80 units) — W3's 30 units carried 2 weeks costs 60, cheaper than a second order (100)
Final schedule: 2 orders — W1 (80 units) and W6 (100 units), total cost 300

The three plans compared:

Schedule Orders Ordering cost Holding cost Total
Order every demand week 4 (W1, W3, W6, W8) 400 0 400
One big order (W1) 1 100 600 700
Wagner-Whitin optimum 2 (W1, W6) 200 100 300

The DP guarantees this is the exactly optimal schedule — not a heuristic, not an approximation. The O(T²) means 52 weeks ← 2,704 candidate cells, computed in microseconds.

The eoq write-back: the per-item master.item.eoq is the annualized average order quantity — orders_per_year = n_orders × 52 / periods, eoq = annual_demand / orders_per_year — so MEIO and the supply engines see a single number even from the dynamic schedule. The the demo tenant pipelines Wagner-Whitin High OC, Wagner-Whitin Standard Lab etc. are named lab scenarios over this branch (the different OC values exercise the order-cost sensitivity).

6.D — For developers — the inventory step APIs

The UI paths above cover the planner's loop; the equivalents for scripts and add-ons:

Call Purpose
POST /api/pipeline/run/meio \| /lt-distribution \| /eoq {"pipeline_id": N} Run the three steps standalone (CLI: python files/run_pipeline.py --only <step> --pipeline-id N).
The scenario editors' save paths The MEIO scenario's param_overrides / segment parameter-set links and the inventory scenario's tag (which selects the EOQ branch) — written by the Pipelines tabs you see above.

6.T — Step-by-step test walkthrough

Inventory optimisation, verified end to end.

# Where to look / what to click You should see
1 Pipelines → MEIO tab → open a scenario editor service-level type + target, zone pass toggle, demand basis/scope — all auto-saved
2 Processes → MEIO card → Run per-SKU buffers computed; results land in the IO tables
3 Dashboard → IO tab per-SKU safety stock / ROP / fill rate; the segment + network group progress
4 IO view → zone view (if the zone pass ran) per-zone envelope, member tables, LT blends, σ-safety column
5 Pick one SKU → reconcile in Excel SS = z·σ·√LT (+λ·LT) reproduces the stored row (6.2's worked example)
6 K-curve page the exchange curve; snap an operating point; the EOQ items update
7 Processes → run the eoq step master.item.eoq updated — verify in the Items grid
8 Pick a direct-demand SKU → IO tab → Safety Stock ↔ Fill Rate — Evidence, block C μ · σ · n above the chart, n = the windows of its empirical list (30 or more is comfortable); a warehouse with no order rows shows No empirical demand-over-LT distribution (it runs on the classical formula)

MEIO scenario editor

Where MEIO is configured: service level, zone pass, basis/scope, per-segment sets.

Dashboard IO view

Where MEIO is reviewed: per-SKU results, groups, zone view.