Chapter5Models.xlsx, and the cells that carry the mathematics| Sheet | What it does | Which part of the chapter |
|---|---|---|
Data |
the requirements schedule, its statistics, and the forced period | the requirements schedule; when none of this is worth doing |
Plans |
four plans side by side, each costed by its ledger | three plans without any theory |
WagnerWhitin |
the window costs, the recursion, the traceback, the plan | the window cost; the recursion |
Heuristics |
three triangles of scores, the stopping tests, the chains and plans | three heuristics and one shape |
Solver |
the mixed integer program, one row per period | the same problem for a solver |
The periods run down the rows of one block, and every sheet reads that block by name. Blue cells are inputs, gray cells are computed, and yellow marks a cell a method picked: a period an order starts in, or a period a stopping rule chose.
Data: Three Inputs and Everything ElseThe three inputs in rows 5 to 7 are the only typed numbers on the sheet, and everything below them follows.
Notice that every figure the check block in rows 25 to 27 promises is on the screen above it: 1,840 belts, an average of 153.3333, a variability coefficient of 0.6191, \(k/h = 300\), a first forced month of 5, and an economic order quantity of 303.3 belts, a time supply of 1.98 months.
Cell B15 reads the variability coefficient against the threshold of 0.2 and answers the question in words, rather than leaving the reader to compare two numbers.
Data: the Requirements ScheduleColumn B is the only blue block. Columns C, D and E point at the input cells above, so a constant-cost problem is typed once, and a period-varying one needs no second workbook: type $54 over one cell of the unit cost column and every window cost in the workbook accounts for the price rise.
Notice column G, empty except in month 5, where 420 belts exceed \(k/h = 300\) and the forced-order test fires. Columns F and G are tinted, because they are derived and not data.
Plans: the Ledger, Made GeneralFour plans side by side, each an order column you type into and an ending-inventory column computing = previous end + order - requirement. The three shipped plans reproduce the three plans without theory exactly. Notice the purchase cost: $92,000 under all four plans, the purchase term made visible.
WagnerWhitin: the AnswerNothing on this sheet is typed. The top block is the answer, and row 9 exists to be compared with row 5: the setup and carrying of the traced plan must add to \(V(N)\).
Rather than write the window cost out in each cell, each cell adds one period to the cell on its left:
\[ \begin{aligned} w(t,t) &= k_t &&\text{diagonal}\\ w(t,u) &= w(t,u-1) + d_u \sum_{r=t}^{u-1} h_r &&\text{one more period} \end{aligned} \]
That is one short formula, filled right and down, and with constant \(h\) the step is \(h(u - t)d_u\), the increment read along row 1 of the window table.
WagnerWhitin: the Window TriangleThis is the six-month window table extended to twelve; read row 1 across and the first six entries are that table. Notice columns 8 and 9: equal in every row, because month 9 requires nothing, so a window reaching it costs what one ending at month 8 costs.
Notice also how fast the upper right grows. Covering the whole year from month 1 costs $10,420 against $300 for a single month, and that ratio is the whole reason an optimal plan orders more than once.
WagnerWhitin: the Recursion and the TracebackThe candidate block holds \(V(t-1) + w(t,u)\) for every \(t\) and \(u\), with nothing collapsed: \(V(u)\) is the MIN down column \(u\) and \(S(u)\) is the MATCH of that minimum. Notice \(V(8) = V(9) = \$1{,}700\) with \(S = 6\) at both. The yellow row is the traceback, walked backward by INDEX on the \(S\) row, and read right to left it orders in months 1, 4, 5, 6, 10 and 12.
WagnerWhitin: the PlanThe chain has become an order quantity per month, with COUNTIF asking whether a period starts an order and INDEX(Dls_d,a):INDEX(Dls_d,b) totaling what it covers.
The two totals are the arithmetic check the sheet is built around: $1,800 of setup and $680 of carrying, which add to \(V(12) = \$2{,}480\).
Notice month 6: it receives 420 belts and ends holding 160, the one place in the optimal plan where a month both orders and carries something forward.
Heuristics: Silver-Meal’s Scores and Its Stopping TestEvery score is a window cost divided by the length of its window. Row 5 is where the rule loses its money: $300.00, $280.00, $266.67, $230.00, $184.00, and only then a rise. Beside the scores, a triangle of zeros and ones asks “does the score rise at the next period?”, and MATCH(1, ...) finds the stop. Notice the yellow column: 2, 3, 4, 4, then 9 four times over.
Heuristics: Least Unit Cost and Part-Period BalancingLeast unit cost changes only the divisor. Notice the blank on the diagonal at \(t = u = 9\): a window covering no units has no cost per unit, so the rule steps over it. It is the only cell in the workbook that has to be guarded.
Part-period balancing scores what the window carries, which only grows. So the last period at or under \(k_t\) is an ordinary ascending MATCH, and the two neighbors are compared. Row 1 finds $300 exactly at \(u = 3\).
The two walking rules need a triangle of stopping tests; part-period balancing needs a lookup and a comparison. A score that can fall, as Silver-Meal’s can, cannot be looked up that way. The software draws the same line.
Heuristics: the Chains and the PlansEach chain starts in month 1, and each order after it starts where the previous one stopped. The rules order in months 1, 3, 5, 10, 12; in 1, 4, 6, 8, 12; and in 1, 4, 6, 10, 12. All three place five orders and no two agree on where. The totals are $1,500 of setup in every case against carrying of $1,160, $1,540 and $1,100.
Solver: the Mixed Integer ProgramOne row per period: \(Q_t\) in column C and \(y_t\) in column D are the changing cells, and column H holds \(Q_t - M y_t\), which Solver keeps at or below zero. That single column is what makes the program linear.
The sheet ships holding the optimal plan, so B5 reads $2,480. Clear the two changing columns and Solver finds its way back.
Notice column H in the months that order: a large negative number. The linking constraint is slack there and binds only at zero, which is its job.
The rolling horizon is not in the workbook, and that is not an oversight.
The rolling-horizon table is the cost of a sequence of twelve plans, eleven of which were computed, discarded and never executed. The study of 2,000 random schedules needs each solved twelve times under two rules:
\[ 2{,}000 \times 12 \times 2 = 48{,}000 \text{ solves}. \]
A worksheet asked to do that stops being a thing anyone can read.
A worksheet is the right tool for a model you want to look at, and the wrong tool for a model you want to run many times. That is where the software begins.
val belt = RequirementsSchedule.constantCosts(
label = "Mower deck belt",
requirements = listOf(40.0, 60.0, 120.0,
300.0, 420.0, 260.0, 120.0, 40.0,
0.0, 80.0, 180.0, 220.0),
orderCost = 300.0, unitCost = 50.0,
carryingCharge = 0.02)
val quarterly = belt.planFrom(listOf(1, 4, 7, 10))
println(quarterly.ledger(
"orders in months 1, 4, 7 and 10").toText())requirements are \(d_t\) in belts a month, orderCost is \(k\), unitCost is \(c\), and carryingCharge is \(i\) a month, so \(h = ic = \$1\). planFrom takes the order periods of a plan someone chose. The line after the table reads setup 1200, carrying 1900, relevant 3100.
t | d_t | Q_t | I_t | setup ($) | carrying ($)
----+-----+-----+-----+-----------+--------------
1 | 40 | 220 | 180 | 300 | 180
2 | 60 | 0 | 120 | 0 | 120
3 | 120 | 0 | 0 | 0 | 0
4 | 300 | 980 | 680 | 300 | 680
5 | 420 | 0 | 260 | 0 | 260
6 | 260 | 0 | 0 | 0 | 0
7 | 120 | 160 | 40 | 300 | 40
8 | 40 | 0 | 0 | 0 | 0
9 | 0 | 0 | 0 | 0 | 0
10 | 80 | 480 | 400 | 300 | 400
11 | 180 | 0 | 220 | 0 | 220
12 | 220 | 0 | 0 | 0 | 0
Month 4 orders 980 belts. Where does 980 come from, and what does month 4 carry?
The order covers months 4 to 6: \(300 + 420 + 260 = 980\). The balance is
\[ I_4 = I_3 + Q_4 - d_4 = 0 + 980 - 300 = 680, \]
so month 4 carries \(hI_4 = 1 \times 680 = \$680\), and the plan costs \(1{,}200 + 1{,}900 = \$3{,}100\), which is \(620/2{,}480 = 25.0\%\) above the optimum.
println(belt.variabilityCoefficient) // 0.6191
println(belt.forcedOrderPeriod()) // 5
val optimum = WagnerWhitin.plan(belt)
for (r in listOf(LotForLot, AdjustedEconomicOrderQuantity(), PeriodicOrderQuantity(),
LeastUnitCost, PartPeriodBalancing, SilverMeal, WagnerWhitin)) {
val p = r.plan(belt)
println("%-32s %6d %9.0f %9.0f %9.0f %8.2f%%".format(
r.name, p.orderCount, p.setupCost, p.carryingCost, p.relevantCost,
p.penaltyAgainst(optimum).relativeError * 100.0))
}
for (window in 2..6) {
val sm = RollingHorizon(belt, window, freeze = 1).realizedPlan(SilverMeal)
val ww = RollingHorizon(belt, window, freeze = 1).realizedPlan(WagnerWhitin)
println("%d %.0f %.0f".format(window, sm.relevantCost, ww.relevantCost))
}Choosing is a loop over rules, each priced against the optimum. Varying the item is the rolling horizon: two lines per row of the truncation table.
The workbook lays every method out with nothing collapsed: the window triangle, the candidate block, the traceback, and the three rules’ scores, each checked against the chapter.
The software prices any plan as a ledger: the quarterly plan costs $3,100, and month 4’s row checks by hand, \(0 + 980 - 300 = 680\).
Choosing is a loop over rules, each priced against Wagner-Whitin’s $2,480.
The rolling horizon runs in code because a worksheet holds one instance of a model and cannot run 48,000.
Read before next session: Demand You Should Not Forecast, The Bill of Material and The MRP Record, in the requirements planning chapter.
Today’s material was 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 rule from today runs inside an MRP record unchanged. Bring the belt’s twelve-month pattern: it becomes a master production schedule.