Turn results into decisionsLesson 50 of 76 · 8 min

Compare feasible options

Evaluate all choices under matched simulated conditions and explicit constraints.

A low expected loss does not automatically make an option feasible. A decision can include a service requirement, a spending limit or a physical bound in addition to an optimisation objective.

The code compares stock levels using the same simulated demand draws. A shortage occurs when demand exceeds stock. The example sets the shortage limit to 0.10 (10%). Of the tested levels at or below the limit, the code chooses the one with the lowest expected loss under the stated penalties.

A simulation estimate close to a constraint boundary has numerical uncertainty. Treat feasibility as unresolved when that uncertainty could reverse the decision, and do not turn an estimated probability into a guarantee. Model uncertainty can be larger still, especially when the future demand distribution was assumed.

Feasible means meeting the declared requirements. A point estimate is a single numerical estimate. Here feasibility uses each stock level’s estimated shortage probability.

Apply the constraint before ranking
  1. Evaluate matched worlds
    E^[Ls]\widehat E[L_s]
  2. Identify feasible choices
    P^(D>s)≤0.1\widehat P(D>s)\le0.1
  3. Rank feasible choices
    arg⁡min⁡s  feasibleE^[Ls]\arg\min_{s\;\text{feasible}}\widehat E[L_s]
Reference illustration. The source uses a point-estimate feasibility rule. An estimate just below the limit is not a statistical guarantee that the true model risk meets it; numerical error may need a margin.

Should an option with lower mean loss be accepted if it violates the declared service requirement?

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 ↗

Shortage probability limit: 0.1
 stock  expected_loss  shortage_probability  meets_point_estimate_rule
    25        24.0859                0.4471                      False
    28        16.5859                0.2411                      False
    32        16.5711                0.0721                       True
    36        22.4211                0.0145                       True
Best feasible point-estimate choice: 32

Read the first result

Find shortage_probability and meets_point_estimate_rule in the table. Which stock levels meet the 10% limit, and which of those has the smallest estimated loss?

Try an edit

Replace max_shortage_probability = 0.10 with max_shortage_probability = 0.02. Select Run Python again. Which tested stock levels still have True in meets_point_estimate_rule? Then set the limit to 0.005 (0.5%) and select Run Python. Does any tested level meet the new limit?

Back to the Python editor

Scope. The procedure compares a finite candidate list and uses estimated probabilities. It is not a proof of global optimality or guaranteed service.

Try a fresh case

A parcel service tests three delivery schedules. All three have an estimated late-delivery probability above the service limit. What should the report say?

Choose an answer
Need a hint?
Hint 1

Apply the declared constraints before ranking feasible options.

Hint 2

Retain evidence when every candidate fails.

Your notes