Let \(\alpha\) represent the probability that a replenishment cycle passes with no stockout.
\[ \begin{aligned} \alpha &= P\{\text{no stockout in a cycle}\} &&\text{definition}\\ &= P\{D(L) \le r\} &&\text{by (k), on hand is } r \text{ when } r \text{ is reached}\\ &= G(r), \qquad r = \min\{r : G(r) \ge \alpha\} &&\text{discrete rule} \end{aligned} \]
Notice that \(Q\) does not appear. Type 1 fixes \(r\) by itself, which is why it is the target most often met by hand.
That independence is also its defect. It counts the cycles in which a shortage occurred and says nothing about how large it was: a cycle short by one unit and a cycle short by forty count alike. An item ordered in large batches has far fewer cycles in which to fail, and gets the same \(r\).
For example, at \(\alpha = 0.95\) the transformer needs \(G(r) \ge 0.95\): \(G(11) = 0.9208\) falls short and \(G(12) = 0.9573\) clears it, so \(r = 12\).
Let \(\beta\) represent the fraction of demand filled from the shelf. Each cycle satisfies \(Q\) units of demand and falls short by \(G^{1}(r)\) units on average:
\[ \begin{aligned} \beta &= \frac{\text{ordered in a cycle} - \text{expected short in a cycle}} {\text{ordered in a cycle}} &&\text{units, not occasions}\\ &= \frac{Q - G^{1}(r)}{Q} = 1 - \frac{G^{1}(r)}{Q} &&\text{shortage per cycle is } G^{1}(r)\\ G^{1}(r) &\le Q(1 - \beta) &&\text{the condition on } r \end{aligned} \]
Notice that \(Q\) is present, and that the measure counts units, which is what an organization that ships to customers cares about. It is the exact ready rate with the far tail \(G^{1}(r+Q)\) dropped, so it carries assumption (i) with it.
At \(\beta = 0.95\) and \(Q = 5\), the transformer needs \(G^{1}(r) \le 0.05(5) = 0.25\). \(G^{1}(10) = 0.2993\) and \(G^{1}(11) = 0.1616\), so \(r = 11\).
Both targets were set to 0.95 on the transformer at \(Q = 5\), and they differ by a transformer. The policy set to a 95% cycle service level: what fill rate does it actually deliver?
| Target | \(r\) | Safety stock | Holding cost of it | Exact fill rate | Exact cycle service |
|---|---|---|---|---|---|
| Type 1, \(\alpha = 0.95\) | 12 | 4.5 units | $4,275 a year | 0.9838 | 0.9573 |
| Type 2, \(\beta = 0.95\) | 11 | 3.5 units | $3,325 a year | 0.9683 | 0.9208 |
The 95% cycle service policy fills 98.4% of demand; the 95% fill rate policy runs a cycle service level of 92.1%. The two disagree by several points, in both directions, on the same item.
An organization reporting “95% service” without saying which has reported almost nothing. Ask which measure a target refers to before acting on it.
Setting \(Q\) to the EOQ and then choosing \(r\) is a convenience, not an answer:
\[ \min_{r, Q} \; k\frac{\lambda}{Q} + h\left(\frac{Q}{2} + r - \theta\right) \quad \text{subject to} \quad 1 - \frac{G^{1}(r)}{Q} \ge \beta \]
| \(Q\) | \(Q(1-\beta)\) | \(r\) | Ordering | Holding | Total |
|---|---|---|---|---|---|
| 4 | 0.20 | 11 | $2,475.00 | $5,225.00 | $7,700.00 |
| 5 | 0.25 | 11 | $1,980.00 | $5,700.00 | $7,680.00 |
| 6 | 0.30 | 10 | $1,650.00 | $5,225.00 | $6,875.00 |
| 7 | 0.35 | 10 | $1,414.29 | $5,700.00 | $7,114.29 |
| 8 | 0.40 | 10 | $1,237.50 | $6,175.00 | $7,412.50 |
| 9 | 0.45 | 10 | $1,100.00 | $6,650.00 | $7,750.00 |
| 10 | 0.50 | 10 | $990.00 | $7,125.00 | $8,115.00 |
| 11 | 0.55 | 9 | $900.00 | $6,650.00 | $7,550.00 |
| 12 | 0.60 | 9 | $825.00 | $7,125.00 | $7,950.00 |
For fixed \(Q\) the best \(r\) is the smallest feasible one. Finding \(Q\) needs a full search.
Notice that the total is not unimodal. It falls to $6,875 at \(Q = 6\), rises to $8,115 at \(Q = 10\), and falls again at \(Q = 11\), where the constraint slackens enough for \(r\) to drop a whole unit and save \(h\) at a stroke.
The EOQ shortcut gives \((11, 5)\) at $7,680; the program gives \((10, 6)\) at $6,875. The shortcut costs $805 a year, 10.5%, at the same target.
A service target does not escape the shortage cost. It asserts a value for it.
From a solved program. At the optimum, the approximation’s second condition holds at the \(\pi\) that would give the same answer unconstrained:
\[ \begin{aligned} \pi^{*} &= \frac{Q^{*}h}{\lambda\,G^{0}(r^{*})} = \frac{6(950)}{45(0.1378)}\\ &= \frac{5{,}700}{6.20} = \$919 \text{ per unit short} \end{aligned} \]
An emergency transformer costs the utility about $5,700. The 95% target implies less than a sixth of it. This target holds far too little.
From a ready rate. Invert the base-stock critical ratio, \(\gamma = b/(b+h)\):
\[ b = \frac{\gamma h}{1 - \gamma} \]
| Target \(\gamma\) | Implied \(b\) |
|---|---|
| 0.90 | $8,550 |
| 0.95 | $18,050 |
| 0.98 | $46,550 |
| 0.99 | $94,050 |
Notice the first row: the stated \(b = \$8{,}550\) is a 90% target.
Let \(z\) represent the safety factor, the safety stock in standard deviations of lead time demand:
\[ z = \frac{r - \theta}{\sigma_{D(L)}}, \qquad r = \theta + z\,\sigma_{D(L)} \]
\(z\) is a change of units. It is comparable across items where \(\mathit{ss}\) is not. Looking \(z\) up in a table is a modeling choice, made silently, and the choice is usually the normal. Do not make it.
| Target | Exact \(r\) | Gamma \(r\) | Rounds to |
|---|---|---|---|
| Type 1, \(\alpha = 0.90\) | 11 | 11.15 | 11 |
| Type 1, \(\alpha = 0.95\) | 12 | 12.50 | 12 |
| Type 1, \(\alpha = 0.99\) | 15 | 15.29 | 15 |
| Type 2, \(\beta = 0.90\) | 10 | 9.21 | 9 |
| Type 2, \(\beta = 0.95\) | 11 | 10.58 | 11 |
| Type 2, \(\beta = 0.99\) | 13 | 13.42 | 13 |
Even the gamma, \(\alpha = 7.5\), \(\beta = 1\), misses once in six, and the miss is a Type 2 target: a quantile asks less of a family than a loss function, which averages over a tail.
One unit is 36.5% of this item’s standard deviation. Solve against the Poisson directly. Use \(z\) for comparing items, not for setting \(r\) on a slow mover.
Define \(\tilde{C}(y) = h(y)^{+} + b(-y)^{+}\), which charges \(h\) per unit of positive net inventory and \(b\) per unit of negative. Since \(\mathit{IN} = S - D(L)\),
\[ C(S) = h\bar{I}(S) + b\bar{B}(S) = E\left[\tilde{C}\big(S - D(L)\big)\right] \]
An expectation of a convex function is convex, so \(C(S)\) is convex.
Notice the two ends. For small \(S\) the shelf is empty and \(C(S)\) falls with slope near \(-b\); for large \(S\) backorders vanish and it rises with slope near \(+h\). In between it turns once, at \(S^{*} = 11\).
Recall that \(\bar{B}(r,Q)\) and \(\bar{I}(r,Q)\) are averages of base-stock quantities over \(s = r+1, \ldots, r+Q\):
\[ \begin{aligned} h\bar{I}(r,Q) + b\bar{B}(r,Q) &= \frac{1}{Q}\sum_{s=r+1}^{r+Q}\Big[h\big(s - \theta + G^{1}(s)\big) + b\,G^{1}(s)\Big] &&\text{mean of } s \text{ is } r + \tfrac{Q+1}{2}\\ &= \frac{1}{Q}\sum_{s=r+1}^{r+Q} C(s) &&\text{base-stock cost}\\ C(r, Q) &= \frac{k\lambda + \sum_{s=r+1}^{r+Q} C(s)}{Q} &&\text{add } k\lambda/Q \end{aligned} \]
The two-dimensional problem has become a question about which \(Q\) consecutive values of a convex sequence to average.
The check. For the transformer at \((8, 7)\), the seven values from \(s = 9\) to \(15\) sum to $40,676.04, and
\[ C(8, 7) = \frac{9{,}900 + 40{,}676.04}{7} = \$7{,}225.15 \]
which is what the four exact formulas give directly. Two routes, one answer, and the second is the one that can be optimized.
Let \(w = b/(b+h)\). Two reference quantities, from models you already have:
\[ Q_{k} = \sqrt{\frac{2k\lambda}{hw}}, \quad C_{k} = \sqrt{2k\lambda hw} \quad\text{(deterministic, planned backorders)}, \qquad C_{\infty} = \sqrt{bh}\,\sigma \quad\text{(base stock)} \]
| Result | Statement | Transformer |
|---|---|---|
| Structure | \(r^{*} < S^{*} \le r^{*} + Q^{*}\) | \(8 < 11 \le 15\) |
| Cost bounds | \(C_{k} \le C^{*} \le \sqrt{C_{k}^{2} + C_{\infty}^{2}}\) | \(\$4{,}114.49 \le \$7{,}225.15 \le \$8{,}823.14\) |
| Quantity bounds | \(Q_{k} \le Q^{*} \le Q_{k} + C(S^{*})/(hw)\) | \(4.81 \le 7 \le 4.81 + 5.68\) |
| Insensitivity | \(C^{*}(Q)/C^{*} \le \tfrac{1}{2}\left(Q/Q^{*} + Q^{*}/Q\right)\) | continuous case only |
The optimal band straddles the optimal base-stock level. It is the most useful check you can run on a computed answer.
Choosing the wrong quantity is cheap, if anything cheaper than for the EOQ. A pallet, a case quantity or a supplier minimum costs less than the EOQ penalty.
An \((r, Q)\) policy costs \(k\lambda/Q\) plus the average of \(Q\) consecutive \(C(s)\). For a fixed \(Q\), the best \(r\) makes those the \(Q\) smallest values, and by convexity the \(Q\) smallest values are consecutive.
Increase \(Q\) by one. The window gains exactly one value, and by convexity it is at one end: \(C(r)\) just below, or \(C(r+Q+1)\) just above. Take the smaller, \(c\).
\[ \begin{aligned} QC^{*}(Q) &= k\lambda + \textstyle\sum_{\text{window}} C(s) &&\text{the cost-average formula}\\ (Q+1)\,C^{*}(Q+1) &= QC^{*}(Q) + c &&\text{one more value in the window}\\ C^{*}(Q+1) &= C^{*}(Q) - \frac{C^{*}(Q) - c}{Q+1} &&\text{divide, write } Q = (Q+1) - 1 \end{aligned} \]
The cost falls exactly when the value being added is below the current average. When it is not, no larger \(Q\) can help: stop.
optimize(r, Q):
// Step 0, initialize
find S*, the smallest S with G(S) >= b/(b+h)
Q <- 1
r <- S* - 1
Cstar <- k*lambda + C(S*)
// Step 1, the next smallest base-stock cost
loop:
c <- min( C(r), C(r+Q+1) )
// Step 2, test for termination
if c >= Cstar:
return r, Q, Cstar
// Step 3, extend the window
Q <- Q + 1
Cstar <- Cstar - (Cstar - c)/Q
if C(r) was the smaller:
r <- r - 1
Algorithm Optimize_rq, from Zipkin.
Notice what it does not do: no search over two dimensions, no derivatives, no iteration to convergence. It returns the optimal integer policy in at most \(Q^{*}\) passes.
The one input is a column of base-stock costs \(C(s)\), computed once.
| \(s\) | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|
| \(C(s)\) | $8,654 | $6,393 | $5,219 | $4,860 | $5,057 | $5,602 | $6,347 | $7,199 | $8,106 |
| Step | \(C(r)\) | \(C(r+Q+1)\) | \(c\) | Against \(C^{*}\) | New \(Q\) | New \(C^{*}\) | New \(r\) |
|---|---|---|---|---|---|---|---|
| 0 | \(S^{*} = 11\); \(C^{*} = 9{,}900 + 4{,}859.83\) | 1 | $14,759.83 | 10 | |||
| 1 | $5,219 | $5,057 | $5,057.03 | below | 2 | $9,908.43 | 10 |
| 2 | $5,219 | $5,602 | $5,218.57 | below | 3 | $8,345.14 | 9 |
| 3 | $6,393 | $5,602 | $5,601.71 | below | 4 | $7,659.28 | 9 |
| 4 | $6,393 | $6,347 | $6,346.84 | below | 5 | $7,396.80 | 9 |
| 5 | $6,393 | $7,199 | $6,392.69 | below | 6 | $7,229.45 | 8 |
| 6 | $8,654 | $7,199 | $7,199.37 | below | 7 | $7,225.15 | 8 |
| 7 | $8,654 | $8,106 | $8,105.59 | not below $7,225.15 | stop |
The checks. All three pass.
Look at the \(r\) column. It runs 10, 10, 9, 9, 9, 8, 8: falling as \(Q\) rises, never by more than one per step. A reorder point that jumps by two is a sign the cost column is not convex.
When the batch is large. The loop runs once per unit of \(Q^{*}\), so an item whose batch is in the hundreds takes hundreds of passes. Start instead near \(Q_{k}\), with \(r\) near \(S^{*} - \beta Q\) for \(\beta\) between \(1 - w\) and \(\tfrac{1}{2}\), and run the same reasoning up or down. It is not a heuristic; it reaches the same optimum from closer.
When the penalty is on the stockout probability. With \(C(s) = h\bar{I}(s) + b\,\overline{\mathit{SO}}(s)\) the cost need not fall to \(S^{*}\) and rise after it. Check the shape of the cost column before trusting any algorithm that assumes it.
Type 1 counts cycles and Type 2 counts units. At 95% on the transformer they set different reorder points and deliver different service.
A target is a constrained program, and its total is not unimodal in \(Q\). The EOQ shortcut cost 10.5% at the same target.
A target asserts a cost. The 95% fill rate implies $919 per unit short against a real $5,700.
The safety factor is a change of units. The table you read it from is a modeling choice; on a slow mover, solve against the count directly.
The exact cost is an average of a convex sequence, so the optimum is the \(Q\) smallest base-stock costs, found in \(Q^{*}\) passes with no search.
Read before next session: Lumpy Demand, The (s, S) Policy and Optimality of the (s, S) form.
Today’s material was Service Levels Instead of a Shortage Cost, The Cost Function and Its Shape, What You Know Before You Solve and An Exact Algorithm.
Next session:
Every model so far assumed demand arrives one unit at a time. Next session drops that.