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.
means max(x,0), the positive part. is attendance in event i, m is prepared meals, and L is the resulting penalty in pounds.
- Use the same attendance
- Apply each meal choice
- Count both 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.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
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?
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?
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.