Apply the methodLesson 33 of 76 · 8 min

Enough food without too much waste

Compare shortage and waste under the same simulated attendance outcomes.

Catering is a decision problem because both preparing too little and preparing too much have consequences. A demand forecast alone cannot choose a food quantity without an objective or service constraint.

Use the same simulated attendance for every preparation option. Each trial has a shortage count and a waste count. Weighting them by stated penalties gives a loss measured in a common unit. Those penalties are decision assumptions, not properties of the random generator. For one event, shortage is attendance above the prepared meals, floored at zero. Waste reverses that difference; neither count can be negative.

The lowest expected loss can differ from the option with the smallest shortage probability. Report both if service quality matters. Reusing the same events for all options makes their comparison more precise without asserting that the events are real observations.

(x)+(x)_+ means max(x,0), the positive part. AiA_i is attendance in event i, m is prepared meals, and L is the resulting penalty in pounds.

A policy changes shortage and waste
  1. Use the same attendance
    AiA_i
  2. Apply each meal choice
    shortage=(Ai−m)+\text{shortage}=(A_i-m)_+
  3. Count both consequences
    L=12(Ai−m)++3(m−Ai)+\begin{gathered}L=12(A_i-m)_+\\+3(m-A_i)_+\end{gathered}
Reference illustration. The authored penalty rates are pounds per meal. Reusing attendance across policies preserves a matched comparison. A lowest expected loss depends on those chosen consequences.

Will the preparation quantity with the lowest shortage probability necessarily minimise expected loss?

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 ↗

 meals  P_shortage  expected_loss
   100       0.915         98.582
   110       0.324         25.922
   120       0.010         36.424

Read the first result

The attendance draws stay identical across options. Only the policy and the resulting loss calculation change.

Try an edit

Replace loss = 12*shortage + 3*waste with loss = 30*shortage + 3*waste. Select Run Python again. Compare the meals option with the smallest expected_loss. Do the P_shortage values change even though the loss ranking might change?

Back to the Python editor

Scope. Shortage and waste penalties are invented. Dietary constraints, food safety and logistics are outside this model.

Try a fresh case

Why compare all preparation options using the same attendance draws?

Choose an answer
Need a hint?
Hint 1

Separate variation in demand from variation caused by changing an option.

Hint 2

Compare both options within one possible event.

Your notes