learn-prescriptive-analytics-with-phoebe / Leader session 4 of 6
Learn Prescriptive Analytics with Phoebe · Leader session 4 of 6

The plan that works on average

Three sessions in, Ravensworth has a plan it can defend: 33 tonnes of Standard, 63 of Dairy, no Show, worth 4,656.00. That figure is correct, it was computed by a solver that passes its own checks, and it is going to be repeated in a board pack. Tonight the same plan is run against demand that arrives the way demand actually arrives, ten thousand times over, five separate times. It delivers between 4,318 and 4,331. Nothing was wrong with the arithmetic, and the gap is real money.

🟡 Foundations Anyone who repeats a number from a model Anyone who owns the downside 45 min
0-3 · The promise 3-18 · What turns up 18-28 · The bad weeks 28-45 · Build-along and Q&A
Part 0

A number that was true, and did not arrive

The solver was asked for the best plan given demand, and it was given one demand figure per product: the average. It answered that question perfectly. What it was never asked, and never claimed to answer, is what happens in a week where Dairy comes in eleven tonnes light or Standard comes in six tonnes heavy. Both of those weeks are ordinary. Tonight puts the plan in them and reads the till.

Live = presented in the 45 minutes Self-study = the full depth, after class 🔍 Every diagram zooms

★ What you walk out with tonight. The habit of hearing "the model says 4,656" as a statement about what went into the model rather than a forecast of the bank balance. Ravensworth's own measured gap, 325 to 338 a week, stable across five independent runs so it cannot be waved away as one unlucky simulation. And the two numbers you should be asking for instead of the headline: how often the plan actually works, and what the bad weeks look like.

LiveWhat the optimiser was actually asked4 min▶

An optimiser answers the question it was given, exactly and without commentary. The question it was given at Ravensworth contained a single number for each product's demand, and that number was the average. There is nothing careless about that choice, it is the standard way to write the problem down, and the plan that comes back is genuinely the best plan for those inputs.

The trouble is what "those inputs" describe. A week in which Standard demand is exactly 33 tonnes and Dairy demand is exactly 63 tonnes is not a typical week. It is a week that essentially never happens. The plan is optimal for it anyway, because that is the week it was handed.

Real world

Ravensworth's demand is not a mystery. Standard runs around 33 tonnes with a spread of about 6, Dairy around 63 with a spread of about 11. Those spreads were known before the plan was computed and they were not in the problem, because the problem had one box per product and only one number fits in a box.

Self-studyThe words tonight adds4 min▶
  • Deterministic plan. One computed from single fixed numbers, with no spread anywhere in it. Ravensworth's 33 / 63 / 0 is one.
  • Simulation over a plan. Draw uncertain demand many times, run the same fixed plan against every draw, and record what it earned. Ten thousand draws here.
  • Seed. The starting point of the random draws. Change it and you get a different ten thousand weeks, which is how you check the answer is not an accident.
  • Mean profit. The average of those ten thousand weeks. Ravensworth: 4,318 to 4,331.
  • Median. The middle week. Half of them are worse.
  • 5th percentile. The line one week in twenty falls below. Ravensworth: roughly 3,540 to 3,591.
  • Shortfall. The gap between what a deterministic plan promises and what it delivers on average. Here 325 to 338.
  • Sampling a posterior. A different technique with a similar name, belonging to the Bayesian course. Nothing tonight is walking a posterior; tonight draws inputs and re-runs a plan.
Part 1 · covers the measured gap

4,656.00 promised, 4,318 to 4,331 delivered

15 min live

The plan does not change tonight. The same 33 tonnes of Standard and 63 of Dairy go out, and the mill runs exactly what the solver said. All that changes is that demand is allowed to behave like demand: Standard around 33 with a spread of 6, Dairy around 63 with a spread of 11, ten thousand draws, and then the whole thing repeated from five different starting points so nobody can blame the result on one bad run.

The promise, and five measurements of what actually turns up What the deterministic plan promises Plan 33 Standard, 63 Dairy, 0 Show. Solved with demand set to a single average figure per product. PROMISED 4,656.00 What it delivers: Standard mean 33 sd 6, Dairy mean 63 sd 11, 10,000 draws for each seed SEED SELLS OUT MEAN PROFIT 5TH PERCENTILE MEDIAN 7 25.1% 4,317.94 3,539.75 4,440.26 101 25.6% 4,327.93 3,571.12 4,451.73 2024 24.7% 4,330.55 3,590.76 4,446.08 55555 24.8% 4,328.35 3,559.39 4,448.79 987654 24.4% 4,323.93 3,562.75 4,448.95 ACROSS FIVE SEEDS about a quarter 4,318 to 4,331 3,540 to 3,591 A shortfall of 325 to 338, and the optimiser did nothing wrong The plan is the best plan for the week it was given, and the week it was given is one where demand arrives at its average. Real weeks do not do that. The 4,656.00 describes the inputs, not the bank balance. Five seeds, 10,000 draws each. The answer barely moves between them, so it is not one unlucky simulation.
🔍 Click to zoom - five independent runs, and every one of them lands in the same place.
LiveWhy an optimal plan loses money to uncertainty4 min▶

The mill commits to 33 tonnes of Standard before it knows what the week will ask for. In a week where Standard demand comes in at 28, five of those tonnes earn nothing this week. In a week where it comes in at 38, the mill sells all 33 and no more, because 33 is what it made. The upside is capped by the plan and the downside is not, so averaging across many weeks lands below the figure computed at the average.

That asymmetry is the whole mechanism and it is worth saying slowly, because it is not a modelling error and it does not go away with a better forecast. A fixed quantity committed before uncertain demand pays for every light week and is not compensated by the heavy ones.

LiveWhat "sells out" is counting3 min▶

About a quarter, in every one of the five runs. Precisely, it counts the weeks in which demand took every tonne the plan made, for both products at once. Three weeks in four, at least one product was made in a quantity the week did not want.

Say that figure out loud next to the plan and notice how differently the plan sounds. "The optimal plan, worth 4,656" and "the optimal plan, which works as intended about one week in four" are descriptions of the same object, and only one of them prompts the next question.

Self-studyWhy five seeds and not one4 min▶

A single simulation run produces a number, and a number invites the reply that you got a bad draw. Five runs from five different starting points, ten thousand weeks each, produce five numbers that can be compared with each other. Here they land at 4,317.94, 4,327.93, 4,330.55, 4,328.35 and 4,323.93. The spread between the runs is a few pounds. The gap to the promise is over three hundred.

That contrast is the argument, and it is stronger than any single run could be. The measurement noise and the effect being measured are two orders of magnitude apart, so the finding survives the obvious objection without anybody having to defend a particular seed.

Part 2 · covers the percentiles

The mean is the wrong number to hand a decision maker

10 min live

Suppose the shortfall were fixed, and somebody reported 4,318 instead of 4,656. It would be honest and it would still be the wrong number to plan around, because nobody runs an average week. What a person signing off a plan needs is the shape: how often it works, what the middle week looks like, and how bad one week in twenty gets. At Ravensworth the middle week is around 4,440 and the bad week is around 3,540, and those two facts do more work than the mean ever will.

Seed 7 in full: four places the week can be described, on one axis PROMISED 4,656.00 5TH PERCENTILE 3,539.75 one week in twenty is worse MEAN PROFIT 4,317.94 average of 10,000 weeks MEDIAN 4,440.26 the middle week, half are worse PROMISED BY THE PLAN 4,656.00 demand fixed at its average THE SHORTFALL 3,400 3,600 3,800 4,000 4,200 4,400 4,600 profit for the week, pounds Sells out: about a quarter of the weeks Seed 7 gives 25.1%, and the other four give 25.6, 24.7, 24.8 and 24.4. In the rest, at least one product was made in a quantity the week did not want. The sentence to carry out of tonight "The model says 4,656" is a statement about the model's inputs. It is not a forecast of the bank balance.
🔍 Click to zoom - the mean sits far to the right of the bad weeks, and the bad weeks are what get discussed in January.
Live The real solver and the real simulation, running in this page. Change the plan and watch the mean and the bad week move apart.

...

...
LiveThree numbers instead of one4 min▶

Replace the single figure with three and the conversation changes without anyone needing to understand a solver. How often does this plan do what it was designed to do. What does the middle week earn. What does one week in twenty look like. Those are answerable, they are answerable by simulation over a plan you already have, and none of them requires a new model.

The third one is usually the one that matters, because it is the only one that speaks to whether a bad week is survivable. A business with covenants, seasonal cash or a thin buffer is not indifferent between a plan that earns 4,440 in the middle and dips to 3,540 one week in twenty, and a steadier plan earning slightly less. The mean cannot tell those two apart, which is precisely why it is the number that gets reported.

LiveTry a plan the optimiser would never pick3 min▶

In the box above, take Dairy down a few tonnes from 63 and leave Standard where it is. The deterministic margin falls immediately, by exactly what you would expect. Watch what happens to the 5th percentile and to how often the plan sells out, and try a few combinations before drawing a conclusion.

Whatever you find, notice the shape of the exercise: you are now trading a promised figure against a downside figure, by hand, because the problem as written contained no way to express that preference. That is not a failing of the mill or of the solver. It is a consequence of a problem statement with one number per product in it.

Self-studyWhere serious people disagree5 min▶

Nobody argues with the measurement. There is a live argument about what to plan for.

One camp plans for the mean and means it. Over a year the mill runs fifty-odd weeks, the good ones and the bad ones both turn up, and what accumulates is the average. Hedging every single week to protect a 5th percentile costs margin in all fifty-odd of them, most of which were never going to be bad weeks. On this view, protecting against the bad week is an expensive insurance premium paid continuously against an event that is survivable, and the discipline is to hold your nerve and let the averages arrive.

The other camp says the business does not experience the average, it experiences weeks, and weeks are where things break. A run of three bad ones in a quarter can breach a covenant, empty a cash buffer or cost a customer, and none of those are repaid by a good August. On this view the mean is the right number only for a business with enough balance sheet to be indifferent to sequence, which is most textbook firms and not many real ones, and the 5th percentile is the number that should sit next to the plan.

The honest position is that the answer depends on facts that are not in the model: how much buffer exists, whether bad weeks cluster, and what a bad week actually breaks. Notice that neither camp is arguing about the simulation. They are arguing about what the organisation can absorb, which is a question for the people in the room and not for the solver.

Part 3 · build-along

Take the promise apart

17 min hands on

No code. Six steps using the live box and the five-seed table. The aim is to leave unable to repeat a single figure from a model without asking what was held fixed to produce it.

Reproduce the table

Leave the plan at 33 and 63, and step the seed through all five. Check each mean against the row in the diagram. Satisfy yourself the five runs agree with each other to a few pounds while all of them miss the promise by over three hundred.

Say the gap out loud as money

325 to 338 a week. Multiply it by the number of weeks your own planning cycle covers and say the figure in the room. Then say what would have happened if the board pack had carried 4,656 and nothing else.

Find the week in twenty

Read the 5th percentile for the plan as it stands. Then ask the room a specific question: if that week arrived three times in a quarter, what in your own operation would break first. Payroll, a covenant, a customer, nothing at all. The answer decides which camp you are in.

Buy downside with upside

Change the plan and hunt for one that gives up deterministic margin and improves the 5th percentile. Try a few. Write down what you gave up and what you bought, and say whether the trade is one you would sign.

Write the honest one-liner

Rewrite "the optimal plan is worth 4,656" as one sentence a board would understand, containing the promise, how often the plan works, and the bad week. Keep it to one sentence. If it needs two, the first one is doing something wrong.

Name what the problem statement could not say

The spread of demand was known before the plan was computed and it was not in the problem. In one sentence, say what else your own planning problems are known to leave out. Session 5 asks whether optimisation was the right tool at all.

The habit to keep. When a model produces a single headline figure, ask what was held fixed to produce it. Averages are the usual answer, and a plan optimal at the average is optimal for a week that does not occur. The follow-up is always the same three: how often does this work, what is the middle case, what is the bad case.

Check yourself

Three questions

The plan promises 4,656.00 and delivers a mean of 4,318 to 4,331 against uncertain demand. What went wrong?

The arithmetic is correct and the plan is genuinely optimal for the problem it was handed. The gap comes from the problem statement holding demand fixed at its average, and from the asymmetry of committing a quantity before demand is known.

Why is the result reported across five seeds rather than one run?

The point of the repeat is the contrast between the two scales. Run-to-run variation is a few pounds; the shortfall is 325 to 338. Measurement noise and the effect being measured are far apart, so the finding survives the obvious objection.

A colleague proposes reporting 4,318 instead of 4,656, on the grounds that it is the honest number. What is still missing?

Correcting the mean makes the number honest and leaves it the wrong number to plan around. A decision maker needs the percentiles, because those are what say whether a bad week is survivable, and whether a bad week is survivable is not a question the mean can answer.

Before session 5

Homework

Twenty minutes, on a single figure your own organisation repeats.

Find the number that gets repeated

One headline figure from a model that appears in a pack, a target or a business case. Write down every input that was held at a single value to produce it, and mark the ones that are genuinely known to vary. That list is the honest caveat, and it almost never travels with the figure.

Bring your one-liner

The rewritten sentence from step 5 of the build-along, with the promise, the hit rate and the bad week in it. Session 5 steps back and asks when optimisation is the right tool at all, and when a forecast on its own would have been the better answer.

Covered tonight

What this session covers

✓The deterministic promise33 Standard, 63 Dairy, no Show, worth 4,656.00 at average demand.
✓Simulation over a planStandard mean 33 sd 6, Dairy mean 63 sd 11, 10,000 draws, five seeds.
✓The measured shortfallMean profit 4,318 to 4,331, a shortfall of 325 to 338 against the promise.
✓How often the plan worksSells out about a quarter of the time, in all five runs.
✓Percentiles over the meanThe 5th percentile at roughly 3,540 to 3,591, and why it outranks the average.
✓Why five seedsRun-to-run spread of a few pounds against a gap of over three hundred.
◐Planning for a distributionNamed tonight as the alternative to a single-figure problem. Outlined in the practitioner track.
◐Hedging a plan by handDone in the live box tonight, as a trade rather than a method.
○Building or judging the demand forecastModel choice and evaluation belong to the prediction courses.
○Sampling a posteriorSimilar name, different technique. That is MCMC, and it lives in the Bayesian course.
○Whether optimisation was the right toolSession 5 asks that question directly, and does not assume the answer.
Take this with you

Cheat sheet

The one sentence. "The model says 4,656" is a statement about the model's inputs, not a forecast of the bank balance.
The promise. 33 Standard, 63 Dairy, no Show, 4,656.00 with demand fixed at its average.
The delivery. Mean profit 4,318 to 4,331 across five seeds of 10,000 draws.
The gap. A shortfall of 325 to 338 a week, and nothing in the optimiser was wrong.
The hit rate. The plan sells out about a quarter of the time.
The bad week. The 5th percentile sits at roughly 3,540 to 3,591.
Why the loss happens. A quantity committed before demand is capped on the upside and open on the downside.
Ask for three, not one. How often it works, the middle week, the bad week.