ANLAnalytics & AIStop 3 of 6
Simulation & Monte Carlo
Testing a decision against thousands of possible futures, and how simulation complements optimization.
Read atChange any time
Some questions don’t have a neat formula. “If demand varies, suppliers are sometimes late and a machine breaks down now and then, how often will we run out?” Simulation answers by playing out the system many times on a computer.
Monte Carlo simulation draws random values for every uncertain input, runs the model once, records the result, and repeats thousands of times. For a warehouse item, each run might draw a month of daily demand and a random lead time for each delivery, then count stockout days. After 10,000 runs you don’t get one answer, you get a distribution: “a stockout in about 6% of months, and in the worst 1% of months we lose more than 300 units.”
The safety stock lab on this site does a small version of this: switch it to real-life mode, replay a few times, and watch how often the buffer is used up.
Discrete-event simulation models how things flow through a system over time, such as trucks arriving at a dock, orders queuing at packing stations, or containers waiting at a port. It’s the tool for questions like “will two more dock doors clear the morning queue?”
Simulation and optimization work best together:
- Optimization finds the best decision under given assumptions.
- Simulation tests how that decision behaves when reality is random.
A network plan that looks optimal on average can fail badly in a bad week; simulation shows that before you commit.
Words to use
- Monte Carlo simulation
- Repeating a model with random inputs many times to estimate the distribution of outcomes.
- Discrete-event simulation
- Modelling a system as events over time, such as arrivals, queues and processing.
- Replication
- One run of a simulation; many replications give a reliable picture.
Monte Carlo for a lumpy item
Daily demand: 0 units on 60% of days, 5 units on 30%, and 20 units on 10%. Lead time: 4, 5 or 6 days, equally likely. What reorder point covers 95% of lead times?
- Simulate 100,000 lead times: draw a lead time, draw each day’s demand, add them up.
- Average lead-time demand: 17.5 units (3.5 a day × 5 days).
- 95th percentile from the simulation: 45 units. 99th: 55.
- The normal approximation, using the same mean and standard deviation, gives 17.5 + 1.645 × 13.6 ≈ 40.
The normal formula would set the reorder point about 5 units too low, because lumpy demand has a long right tail the normal curve doesn’t capture.
A dock with two doors
Trucks arrive at random, on average every 30 minutes, and unloading takes 50 minutes on average, also random. With 2 doors, the doors are busy 83% of the time. Queueing formulas for this simple case give:
| Doors | Utilization | Chance a truck waits | Average wait |
|---|---|---|---|
| 2 | 83% | 76% | about 114 minutes |
| 3 | 56% | 30% | about 11 minutes |
A third door cuts the average wait tenfold. Real docks add appointment schedules, different truck types and unloading crews, which formulas can’t handle but a discrete-event simulation can, and the simple case is a useful check that the simulation behaves correctly.
Steps of a sound study
- Define the question and the measures (stockout rate, waiting time, cost).
- Build the model logic at the level of detail the question needs.
- Fit input distributions from data, not averages.
- Verify (the model does what you intended) and validate (it reproduces reality).
- Discard the warm-up period for steady-state questions.
- Run enough replications and report results with confidence intervals; precision improves with the square root of the number of runs.
- Compare alternatives using the same random numbers for each, so differences come from the decision, not from luck.
Four kinds of simulation
| Type | Models | Typical supply chain use |
|---|---|---|
| Monte Carlo | Random inputs to a static calculation | Lead-time demand, project risk, financial outcomes |
| Discrete-event | Entities flowing through processes over time | Warehouses, docks, factories, ports |
| System dynamics | Stocks, flows and feedback loops at an aggregate level | Bullwhip, capacity investment cycles, policy effects |
| Agent-based | Many individual decision makers interacting | Consumer adoption, carrier behaviour, disruption spread |
Forrester’s system dynamics (1961) produced one of the earliest explanations of the bullwhip effect, and Sterman’s (2000) textbook remains the standard reference for the method.
The flaw of averages
Plans built on average inputs are wrong on average. Savage’s “flaw of averages” (2009) gives many examples: average demand fed into a capacity plan hides the weeks when demand exceeds capacity and sales are lost, so the average outcome is worse than the outcome of the average. Simulation replaces single numbers with distributions and shows the true average and the spread.
Comparing alternatives efficiently
- Common random numbers: run each alternative with the same sequence of random demand, delays and failures, so the comparison isn’t blurred by different luck.
- Antithetic variates and other variance-reduction methods reach the same precision with fewer runs.
- Enough replications: report differences between alternatives with confidence intervals, not single runs.
Simulation-optimization
When there are many possible decisions (reorder points for hundreds of items, numbers of doors and staff), search methods can drive the simulation: try settings, simulate, keep the better ones, repeat. It is slower than pure optimization but handles randomness and complexity that formulas can’t.
Animation is not validation
Watching trucks move on screen builds confidence, sometimes too much. Validation means comparing the model’s outputs (throughput, waiting times, stock levels) with real historical performance, and checking extreme cases behave sensibly (zero demand means zero shipments; double the arrivals and queues grow).
Interview kit
Practise it out loud
Answer each question yourself before opening the model answer.
Simulation models uncertainty by running a system many times with random inputs. Monte Carlo gives the distribution of outcomes, such as stockout probability or worst-case cost, and discrete-event simulation models queues and flows over time. I’d use optimization to choose a plan and simulation to stress-test it, because a plan that’s optimal on average can perform badly when demand, lead times or failures vary.
What is the difference between optimization and simulation?
Optimization searches for the best decision given the model’s assumptions. Simulation evaluates how a given decision performs across many random futures. Optimization says what to do; simulation says how likely it is to work.
How would you use Monte Carlo to set safety stock for a lumpy item?
Fit distributions to its demand and lead time, or resample actual history, simulate thousands of replenishment cycles for several candidate stock levels, and pick the lowest level that meets the service target with acceptable worst-case risk. It avoids assuming normal demand.
Connected stops
Where this idea feeds in, or gets its inputs from.
Sources and further reading
- Law, A. M. Simulation Modeling and Analysis. McGraw-Hill.
- Hopp, W. J. & Spearman, M. L. Factory Physics. Waveland Press.
- Savage, S. L. (2009). The Flaw of Averages: Why We Underestimate Risk in the Face of Uncertainty. Wiley.
- Sterman, J. D. (2000). Business Dynamics: Systems Thinking and Modeling for a Complex World. McGraw-Hill.