| If the item … | Use | Sheet | Code |
|---|---|---|---|
| has a \(k\) small enough that one unit per order is best | Base-stock level | Evaluate, \(Q = 1\) |
RQOptimizer.optimize |
| has a stated backorder cost \(b\) | Exact \((r, Q)\) optimum | Optimize |
RQOptimizer.optimize |
| has a stockout cost \(\pi\), and moves fast | Classical approximation | Approximate |
none |
| has a service target and no shortage cost | Type 1 or Type 2 target | Service |
RQModel.fromReadyRateTarget |
| already has a policy | Exact evaluation | Evaluate |
RQModel.evaluate |
Read from the top and stop at the first row that fits.
The transformer: Poisson, so ratio one; a stated \(b\), so row two; \((r, Q) = (8, 7)\) at $7,225.15; \(8 < 11 \le 15\) checks.
Chapter8Models.xlsx, seven working sheets. Ledger is the twelve-event ledger with nothing collapsed: three typed columns, and the net inventory, the position and a residual as formulas. The residual is \(\mathit{IP} - (I + \mathit{IO} - B)\), so it reads zero on every row.
Notice how it counts orders. An order is placed exactly when the units on order rise, so the flag is =IF(D10>D9,1,0). Searching the event text for “order” returns three orders instead of two, because “backordered” contains it.
A worksheet cannot loop, and it does not need to. One row per step, each computed from the row above. A latch turns true once the stopping test fires and stays true:
=OR(G61,MIN(E61,F61)>=D61)
Q =IF(G62,B61,B61+1)
r =IF(G62,C61,IF(E61<=F61,C61-1,C61))
C* =IF(G62,D61,D61-(D61-MIN(E61,F61))/B62)
The third is the cost update. Every row after termination repeats the answer, so the last row is always the result.
The workbook ships holding the transformer, so its first use is to confirm it says what the chapter says.
The input block. B5 to B9: \(\lambda = 45\), \(k = \$220\), \(h = \$950\), \(b = \$8{,}550\), \(L = 0.1667\) years. B10 is the one derived input, \(\theta = \lambda L = 7.5\), and everything below reads B10.
The policy block. B13 and B14 hold \(r = 8\), \(Q = 7\), the only cells a reader types. B15 to B17 return \(\bar{B} = 0.1617\), \(\overline{\mathit{FR}} = 0.8781\), \(\bar{I} = 4.6617\).
The check, by hand. From the \(\lambda = 7.5\) column of the second order loss table, \(G^{2}(8) = 1.1369\) and \(G^{2}(15) = 0.0052\):
\[ \bar{B} = \frac{G^{2}(8) - G^{2}(15)}{7} = \frac{1.1369 - 0.0052}{7} = \frac{1.1317}{7} = 0.1617 \text{ units} \]
which is B15. Perform it once on any sheet you did not build: it is the whole backorder formula in two table lookups.
Purchasing believes a framework agreement would cut the transformer’s lead time from two months to one. One cell answers it: set B9 to \(1/12 = 0.0833\) years on Optimize. What happens to each cost term?
| Lead time 2 months, \((8, 7)\) | 1 month, \((4, 6)\) | Change | |
|---|---|---|---|
| Ordering | $1,414.29 | $1,650.00 | \(+\$235.71\) |
| Holding | $4,428.59 | $3,651.67 | \(-\$776.92\) |
| Backorder | $1,382.28 | $802.49 | \(-\$579.79\) |
| Total | $7,225.15 | $6,104.16 | \(\mathbf{-\$1{,}120.99}\) |
The saving is \(1{,}120.99/7{,}225.15 = 15.5\%\) a year. Holding falls because \(\theta\) halves and \(r\) follows it down; backorders fall because the same exposure is shorter. Ordering rises, because the optimal batch drops from seven to six.
A shorter lead time is not simply less of everything. Pricing it by scaling the current cost misses a term that runs the other way.
val transformer = RQModel(
demandRate = 45.0,
orderCost = 220.0,
holdingCost = RQModel.holdingCostFrom(
carryingCharge = 0.25, unitCost = 3800.0),
backorderCost = 8550.0,
leadTimeDemand = LeadTimeDemand.matched(
mean = 7.5, variance = 7.5),
)
println(transformer.bounds())
val answer = RQOptimizer(transformer).optimize()
println(answer)
println(transformer.evaluate(answer.policy))demandRate is \(\lambda\) a year, orderCost \(k\), holdingCost \(h = ic\), backorderCost \(b\), and leadTimeDemand is \(D(L)\), its family chosen by the variance to mean ratio.
bounds: Q in [5, 11], S* = 11 costing 4859.83,
C* in [4114.49, 8823.14]
(r = 8, Q = 7) costing 7225.15, found by warm
start in 19 window evaluations
policy (r = 8, Q = 7)
order frequency 6.4286 orders per unit time
expected backorders 0.1617 units
ready rate 0.8781
fill rate 0.8781
expected on hand 4.6617 units
ordering 1414.29 per unit time
holding 4428.59 per unit time
backorder 1382.28 per unit time
total 7225.15 per unit time
The evaluation reports a total of $7,225.15. Rebuild it from the three terms of the cost, with \(h = 0.25 \times 3{,}800 = \$950\).
\[ \begin{aligned} k\lambda/Q &= 220(45)/7 = \$1{,}414.29\\ h\bar{I} &= 950(4.6617) = \$4{,}428.59\\ b\bar{B} &= 8{,}550(0.16167) = \$1{,}382.28 \end{aligned} \]
and \(1{,}414.29 + 4{,}428.59 + 1{,}382.28 = \$7{,}225.15\).
The lead-time question of the worksheet is one line in the program: the lead time demand mean halves, from 7.5 to 3.75.
bounds: Q in [5, 9], S* = 6 costing 3529.19, C* in [4114.49, 6883.92]
(r = 4, Q = 6) costing 6104.16, found by warm start in 16 window evaluations
Notice that the program and the sheet agree: \((4, 6)\) at $6,104.16. copy changes one field of the RQModel and leaves \(\lambda\), \(k\), \(h\) and \(b\) alone, which is the program’s version of typing one cell. The bounds move too: \(S^{*}\) falls from 11 to 6, and the upper cost bound from $8,823.14 to $6,883.92.
The ground rod: \(\lambda = 2{,}400\) a year, \(c = \$14\) so \(h = \$3.50\), \(k = \$41.25\), the shared \(b = \$287.50\), two weeks: \(\theta = 2400/26 = 92.31\).
val rod = RQModel(
demandRate = 2400.0,
orderCost = 41.25,
holdingCost = RQModel.holdingCostFrom(carryingCharge = 0.25, unitCost = 14.0),
backorderCost = 287.50,
leadTimeDemand = LeadTimeDemand.matched(mean = 2400.0 / 26.0, variance = 2400.0 / 26.0),
)
println(rod.bounds())
println(RQOptimizer(rod).optimize())
println("Algorithm Optimize_rq from a batch of one takes %d steps"
.format(RQOptimizer(rod).optimizeFromUnitBatch().orderQuantity - 1))bounds: Q in [239, 265], S* = 115 costing 90.83, C* in [827.44, 881.79]
(r = 94, Q = 244) costing 859.94, found by jump search in 65 window evaluations
Algorithm Optimize_rq from a batch of one takes 243 steps
The Optimize sheet lays down thirty steps and this item needs 243. The program needs 65 window evaluations. The checks: \(94 < 115 \le 338\), and $859.94 lies in $827.44 to $881.79, on an answer no worksheet produced.
Choosing is a procedure. Fix the exposure, build \(D(L)\), choose its family, then read the model off the table from the top.
The workbook and the code compute what the chapter derived. The transformer’s $7,225.15 rebuilds by hand from its three terms; halving the lead time saves 15.5%; the ground rod needs 243 algorithm steps, which only the program reaches.
The chapter in one line. Everything is a functional of lead time demand; every policy is base stock averaged over a uniform quantity; the exact optimum is no harder than the approximation, so quote it.
Read before next session: the opening of Periodic Review and Other Policy Forms, and When Review Is Periodic.
Today’s material was Choosing and Applying a Model, Building These Models in a Worksheet and Using the Software. Why the code is shaped as it is lives in the book’s appendix on designing the course software.
Next session:
Every model so far watched the item at all times. Next session drops that, and the same substitution carries everything across.