The EOQ and the constrained multi-item problem took a constant rate.
Dynamic lot sizing let the rate vary by period and still knew it.
Requirements planning computed it from a production plan.
From here on demand is a random variable, and the decision is made before it is observed.
We begin with the simplest such problem: the decision is made once.
A distributor has stocked a mower deck belt for years. The deck it fits is now out of production.
What remains is steady replacement demand from owners of machines already in the field. The supplier is discontinuing the belt and has offered one last order.
| What is stocked? | One item, the belt. |
| Demand process? | Weekly, random, no longer seasonal. About fourteen weeks remain. |
| When reviewed? | Once. One decision, no second chance. |
| What triggers replenishment? | Nothing. The distributor names a quantity now. |
| Unmet demand? | Lost. The dealer gets it elsewhere. |
| Costs? | Belt costs $50, sells for $95, scraps at $12. |
There is no ordering cost in the model.
Exactly one order is placed whatever its size, so \(k\) is the same under every decision.
A constant added to every alternative cannot change which alternative is least.
So \(k\) drops out, and with it the entire question every deterministic model so far has been about.
A single-period problem is not a multi-period problem with the number of periods set to one.
In a multi-period problem a unit left at the end is available at the start of the next, so having too many costs one period of holding.
Here it is the whole loss on the unit: $50 paid against $12 recovered.
Which is why the trade-off is overage against underage, rather than holding against ordering.
Order too many: the distributor loses $38 a belt.
Order too few: it loses the $45 margin on each belt it could have sold.
Both are opportunity costs, measured against the decision that could have been made.
And neither appears in any ledger.
One distinction before any data are used. It is the commonest error in this material, and it is invisible in the answer.
The two differ whenever the shelf was empty.
A week that sold 40 belts because 40 were on the shelf, and a week that sold 40 because 40 were wanted, look identical in a sales record.
Sales are demand censored at whatever was available.
So a history of sales understates both the average and the spread.
And it understates them most in exactly the weeks when the item mattered, because those are the weeks it ran out.
An organization that wants to model demand has to record the demand it could not fill, and most do not.
Where that record does not exist, every quantity computed from the fit is too small. Say so when you report the answer.
No calculus. No fitted distribution. A planner at a whiteboard.
Asked for a judgment, the distributor offers five outcomes for total remaining demand:
| Demand \(x\), belts | 300 | 400 | 500 | 600 | 700 |
|---|---|---|---|---|---|
| \(P\{X = x\}\) | 0.15 | 0.25 | 0.30 | 0.20 | 0.10 |
| \(P\{X \le x\}\) | 0.15 | 0.40 | 0.70 | 0.90 | 1.00 |
The mean is 485 belts.
The sketch is coarse on purpose: what follows needs the shape of demand, not its detail.
Rather than evaluate every candidate, ask:
Given that we have decided on some quantity, is one more hundred belts worth buying?
It pays off when demand exceeds what we already have: probability \(P\{X \ge Q+100\}\), each belt earning the $45 margin.
It costs when demand stops at or below what we have: probability \(P\{X \le Q\}\), each unsold belt losing $38.
\[ 45 \times 100 \times P\{X \ge Q+100\} \;>\; 38 \times 100 \times P\{X \le Q\} \]
Demand reaches 400 or more with probability 0.85.
Gain: \(45(100)(0.85) = \$3{,}825\).
Demand stops at 300 with probability 0.15.
Loss: \(38(100)(0.15) = \$570\).
The step is worth +$3,255. Take it.
Demand reaches 500 or more with probability 0.60.
Gain: \(45(100)(0.60) = \$2{,}700\).
Demand stops at 400 or below with probability 0.40.
Loss: \(38(100)(0.40) = \$1{,}520\).
The step is worth +$1,180. Take it.
Demand reaches 600 or more with probability 0.30. Gain: $1,350.
Demand stops at 500 or below with probability 0.70. Loss: $2,660.
The step loses $1,310. Stop.
| From | To | \(P\{X \ge \text{to}\}\) | Gain | \(P\{X \le \text{from}\}\) | Loss | Net |
|---|---|---|---|---|---|---|
| 300 | 400 | 0.85 | $3,825 | 0.15 | $570 | +$3,255 |
| 400 | 500 | 0.60 | $2,700 | 0.40 | $1,520 | +$1,180 |
| 500 | 600 | 0.30 | $1,350 | 0.70 | $2,660 | -$1,310 |
| 600 | 700 | 0.10 | $450 | 0.90 | $3,420 | -$2,970 |
Order 500 belts.
Notice that 500 is more than the mean of 485.
The distributor should plan to be left with belts more often than it plans to run out, because running out costs more per belt than scrapping does.
That is not luck. Rearrange the marginal test: the step is worth taking while
\[ P\{X \le Q\} < \frac{45}{45+38} = \frac{c_{u}}{c_{u}+c_{o}} = 0.5422 \]
The left side is a cumulative distribution function, which never decreases.
So once the test fails, it fails for every larger quantity.
Stopping at the first negative step is correct, not merely convenient.
The rule: order the smallest quantity whose cumulative probability reaches 0.5422. \(F(400) = 0.40\) is short; \(F(500) = 0.70\) clears it.
Costing all five candidates directly should agree, and it does.
| \(Q\) | 300 | 400 | 500 | 600 | 700 |
|---|---|---|---|---|---|
| Expected profit | $13,500 | $16,755 | $17,935 | $16,625 | $13,655 |
Three routes, one answer.
Worth performing the first time you use marginal analysis on a new problem.
The marginal argument is only valid when expected profit has a single peak, and the direct calculation is what confirms it.
Five outcomes, four steps, no distribution and no calculus.
What it cannot do is say anything between 400 and 500 belts.
And the real decision is a number of belts, not a number of hundreds.
For that we need a distribution. First, let us state the model properly.
It carries the name of a vendor buying newspapers for the day, and it applies to any resource committed before the need for it is known.
Both are opportunity costs, and both are strictly positive.
At the end of the period exactly one of two things has happened: \(Q - X\) units are left, or \(X - Q\) units of demand went unmet.
With \((y)^{+} = \max(y, 0)\):
\[ C(Q, X) = c_{o}(Q-X)^{+} + c_{u}(X-Q)^{+} \]
Exactly one of the two terms is non-zero for any realized demand.
It is a random variable, because \(X\) is, and the decision minimizes \(E[C(Q,X)]\).
Practice writes this in quantities that appear on an invoice.
Let \(c\) be the purchase cost, \(s\) the selling price, \(u\) the salvage value, with \(s > c > u\). The vendor sells \(\min(X,Q)\), salvages \((Q-X)^{+}\), and pays for \(Q\):
\[ G(Q, X) = s\min(X, Q) + u(Q-X)^{+} - cQ \]
Matching terms,
\[ c_{o} = c - u, \qquad c_{u} = s - c \]
Overage is what a unit loses between the counter and the scrap yard. Underage is the margin forgone. For the belt: $38 and $45.
They differ by \((s-c)E[X]\), the profit if every unit demanded were sold.
That quantity does not depend on \(Q\). It shifts the objective without moving its optimum:
\[ E[G(Q,X)] = (s-c)E[X] - E[C(Q,X)] \]
Use whichever formulation the audience speaks.
Derive in costs, because the expression is shorter. Report in profits, because that is what the distributor will ask for.
Recall the first order loss function \(G^{1}(b) = E[(X-b)^{+}]\), the expected amount by which demand exceeds \(b\).
The shortage term is \(G^{1}(Q)\) by definition.
The leftover term needs one step. Notice the identity
\[ (Q-X)^{+} = (X-Q)^{+} + Q - X \]
When \(X < Q\) the right side is \(0 + Q - X\). When \(X \ge Q\) it is \(X - Q + Q - X = 0\).
Taking expectations of that identity,
\[ E\left[(Q-X)^{+}\right] = G^{1}(Q) + Q - E[X] \]
The expected leftover is the expected shortage plus however far the order sits above the mean. Putting the two together,
\[ E[C(Q)] = (c_{u}+c_{o})G^{1}(Q) + c_{o}\left(Q - E[X]\right) \]
The first term is the cost of being short, weighted by both prices, because a unit short is both a sale lost and a unit not held.
The second is the cost of the position itself.
Using \(dG^{1}(Q)/dQ = -G^{0}(Q)\), where \(G^{0}(Q) = 1 - F(Q)\):
\[ \frac{d}{dQ}E[C(Q)] = -(c_{u}+c_{o})G^{0}(Q) + c_{o} \]
Setting it to zero gives \(G^{0}(Q) = c_{o}/(c_{u}+c_{o})\), and since \(G^{0} = 1-F\):
\[ F(Q^{*}) = \frac{c_{u}}{c_{u}+c_{o}}, \qquad Q^{*} = F^{-1}\!\left(\frac{c_{u}}{c_{u}+c_{o}}\right) \]
It is a minimum: the second derivative is \((c_{u}+c_{o})f(Q)\), non-negative everywhere, so the expected cost is convex and the stationary point is the bottom.
\(c_{u}/(c_{u}+c_{o})\) is the critical ratio.
It is exactly the rule the marginal analysis produced by hand.
And the derivation is why that rule was right.
The left side is \(P\{X \le Q^{*}\}\): the probability that demand falls short of the order.
That is the probability of having too much.
So the critical ratio is not an input to the answer.
It is the answer, expressed as a service level the costs imply.
The ratio depends only on the relative size of the two costs.
| Being short costs | 3 times as much | 4 times | 9 times |
|---|---|---|---|
| Optimal chance of leftovers | 75% | 80% | 90% |
Two consequences follow, and both contradict what an organization usually rewards.
A buyer who ends every period with nothing left is not being careful.
They are ordering at a critical ratio near zero, which is only correct when a lost sale costs nothing.
For the belt the ratio is 0.5422, so the distributor should expect leftovers in about 54% of futures.
A manager who treats scrapped belts as evidence of a mistake will push the buyer below the optimum.
And the loss will never appear in any account, because it is a sale that did not happen.
The mirror error costs just as much.
At the belt’s ratio the distributor should expect to run out about 46% of the time.
A service target of 99% is a claim that \(c_{u}\) is ninety-nine times \(c_{o}\).
If that is not true, the stock is too large.
So the useful question to ask of a stated service level is not whether it is high enough. It is what ratio of costs would make it optimal, and whether anyone believes those costs.
Demand is now random, and the decision precedes the observation.
A single period is not a multi-period problem with \(n = 1\). The ordering cost drops out and leftover stock loses its whole value.
Sales are censored demand, and a fit to sales is biased low exactly where it matters.
Marginal analysis gives the rule on a whiteboard, and the derivative confirms it.
The critical ratio is a service level the costs imply, not a target you choose.
Read before next session: Getting a Demand Distribution, Intermittent and Slow-Moving Demand, and Continuous Demand.
Next session turns the ratio into a number of belts:
We have the rule. What we do not yet have is a distribution to apply it to, and that turns out to carry more of the answer than the rule does.