Turn results into decisionsLesson 49 of 76 · 7 min

Define what a bad outcome costs

Translate an objective into a loss calculation with interpretable units.

A simulation produces possible outcomes; a decision also needs an objective. A loss function converts an outcome and action into a consequence measured on a stated scale. It makes trade-offs explicit rather than leaving the choice to whichever summary looks favourable.

For a shop’s one-period stocking decision, shortage and leftover stock have different penalties. The same demand outcome can give a different loss under each stock choice. Those penalties express assumptions about consequences and priorities.

Expected loss averages over the modelled demand distribution. It is not necessarily the right objective for every decision: hard service constraints, risk aversion or consequences not captured in money may matter. Keep the probability model and the preference model separately reviewable.

Name both sides of the loss
  1. Unmet demand
    (D−S)+(D-S)_+
  2. Unused stock
    (S−D)+(S-D)_+
  3. Authored loss
    L=10(D−S)++2(S−D)+\begin{gathered}L=10(D-S)_+\\+2(S-D)_+\end{gathered}
Reference illustration. The two penalty coefficients are decision inputs, not measured constants. Expected loss and shortage probability answer different questions under the same model.

Can changing a shortage penalty change the preferred stock level without changing demand?

Write a prediction (optional)

Seeded teaching simulation

Select Run Python below with the code unchanged.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

Published example output

This result comes from the original Python. Your runs appear above. Build environment ↗

 stock  expected_loss  P_shortage
    20         54.723       0.814
    25         23.992       0.453
    30         15.297       0.139
    35         20.591       0.022

Read the first result

A preference change can change the decision while every demand draw stays fixed. That is not a contradiction in the simulation.

Try an edit

Replace loss = 10*shortage + 2*leftover with loss = 3*shortage + 2*leftover. Select Run Python again. Which stock has the smallest expected_loss now? Check whether P_shortage changes when only the penalty changes.

Back to the Python editor

Scope. The illustrative loss omits reputational effects, substitution and multi-period customer behaviour.

Try a fresh case

What does a penalty of £10 per unmet unit represent?

Choose an answer
Need a hint?
Hint 1

Separate how often something happens from how much it matters.

Hint 2

Name the unit of the loss.

Your notes