The Central Idea
A simulation does not try to predict one exact future.
Instead, it asks:
\[ \boxed{\text{what outcomes are possible, and how often do they occur under the model?}} \]Data-driven decision-making then asks:
\[ \boxed{\text{which action performs best across those possible outcomes?}} \]The process combines:
- data;
- probability models;
- algorithms;
- simulation;
- objectives;
- constraints;
- uncertainty analysis.
What Is a Simulation?
A simulation is a computational or mathematical procedure that imitates the behavior of a system.
A simulation may represent:
- customers arriving at a queue;
- inventory demand;
- population growth;
- investment returns;
- component failures;
- disease transmission;
- traffic flow;
- project schedules.
Why Simulate?
Simulation is especially useful when:
- closed-form formulas are unavailable;
- the system contains many interacting random variables;
- rare events matter;
- real-world experiments are costly or dangerous;
- policies must be compared before implementation;
- the full outcome distribution matters more than one average.
Deterministic and Stochastic Simulation
A deterministic simulation produces the same output from the same inputs.
A stochastic simulation includes random variables, so repeated runs can produce different outcomes.
Most Monte Carlo methods are stochastic.
Monte Carlo Simulation
Monte Carlo simulation uses repeated random sampling to approximate the distribution of a quantity of interest.
A typical workflow is:
- specify a probability model;
- generate random inputs;
- calculate one outcome;
- repeat many times;
- summarize the resulting distribution.
A First Monte Carlo Example
Suppose a project succeeds with probability
\[ p=0.70. \]One simulated project can be generated by drawing a random number \(U\) uniformly from \([0,1]\).
Define:
\[ \text{success if }U<0.70, \]otherwise failure.
Repeating this experiment many times estimates the success rate.
Uniform Random Numbers
A uniform random number
\[ U\sim\operatorname{Uniform}(0,1) \]is a basic building block for simulation.
If
\[ P(X=x_i)=p_i, \]intervals of lengths \(p_i\) can be assigned on \([0,1]\) to generate discrete outcomes.
Simulating a Discrete Distribution
Suppose
\[ P(X=0)=0.2, \qquad P(X=1)=0.5, \qquad P(X=2)=0.3. \]Use a uniform random number \(U\):
- if \(0\le U<0.2\), set \(X=0\);
- if \(0.2\le U<0.7\), set \(X=1\);
- if \(0.7\le U\le1\), set \(X=2\).
Pseudorandom Numbers
Computers usually generate pseudorandom numbers using deterministic algorithms designed to behave statistically like random sequences.
A simulation can therefore be repeatable if the same random seed is used.
Random Seeds
A random seed initializes a pseudorandom number generator.
Using the same:
- model;
- algorithm;
- seed
should reproduce the same simulated random sequence in a deterministic software environment.
Reproducibility
Reproducibility is important because analysts should be able to verify how a simulated result was produced.
A reproducible simulation records:
- the model;
- parameter values;
- random seeds;
- software version;
- number of runs;
- summary procedures.
Simulation Runs
One complete execution of a stochastic simulation is often called a run, trial, or replication.
If the simulation is repeated \(n\) times, the resulting outputs are
\[ X_1,X_2,\ldots,X_n. \]Monte Carlo Estimate of a Mean
The simulated mean is
\[ \boxed{ \bar X_n = \frac{1}{n} \sum_{i=1}^{n}X_i }. \]Under appropriate conditions,
\[ \bar X_n \to E[X] \]as the number of simulation runs grows.
Monte Carlo Standard Error
If simulated outputs are approximately independent with standard deviation \(\sigma\), then the standard error of the simulated mean is approximately
\[ \boxed{ \frac{\sigma}{\sqrt n} }. \]In practice, \(\sigma\) is estimated from the simulated outputs.
More Runs Improve Precision Slowly
Monte Carlo error decreases at the familiar square-root rate:
\[ \boxed{ \text{error scale}\propto\frac{1}{\sqrt n} }. \]Therefore, reducing Monte Carlo standard error by half generally requires about four times as many independent runs.
Estimating a Probability by Simulation
Suppose event \(A\) occurs in \(k\) of \(n\) simulation runs.
Then the simulated probability estimate is
\[ \boxed{ \hat p=\frac{k}{n} }. \]Probability-Estimation Example
Suppose a simulated system fails in
\[ 37 \]of
\[ 1000 \]runs.
Then
\[ \hat p = \frac{37}{1000} = \boxed{0.037}. \]Rare Events
Rare-event simulation is difficult because ordinary random sampling may produce very few relevant events.
If a failure probability is approximately
\[ 10^{-6}, \]then one million ordinary runs may produce only about one failure on average.
Specialized variance-reduction or rare-event methods may be needed.
Event-Driven Simulation
Many systems change only when discrete events occur.
Examples include:
- customer arrival;
- service completion;
- machine failure;
- inventory replenishment;
- job completion.
In an event-driven simulation, the clock jumps from event to event.
Time-Step Simulation
Another approach advances the model through fixed time increments:
\[ t=0,\Delta t,2\Delta t,3\Delta t,\ldots \]At each step, the state is updated.
Time-step methods are simple but may perform unnecessary work when events are sparse.
State Variables
A simulation state contains the information needed to continue the system forward.
Examples include:
- current inventory;
- number in queue;
- machine condition;
- current population;
- available cash;
- current network status.
State Transition
A simulation repeatedly applies a state-transition rule:
\[ \boxed{ S_{t+1}=F(S_t,U_t) }. \]Here:
- \(S_t\) is the current state;
- \(U_t\) represents random input;
- \(F\) is the update rule.
Scenario Generation
A scenario is one internally consistent realization of uncertain inputs.
A scenario may include:
- demand;
- prices;
- arrival times;
- failure events;
- weather;
- customer behavior.
Decisions can be tested across many scenarios.
Independent Scenario Inputs
If uncertain variables are modeled independently, they can be sampled separately.
But this is appropriate only when independence is a reasonable assumption.
Correlated Inputs
Many uncertain inputs move together.
Examples include:
- temperature and electricity demand;
- market returns across assets;
- regional insurance losses;
- traffic on nearby routes.
A simulation that destroys real dependence can seriously misstate risk.
Empirical Resampling
Simulation inputs do not always need a named probability distribution.
Historical observations can sometimes be resampled directly.
This preserves aspects of the empirical distribution but assumes the historical sample is relevant to future conditions.
The Bootstrap
A bootstrap sample is created by sampling observed data with replacement.
Repeating this process approximates the sampling distribution of a statistic.
Bootstrap methods are especially useful when analytic standard-error formulas are difficult.
Bootstrap Example
Suppose the observed data are
\[ 4,\ 7,\ 9,\ 10. \]One bootstrap sample of size \(4\) might be
\[ 7,\ 7,\ 4,\ 10. \]Another might be
\[ 9,\ 10,\ 10,\ 4. \]Each resample uses replacement.
Simulation and Optimization
Simulation evaluates a decision.
Optimization searches for a good decision.
Together they support
\[ \boxed{\text{simulation optimization}}. \]A decision variable \(x\) may be tested across simulated scenarios to estimate
\[ E[C(x)] \]or another performance measure.
Decision Variables
Decision variables represent choices under the decision maker's control.
Examples include:
- inventory order quantity;
- number of servers;
- staffing level;
- portfolio allocation;
- maintenance interval;
- routing rule.
Objectives
A decision model requires an objective.
Examples include minimizing:
- cost;
- waiting time;
- risk;
- failure probability;
or maximizing:
- profit;
- service level;
- reliability;
- expected utility.
Constraints
A mathematically attractive decision may be infeasible.
Constraints can represent:
- budget;
- capacity;
- staffing;
- time;
- policy limits;
- minimum service levels.
Decisions should be compared only within the feasible set.
Expected-Cost Decision Rule
A simple risk-neutral decision rule chooses
\[ \boxed{ x^\ast = \arg\min_x E[C(x)] }. \]This minimizes expected cost.
Other decision makers may prefer objectives that also penalize variability or severe tail outcomes.
Risk-Aware Decision Rules
A risk-aware objective might combine mean and variability:
\[ \boxed{ \text{score}(x) = E[C(x)] + \lambda\operatorname{SD}(C(x)) }. \]Here \(\lambda\ge0\) controls how strongly variability is penalized.
This is only one possible risk-aware formulation.
Chance Constraints
A chance constraint requires a condition to hold with high probability.
For example,
\[ \boxed{ P(\text{service level}\ge s_0)\ge0.95 }. \]This is useful when occasional violation is acceptable but frequent violation is not.
Robust Decisions
A robust decision performs reasonably well across a range of plausible assumptions or scenarios.
Robustness is valuable when the exact probability model is uncertain.
Scenario Comparison
Suppose two policies have simulated costs:
| Policy | Mean Cost | Standard Deviation | 95th Percentile Cost |
|---|---|---|---|
| A | \(\$100\) | \(\$10\) | \(\$118\) |
| B | \(\$95\) | \(\$30\) | \(\$160\) |
B has lower average cost but much greater variability and tail cost.
The preferred policy depends on the decision objective.
Sensitivity Analysis
Sensitivity analysis changes model inputs to see how strongly results depend on them.
Questions include:
- What happens if demand is \(10\%\) higher?
- What happens if failure probability doubles?
- What happens if service times are more variable?
- What happens if costs change?
One-Way Sensitivity Analysis
A one-way sensitivity analysis changes one parameter while holding others fixed.
This isolates the local influence of that parameter.
Multiway Sensitivity Analysis
Several parameters can also be varied together.
This is important when uncertainty comes from interacting assumptions.
Stress Testing
Stress testing evaluates performance under deliberately adverse conditions.
Examples include:
- extreme demand;
- multiple simultaneous failures;
- large price shocks;
- long service delays;
- rare catastrophic losses.
Model Validation
A simulation is useful only if it represents the real system well enough for the decision being studied.
Validation asks whether the model's behavior is consistent with relevant real-world evidence.
Verification Versus Validation
Verification asks:
Did we build the model correctly?
Validation asks:
Did we build an appropriate model of the real system?
A program can be correctly coded but still model the wrong thing.
Verification Checks
Useful verification checks include:
- testing simple cases with known answers;
- checking conservation relationships;
- checking probability totals;
- testing extreme parameter values;
- reviewing event order;
- reproducing results with a fixed seed.
Validation Checks
Useful validation checks include:
- comparing simulated distributions with observed data;
- checking average behavior;
- checking variability;
- checking tail frequencies;
- reviewing the model with subject-matter experts;
- testing predictions on new data.
Calibration
A model is well calibrated when its probabilistic predictions match observed frequencies over comparable cases.
If events assigned probability \(0.20\) occur about \(20\%\) of the time, that is evidence of calibration at that level.
Out-of-Sample Evaluation
A model should be evaluated on data not used to fit it.
Strong in-sample performance can result from overfitting.
Out-of-sample testing provides a better estimate of how well the model may generalize.
Decision Tables from Simulation
Simulated outcomes can be summarized in a decision table.
| Decision | Mean Outcome | Failure Probability | Worst-Decile Outcome |
|---|---|---|---|
| A | 120 | 0.02 | 85 |
| B | 125 | 0.08 | 60 |
| C | 118 | 0.01 | 90 |
No single column necessarily determines the decision.
Data-Driven Does Not Mean Data-Only
Data inform decisions, but decisions also depend on:
- goals;
- constraints;
- values;
- costs;
- risk tolerance;
- causal assumptions;
- model limitations.
Data do not select an objective function automatically.
Prediction and Decision Are Different
A predictive model estimates what may happen.
A decision model chooses what to do.
A highly accurate prediction does not automatically determine the best action unless the costs and benefits of possible actions are defined.
Correlation and Decision-Making
A predictive association can be useful without being causal.
But when a decision changes the predictor itself, causal reasoning becomes essential.
Acting on a correlation can fail if the relationship disappears under intervention.
Feedback Loops
Decisions can change the data-generating process.
Examples include:
- pricing algorithms changing customer behavior;
- traffic routing changing congestion;
- screening policies changing observed case rates;
- inventory policies changing stockout patterns.
Data-driven systems may therefore contain feedback loops.
Sequential Decisions
Many decisions are not made once.
Data arrive over time, and the policy can be updated.
A sequential decision rule may have the form
\[ \boxed{ a_t=\pi(S_t) }. \]Here \(S_t\) is the current state and \(\pi\) is the policy.
Policy Evaluation
A policy is a rule mapping states or observations to actions.
Simulation can compare policies by repeatedly running the same environment under different decision rules.
Adaptive Policies
An adaptive policy changes behavior as new data arrive.
Examples include:
- reordering inventory when demand changes;
- adding servers when queues grow;
- adjusting forecasts after new observations;
- changing maintenance schedules after failures.
Exploration and Exploitation
Some decisions face a tradeoff between:
- exploitation — choosing the currently best-known action;
- exploration — trying alternatives to learn more.
This idea appears in adaptive experiments and reinforcement learning.
A/B Testing as Data-Driven Decision-Making
An A/B test randomly assigns units to two alternatives and compares outcomes.
The experiment generates evidence about which alternative performs better under the measured outcome.
The final business or policy decision may still depend on cost, risk, and implementation constraints.
Decision Thresholds
A probabilistic prediction may be converted into an action using a threshold.
For example:
\[ \text{take action if }P(\text{event})>c. \]The best threshold depends on the relative costs of false positives and false negatives.
Expected Decision Loss
Suppose action \(a\) and outcome \(y\) create loss
\[ L(a,y). \]A probabilistic decision rule may choose
\[ \boxed{ a^\ast = \arg\min_a E[L(a,Y)\mid\text{current information}] }. \]This explicitly connects prediction to action.
Common Error: Trusting One Simulation Run
One stochastic run is one possible realization.
It does not reveal the full distribution.
Reliable simulation analysis requires repeated runs.
Common Error: Using Too Few Runs
A small number of simulations can produce unstable estimates.
Monte Carlo uncertainty should be monitored rather than assuming every simulated estimate is precise.
Common Error: Ignoring Dependence
Sampling correlated inputs independently can understate or distort variability.
Dependence structure should match the real system whenever it materially affects outcomes.
Common Error: Calibrating and Evaluating on the Same Data
A model can appear excellent if evaluated on the same observations used to tune it.
Validation should use held-out or future-like data.
Common Error: Confusing Model Precision with Real Accuracy
A simulation can produce an estimate such as
\[ 0.037428 \]with many decimal places.
That does not mean the real-world probability is known to six decimal places.
Parameter uncertainty and model error may dominate Monte Carlo error.
Common Error: Optimizing the Wrong Objective
A model can optimize exactly what it was asked to optimize and still produce a poor real-world decision if the objective is incomplete.
For example, minimizing average cost while ignoring rare catastrophic loss may be unacceptable.
Common Error: Treating Historical Data as Automatically Representative
Historical data may come from a different regime.
Changes in:
- technology;
- policy;
- behavior;
- markets;
- environment
can make old patterns less relevant.
Common Error: Acting on Correlation as Though It Were Causal
Predictive relationships do not necessarily describe the effect of an intervention.
Decision-making may require causal evidence in addition to predictive accuracy.
A Reliable Procedure for Monte Carlo Simulation
- Define the output quantity of interest.
- Specify uncertain inputs and their distributions.
- Specify dependence among inputs.
- Generate one random scenario.
- Calculate the resulting output.
- Repeat many times.
- Summarize means, variability, quantiles, and event probabilities.
- Estimate Monte Carlo uncertainty.
- Repeat with additional runs if precision is inadequate.
A Reliable Procedure for Simulation-Based Decisions
- Define the decision variables.
- Define the feasible set.
- Define the objective or loss function.
- Generate common scenarios for competing decisions when appropriate.
- Simulate each decision across the scenarios.
- Compare mean performance, variability, and tail outcomes.
- Test sensitivity to model assumptions.
- Check robustness under adverse scenarios.
- Select the decision that best matches the stated objective and risk criteria.
A Reliable Procedure for Model Validation
- Verify the code and mathematical logic.
- Check units and conservation rules.
- Test simple cases with known results.
- Compare simulated and observed distributions.
- Evaluate out of sample.
- Check calibration when probabilities are produced.
- Inspect failure cases and extreme scenarios.
- Document assumptions and known limitations.
Example: Full Monte Carlo Workflow
Suppose annual demand \(D\) is modeled as
\[ D\sim\operatorname{Normal}(1000,100^2). \]A policy orders
\[ Q=1100 \]units.
For each simulation run:
- generate one demand value \(D_i\);
- calculate leftover inventory \((Q-D_i)_+\);
- calculate shortage \((D_i-Q)_+\);
- calculate total cost;
- store the result.
Repeating this process estimates the policy's cost distribution.
Example: Full Policy-Comparison Workflow
Suppose two staffing policies are simulated \(10{,}000\) times.
| Policy | Mean Wait | Probability Wait > 15 min | Staffing Cost |
|---|---|---|---|
| A | 6.2 min | 0.04 | \(\$800\) |
| B | 4.8 min | 0.01 | \(\$950\) |
Policy B performs better on waiting measures but costs more.
Simulation clarifies the tradeoff; it does not decide how much the organization should value shorter waits.
Example: Full Sensitivity Workflow
Suppose expected profit under a model is
\[ \$120{,}000 \]when demand growth is \(5\%\).
Recalculate under:
\[ 0\%,\qquad5\%,\qquad10\%. \]If the decision changes when growth moves only slightly, the recommendation is sensitive to that assumption.
Practice 1: Simulated Probability
An event occurs in \(84\) of \(1200\) simulation runs.
Estimate its probability.
Practice 2: Monte Carlo Mean
Simulated outputs are
\[ 4,\ 6,\ 5,\ 9. \]Find the simulated mean.
Practice 3: Square-Root Rule
If simulation runs are increased from \(1000\) to \(4000\), approximately what happens to Monte Carlo standard error?
Practice 4: Uniform Mapping
A simulated event occurs when
\[ U<0.25 \]for \(U\sim\operatorname{Uniform}(0,1)\).
What event probability is being simulated?
Practice 5: Bootstrap Property
Are bootstrap samples drawn with or without replacement from the observed data?
Practice 6: Expected-Cost Decision
Policy A has simulated expected cost \(\$120\).
Policy B has simulated expected cost \(\$105\).
Under a purely expected-cost objective, which policy is preferred?
Practice 7: Chance Constraint
A decision satisfies a requirement in \(970\) of \(1000\) runs.
Estimate the probability of satisfying the requirement.
Practice 8: Verification or Validation?
Checking whether simulation code correctly implements the intended equation is primarily verification or validation?
Practice 9: Common Seed
What is the main purpose of recording a random seed in a reproducible simulation?
Practice 10: Prediction Versus Decision
Does an accurate probability forecast automatically determine the best action?
Practice Answers
Practice 1
\[ \hat p = \frac{84}{1200} = \boxed{0.07}. \]Practice 2
\[ \bar X = \frac{4+6+5+9}{4} = \frac{24}{4} = \boxed{6}. \]Practice 3
The number of runs increases by a factor of \(4\).
Standard error changes by
\[ \frac{1}{\sqrt4} = \boxed{\frac12}. \]It is approximately halved.
Practice 4
\[ \boxed{0.25}. \]Practice 5
Bootstrap samples are drawn
\[ \boxed{\text{with replacement}}. \]Practice 6
Under a purely expected-cost objective,
\[ \boxed{\text{Policy B}} \]is preferred because \(105<120\).
Practice 7
\[ \frac{970}{1000} = \boxed{0.97}. \]Practice 8
This is
\[ \boxed{\text{verification}}. \]Practice 9
Recording the seed helps reproduce the same pseudorandom sequence and therefore the same simulated run structure.
Practice 10
No.
The best action also depends on costs, benefits, constraints, and the loss or utility function.
What to Remember
Simulation and data-driven decision-making combine probability, algorithms, statistical inference, and optimization.
- Monte Carlo simulation uses repeated random sampling;
- simulated means and probabilities have Monte Carlo uncertainty;
- more runs improve precision at a square-root rate;
- event-driven models update when discrete events occur;
- state-transition rules move systems through time;
- correlated inputs should not be simulated independently without justification;
- bootstrap methods resample observed data with replacement;
- simulation can compare decisions under uncertainty;
- sensitivity and stress testing reveal dependence on assumptions;
- verification checks implementation;
- validation checks whether the model is appropriate for reality;
- prediction and decision are different problems;
- data inform decisions but do not define objectives automatically.
The central habit is: model uncertainty explicitly, simulate enough possible futures to understand the distribution of outcomes, and evaluate decisions against clearly stated objectives, constraints, and risks.
Where We Go Next
Simulation and data-driven decision-making bring together the major tools of discrete and stochastic mathematics: counting, probability, conditional reasoning, graphs, stochastic processes, statistical inference, algorithms, and optimization.
With this lesson, the Applied Discrete and Stochastic Problem Families section closes by showing how those tools work together in realistic systems rather than in isolation.
The next stage is to consolidate these techniques across broader modeling and analysis problems, where discrete, stochastic, algebraic, spatial, and continuous methods interact within the same mathematical model.