Chapter 6, Material and Distribution Requirements Planning
theme = Generators.observe(notify => {const read = () => {const css =getComputedStyle(document.body);const v = (name, fallback) => (css.getPropertyValue(name).trim() || fallback);return {dark:document.body.classList.contains("quarto-dark"),fg:v("--bs-body-color","#212529"),bg:v("--bs-body-bg","#ffffff"),muted:v("--bs-secondary-color","#6c757d"),grid:v("--bs-border-color","#dee2e6"),primary:v("--bs-link-color","#0d6efd"),accent:v("--bs-danger","#dc3545"),good:v("--bs-success","#198754") }; };// Quarto swaps stylesheets when the theme changes, and the new variables apply only once// the stylesheet has loaded; read them again shortly after, and keep the last reading.let last ="";const emit = () => {const t =read();const key =JSON.stringify(t);if (key !== last) { last = key;notify(t); } };const update = () => { emit();setTimeout(emit,100);setTimeout(emit,400); };update();const observer =newMutationObserver(update); observer.observe(document.body, {attributes:true,attributeFilter: ["class"]});return () => observer.disconnect();})
plotStyle = ({// "inherit" takes the page's text color directly, so axes and labels follow a theme// switch even before the plot redraws.color:"inherit",background:"transparent",fontSize:"13px",overflow:"visible"})
themedButton = (label, counterLabel =null) => {const button =html`<button type="button" class="btn btn-sm btn-outline-primary bisc-explorer-button">${label}</button>`;// The counter shows which run is on screen, so every press visibly does something and a// reader can tell runs apart. It reads 1 at page load and after Reset.const counter = counterLabel?html`<span class="bisc-run-counter" aria-live="polite"></span>`:null;const form =html`<form class="bisc-explorer-control">${button}${counter ||""}</form>`;const show = () => { if (counter) counter.textContent=`${counterLabel}${form.value+1}`; }; form.value=0;show(); button.onclick= () => { form.value+=1; form.dispatchEvent(newEvent("input", {bubbles:true})); };// Reset sets the value back to 0 and dispatches input; refresh the counter either way. form.addEventListener("input", show);return form;}
resetButton = (controls, label ="Reset to the starting values") => {// This runs once per page, because the cell that calls it depends on the controls// themselves (viewof), not on their values; so these are the values at page load.const start = controls.map(c => c.value);const button =html`<button type="button" class="btn btn-sm btn-outline-primary bisc-explorer-button">${label}</button>`; button.onclick= () => { controls.forEach((c, k) => { c.value= start[k]; c.dispatchEvent(newEvent("input", {bubbles:true})); }); };returnhtml`<div style="margin: 0.5rem 0">${button}</div>`;}
// A small seeded generator (mulberry32), so a run can be repeated.makeRandom = (seed) => {let a = seed >>>0;return () => { a = (a +0x6D2B79F5) >>>0;let t = a; t =Math.imul(t ^ (t >>>15), t |1); t ^= t +Math.imul(t ^ (t >>>7), t |61);return ((t ^ (t >>>14)) >>>0) /4294967296; };}
This explorer runs the explosion of Chapter 6 on the mower deck assembly and the four items that go into it, with the lot sizing rules in your hands. Choose a rule for the deck assembly and another for every component, and watch what the end item’s choice does to the requirements, the orders and the costs below it. The structure is the chapter’s: one belt, two spindle assemblies and one bearing per deck, and one housing and two bearings per spindle assembly, so that the bearing has two parents.
Recall that a component’s gross requirements are its parents’ planned order releases times the quantity per, summed over the parents:
The page runs in your browser and records nothing. Its formulas are a restatement in JavaScript of the book’s code, and they are tested against that code under every pairing of the two rules. For one record with inputs of your own, use the record explorer.
The Structure
ruleNames = ["Lot-for-lot","Periodic order quantity","Wagner-Whitin","Silver-Meal","Least unit cost","Part-period balancing","Adjusted economic order quantity"]viewof top = Inputs.select(ruleNames, {value:"Lot-for-lot",label:"Rule on the deck assembly"})viewof below = Inputs.select(ruleNames, {value:"Lot-for-lot",label:"Rule on every component"})viewof leadIn = Inputs.range([2,8], {step:1,value:5,label:"Empty months in front of the schedule"})viewof shown = Inputs.select(newMap([["Mower deck assembly (DA)","DA"], ["Deck belt (B)","B"], ["Spindle assembly (S)","S"], ["Spindle housing (H)","H"], ["Bearing (BR)","BR"]]), {value:"BR",label:"Record to show"})resetButton([viewof top, viewof below, viewof leadIn, viewof shown])
{const dollars = x => { const whole =Math.abs(x -Math.round(x)) <0.005;return"$"+ x.toLocaleString("en-US", {minimumFractionDigits: whole ?0:2,maximumFractionDigits: whole ?0:2}); };const da = plan.records.DA;const level1 =vc(da.POR.slice(leadIn));returnhtml`<table class="table table-sm" style="max-width: 46rem"> <thead><tr><th>Item</th><th>Low-level code</th><th>L</th><th>Orders</th><th>Setup</th><th>Carrying</th><th>Cost</th></tr></thead> <tbody>${plan.order.map(id => {const r = plan.records[id];returnhtml`<tr><td>${r.item.label}</td><td>${plan.code[id]}</td><td>${r.item.L}</td> <td>${r.orders}</td><td>${dollars(r.setup)}</td><td>${dollars(r.carrying)}</td><td>${dollars(r.relevant)}</td></tr>`;})} <tr style="font-weight: 600"><td>Total</td><td></td><td></td><td></td><td></td><td></td><td>${dollars(plan.relevant)}</td></tr></tbody> </table> <p>The deck assembly costs ${dollars(da.relevant)} and the components ${dollars(plan.relevant- da.relevant)}, for ${dollars(plan.relevant)} in all. The deck assembly's receipts, which are what the belt is asked for, have a variability coefficient of ${level1.toFixed(4)} over the twelve scheduled months; the master schedule's own is 0.6191.</p>${plan.pastDue>0?html`<p style="color: ${theme.accent}"><strong>${plan.pastDue.toLocaleString("en-US")} units are past due.</strong> ${leadIn} empty months are fewer than the 5 months of cumulative lead time through the bearing, so some releases fall before period 1.</p>`:html`<p>Nothing is past due: ${leadIn} empty months cover the 5 months of cumulative lead time through the bearing.</p>`}`;}
The record below is the one you chose to show, with the periods across the columns as the chapter draws it. Notice that every release sits one lead time to the left of its receipt, and that a component’s gross requirements are its parents’ releases, not their receipts.
The plot holds the rule on the components fixed at your choice and tries every rule on the deck assembly. Each bar is what the deck assembly costs, and its extension is what the components cost beneath it; the bar outlined in red is your rule. Notice that the rule cheapest at the deck assembly is not the rule cheapest for the structure.
{const rows = ruleNames.flatMap(name => {const {items, usages, mps} =deck({top: name, below, leadIn});const p =explode(items, usages, mps), da = p.records.DA.relevant;return [{rule: name,part:"Deck assembly",cost: da,total: p.relevant}, {rule: name,part:"Components",cost: p.relevant- da,total: p.relevant}]; });return Plot.plot({style: plotStyle,height:300,marginLeft:10,marginBottom:45,marginTop:10,x: {label:"Cost of the plan ($)",labelAnchor:"center",labelOffset:38,grid:true},y: {label:null,axis:null,domain: ruleNames,padding:0.35},color: {domain: ["Deck assembly","Components"],range: [theme.primary, theme.muted],legend:true},marks: [ Plot.barX(rows, {y:"rule",x:"cost",fill:"part",fillOpacity:0.75}), Plot.barX(rows.filter(d => d.rule=== top && d.part==="Components"), {y:"rule",x1:0,x2:"total",fill:"none",stroke: theme.accent,strokeWidth:2}), Plot.text(rows.filter(d => d.part==="Deck assembly"), {y:"rule",x:0,text: d =>`${d.rule}: $${Math.round(d.total).toLocaleString("en-US")}`,dy:-14,textAnchor:"start",fill: theme.fg,fontSize:11}) ],ariaLabel:"The cost at the deck assembly and below it under each rule on the deck assembly",ariaDescription:`With ${below} on the components, the cheapest structure costs $${Math.round(d3.min(rows, d => d.total))}.` });}
Things to Try
Start with every item on lot-for-lot. The plan costs $14,500, all of it setup: $5,500 at the deck assembly and $9,000 below it. Show the bearing’s record: its gross requirements are 160, 280, 540, 1,320 and so on from period 4, two streams added on different offsets.
Put Wagner-Whitin on the deck assembly. It costs $4,860 there, the least any rule can, and the structure costs $12,360. The adjusted economic order quantity costs $5,588 at the deck assembly and $11,488 for the structure, $872 less.
Put part-period balancing on the deck assembly. The variability coefficient rises to 1.5463, the lumpiest of the seven, yet the structure costs $11,544, among the cheapest: the order count, 7, explains the cost below, and the variability coefficient does not.
Keep the adjusted economic order quantity on the deck assembly and put Wagner-Whitin on every component. The structure costs $11,023.20, and least unit cost on the deck assembly now does better, at $10,914.40.
Return every rule to lot-for-lot and cut the empty months to 3. The bearing’s lead time of 3, below a spindle assembly and a deck assembly of 1 each, needs 5, so 520 units are past due; at 4 months, 160 are.
Check What You Found
Check what you found
1. With every component on lot-for-lot, Wagner-Whitin costs $4,860 at the deck assembly, the least any rule can, and the adjusted economic order quantity costs $5,588. Yet the structure costs $12,360 under Wagner-Whitin and $11,488 under the adjusted economic order quantity. Why?