Recall the position column of the ledger: 9, 8, 7, 6, 5, and back to 9. With demands of one unit the position visits each of \(r+1, \ldots, r+Q\) once per cycle and spends the same expected time at each. In steady state,
\[ \mathit{IP} \sim \text{Uniform}\{r+1, r+2, \ldots, r+Q\}, \qquad \text{independent of } D(L) \]
The position when an order is placed is set by demands that have already happened; \(D(L)\) is demand that has not yet happened. Independent increments make the two independent. Then, as for base stock,
\[ \mathit{IN} = \mathit{IP} - D(L) \]
Condition on the position, apply the base-stock results at \(S = \mathit{IP}\), and average over the \(Q\) values.
\[ \begin{aligned} \bar{B}(r, Q) &= \sum_{j=r+1}^{r+Q} E[B \mid \mathit{IP} = j]\,P\{\mathit{IP} = j\} = \frac{1}{Q}\sum_{j=r+1}^{r+Q} G^{1}(j) &&\text{condition on the position, then average}\\ &= \frac{1}{Q}\left[G^{2}(r) - G^{2}(r+Q)\right] &&G^{2}(b) = \textstyle\sum_{x > b}G^{1}(x)\\[6pt] \overline{\mathit{RR}}(r, Q) &= \frac{1}{Q}\sum_{j=r+1}^{r+Q} G(j-1) = 1 - \frac{1}{Q}\sum_{x=r}^{r+Q-1} G^{0}(x) &&G = 1 - G^{0}\text{, shift the index}\\ &= 1 - \frac{1}{Q}\left[G^{1}(r) - G^{1}(r+Q)\right] &&G^{1}(b) = \textstyle\sum_{x \ge b}G^{0}(x)\\[6pt] \bar{I}(r, Q) &= E[\mathit{IP}] - \theta + \bar{B} = \frac{Q+1}{2} + r - \theta + \bar{B}(r, Q) &&I = \mathit{IN} + B \end{aligned} \]
and \(\overline{\mathit{OF}} = \lambda/Q\) as before. Four formulas, and every one of them is exact.
Set \(Q = 1\). Every sum has one term, at \(j = r + 1 = S\), and the four formulas collapse to base stock.
Read \(\tfrac{1}{2}(Q+1)\). It is the average of the integers 1 through \(Q\), the discrete counterpart of the EOQ’s \(Q/2\). The classical cycle stock is still in there, raised by half a unit because units are whole and by \(\bar{B}\) because shortages are possible.
The spread. \(\bar{B}\) is the mean of a quantity that is zero most of the time and occasionally large. Averaging the shortage’s second moment the same way,
\[ \begin{aligned} E\left[B^{2}\right] = \frac{1}{Q}\Big\{&2\left[G^{3}(r) - G^{3}(r+Q)\right]\\ &+ \left[G^{2}(r) - G^{2}(r+Q)\right]\Big\} \end{aligned} \]
and \(\mathit{Var}[B] = E[B^{2}] - \bar{B}^{2}\). This is the first place the book needs the third order loss function.
\(\lambda = 45\), \(k = \$220\), \(h = \$950\), \(b = \$8{,}550\), \(D(L)\) Poisson with \(\theta = 7.5\). Start from the EOQ, whose cost curve is flat: \(Q = \sqrt{2(220)(45)/950} = \sqrt{20.84} = 4.57 \to 5\).
| \(r\) | \(\bar{B}\) | \(\overline{\mathit{FR}}\) | \(\bar{I}\) | Ordering | Holding | Backorder | Total |
|---|---|---|---|---|---|---|---|
| 7 | 0.3854 | 0.7492 | 2.8854 | $1,980 | $2,741 | $3,295 | $8,016 |
| 8 | 0.2212 | 0.8357 | 3.7212 | $1,980 | $3,535 | $1,891 | $7,406 |
| 9 | 0.1202 | 0.8990 | 4.6202 | $1,980 | $4,389 | $1,028 | $7,397 |
| 10 | 0.0619 | 0.9417 | 5.5619 | $1,980 | $5,284 | $529 | $7,793 |
| 11 | 0.0302 | 0.9683 | 6.5302 | $1,980 | $6,204 | $258 | $8,442 |
The answer. \((r, Q) = (9, 5)\), $7,397 a year, fill rate 0.8990.
The check. \(\bar{I} = (5+1)/2 + 9 - 7.5 + 0.1202 = 4.6202\), which the table reproduces.
At \((9, 5)\) the position is 10, 11, 12, 13 or 14, each a fifth of the time. Every entry comes from the hand table.
\[ \begin{aligned} \bar{B} &= \tfrac{1}{5}(0.2993 + 0.1616 + 0.0823 + 0.0397 + 0.0181) = 0.1202 &&G^{1}(10) \text{ to } G^{1}(14)\\ &= \tfrac{1}{5}\left[G^{2}(9) - G^{2}(14)\right] = \tfrac{1}{5}(0.6140 - 0.0130) = 0.1202 &&\text{the same, from two entries}\\ \overline{\mathit{RR}} &= 1 - \tfrac{1}{5}\left[G^{1}(9) - G^{1}(14)\right] = 1 - \tfrac{1}{5}(0.5229 - 0.0181) = 0.8990 &&\text{the fill rate, by PASTA}\\ \bar{I} &= \tfrac{5+1}{2} + 9 - 7.5 + 0.1202 = 4.6202 &&\text{mean position, less } \theta \text{, plus } \bar{B}\\ C &= 220\left(\tfrac{45}{5}\right) + 950(4.6202) + 8550(0.1202) &&\text{ordering, holding, backorders}\\ &= 1{,}980 + 4{,}389 + 1{,}028 = \$7{,}397 &&\text{a year}\\ E[B^{2}] &= \tfrac{1}{5}\left[2(0.5827) + 0.6010\right] = 0.3533 &&\textstyle\sum_{10}^{14} G^{2}(j) = 0.5827 \end{aligned} \]
The other rows repeat these steps with the position shifted by one.
| Policy | Ordering | Holding | Backorder | Total |
|---|---|---|---|---|
| Base stock, \(S = 11\) | $9,900 | $3,478 | $1,381 | $14,760 |
| \((r, Q) = (9, 5)\) | $1,980 | $4,389 | $1,028 | $7,397 |
Ordering five at a time halves the cost of running this item, and it raises the fill rate from 0.8622 to 0.8990 while doing it. The base-stock policy was worse on both counts at once.
The spread at \((9, 5)\). \(E[B^{2}] = 0.3533\), so \(\mathit{Var}[B] = 0.3533 - 0.1202^{2} = 0.3388\) and the standard deviation is 0.582 units, nearly five times the mean. The average of 0.12 units owed is not a typical state. The typical state is zero, punctuated by occasions of several. Reporting the mean alone describes a situation that never occurs.
The lead time enters the four formulas only through the distribution of \(D(L)\). Thus, a random lead time is the same model with a different \(D(L)\).
One condition
\(\mathit{IN} = \mathit{IP} - D(L)\) holds because every earlier order has arrived. Orders must be received in the sequence they were placed. A fixed route preserves it; a pool of suppliers, any of whom may fill an order, does not.
Both suppliers average two months; \((r, Q)\) optimized under each.
| The supplier | \(\mathit{Var}[D(L)]\) | \((r, Q)^{*}\) | Cost |
|---|---|---|---|
| Exactly two months | 7.5 | \((8, 7)\) | $7,225.15 |
| Std. dev. one month | 21.5625 | \((10, 8)\) | $11,079.73 |
The uncertainty costs $3,854.58 a year, 53% more than a reliable supplier. That is the number to put in front of a purchasing department choosing between a cheaper supplier and a predictable one. Both \(r\) and \(Q\) rise: \(r\) because the tail is heavier, \(Q\) because each cycle is more expensive to start.
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.
Step 0. \(S^{*}\) is the smallest \(S\) with \(G(S) \ge b/(b+h)\). Set \(Q = 1\), \(r = S^{*} - 1\), \(C^{*} = k\lambda + C(S^{*})\).
Step 1. Of the two levels just outside the window, \(C(r)\) and \(C(r+Q+1)\), let \(c\) be the smaller.
Step 2. If \(c \ge C^{*}\), stop: return \(r\), \(Q\), \(C^{*}\).
Step 3. \(Q \leftarrow Q + 1\), then \(C^{*} \leftarrow C^{*} - (C^{*} - c)/Q\). If \(C(r)\) was the smaller (or tied), \(r \leftarrow r - 1\). Back to step 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^{*} - \kappa Q\) for \(\kappa\) 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.
The position is uniform on \(r+1, \ldots, r+Q\) and independent of \(D(L)\). Every \((r, Q)\) measure is a base-stock measure averaged over the band, and all four are exact.
For the transformer, \((9, 5)\) costs $7,397, half of what one for one costs, at a better fill rate.
A random lead time is the same model with a different \(D(L)\), provided orders do not cross. An unreliable supplier costs this item 53%.
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. On the transformer that is \((8, 7)\) at $7,225.15, in seven steps.
Read before next session: The Classical Approximation and Service Levels Instead of a Shortage Cost.
Today’s material was General Batch Sizes, The Cost Function and Its Shape, What You Know Before You Solve and An Exact Algorithm.
Next session:
Keep today’s \((8, 7)\) at $7,225.15. Next session prices the approximation against it.