Prescriptive Analytics & Decision Trees

Chapter 9
Simulation and Stochastic Optimization

Graduate Program in Business Analytics
Prescriptive Analytics & Decision Trees   •   Graduate

Simulation and Stochastic Optimization

Introduction and Context

Business decisions are frequently made before uncertain events are observed. Demand may exceed or fall below forecast, suppliers may deliver late, customers may arrive in bursts, and prices or exchange rates may change unexpectedly. Deterministic optimization represents uncertainty through fixed estimates; simulation represents the consequences of uncertainty; stochastic optimization embeds uncertainty directly into a decision model.

This chapter develops an integrated framework for Monte Carlo simulation, discrete-event simulation, output analysis, policy comparison, stochastic programming with recourse, and simulation–optimization. The central managerial question is not merely “What is the expected outcome?” but “Which policy performs acceptably across the range of plausible futures, and how confident are we in that conclusion?”

Learning Objectives

By the end of this chapter, the reader should be able to:

  1. Distinguish Monte Carlo, discrete-event, and system-dynamics simulation.
  2. Generate random inputs from empirical and parametric distributions and validate them.
  3. Design simulation experiments using appropriate replications, warm-up periods, and stopping rules.
  4. Estimate output distributions, confidence intervals, risks, and policy differences.
  5. Formulate two-stage stochastic programs with recourse.
  6. Combine simulation and optimization when analytical models are inadequate.
  7. Critically evaluate model risk, governance, ethical issues, and implementation choices.

1. Simulation as an Analytical Method

A simulation model reproduces the operation of a real or proposed system over time. Inputs include controllable decisions, uncertain quantities, and system rules. Outputs may include cost, service level, profit, waiting time, utilization, stockouts, or reliability.

Simulation is especially useful when a system contains nonlinear relationships, queues, interacting resources, complex operating rules, or uncertainty that is difficult to represent analytically. Unlike optimization, simulation does not automatically identify the best decision. It evaluates decisions. Optimization searches for decisions but may require simplifying assumptions. Combining the two methods is therefore powerful.

1.1 Monte Carlo simulation

Monte Carlo simulation repeatedly samples uncertain inputs and calculates an outcome. It is appropriate when the model can be evaluated for a complete scenario without representing every event in chronological detail.

For replications Y1, Y2, …, Yn, the estimated mean output is:

Ȳ = (1/n) ∑ᵢ₌₁ⁿ Yᵢ

where Yi is the output from replication i and n is the number of independent replications. If the replications are independent and have finite variance, the standard error of the estimated mean is:

SE(Ȳ) = s/√n

where s is the sample standard deviation of the outputs. A large-sample approximate 95% confidence interval is:

Ȳ ± t₀.₉₇₅,ₙ₋₁ × SE(Ȳ)

The t critical value is preferable to 1.96 when the number of replications is modest. The interval estimates the mean performance, not the range of individual future outcomes.

1.2 Discrete-event simulation

A discrete-event simulation models a system as a sequence of events that change its state at particular points in time. Typical events include customer arrival, service completion, machine failure, replenishment receipt, and transport departure.

A basic event-driven algorithm is:

  1. Initialize the clock, state variables, event list, and performance statistics.
  2. Remove the event with the smallest scheduled time.
  3. Advance the simulation clock to that event time.
  4. Update time-dependent statistics.
  5. Execute the event logic, changing system state and scheduling new events.
  6. Repeat until the stopping condition is reached.
  7. Report estimates and uncertainty measures.

For a queue, the state may include the number waiting, the server status, and the next arrival and departure times. If arrivals and services are represented by random variables, repeated runs reveal congestion and delay distributions that simple averages can conceal.

1.3 Other simulation paradigms

Agent-based simulation represents autonomous entities whose behavior and interactions generate system-level patterns. System-dynamics simulation represents aggregate stocks, flows, feedback, and delays, often in continuous time. These approaches are not interchangeable. Discrete-event simulation is natural for operational processes; agent-based simulation is useful when heterogeneous behavior and interaction matter; system dynamics is useful for strategic feedback and accumulation.

2. Modeling Random Inputs

A simulation is only as credible as its representation of uncertainty. Random input modeling involves identifying uncertain quantities, selecting distributions, estimating parameters, preserving dependencies, and validating the resulting model.

2.1 Empirical versus parametric distributions

An empirical distribution uses observed data directly, such as historical daily demand or observed repair times. It reduces distributional assumptions but may reproduce sampling noise and may not represent conditions outside the historical range.

A parametric distribution summarizes uncertainty using a named family. For example, if demand is approximately normally distributed with mean μ and standard deviation σ, then:

X = μ + σZ, Z ~ N(0,1)

This transformation is appropriate when the normal assumption is defensible and the variable can reasonably take values on the real line. It is inappropriate for strongly skewed nonnegative quantities unless the data support that choice.

A lognormal variable can be generated as:

X = exp(μL + σL Z), Z ~ N(0,1)

where μL and σL are the mean and standard deviation of the logarithm of X, not of X itself.

For a discrete variable with possible values xj and probabilities pj, inverse transform sampling selects the smallest xj whose cumulative probability exceeds a uniform draw U ~ Uniform(0,1). For a continuous variable with cumulative distribution function F, inverse transform sampling is:

X = F⁻¹(U), U ~ Uniform(0,1)

This requires a valid cumulative distribution and, in practice, either an available inverse or a numerical method.

2.2 Random-number generation

Computers normally use pseudorandom-number generators. They produce deterministic sequences that imitate random variables. A sound generator should have a long period, acceptable statistical properties, reproducibility through seeds, and independent or carefully separated streams for different sources of uncertainty.

Reproducibility is valuable for debugging and auditability. It does not mean that the simulated system is certain; it means that an experiment can be repeated exactly. Different policies should generally use common random numbers when the goal is a precise comparison, so that both policies experience matched scenarios. This can reduce the variance of their difference, although it must be implemented consistently.

2.3 Dependence and correlation

Sampling each input independently is often unrealistic. Demand for related products may move together, processing time may increase with job complexity, and supplier delay may be related to weather-driven demand.

The Pearson correlation coefficient between variables X and Y is:

ρₓᵧ = Cov(X,Y)/(σₓσᵧ)

where Cov(X,Y) is covariance and σₓ and σᵧ are standard deviations. Correlation alone does not fully define dependence unless the joint distribution is appropriately specified. A model may therefore require copulas, conditional distributions, common causal drivers, or direct resampling of observed records.

2.4 Input validation

Input validation should address:

  • data quality, missing values, censoring, outliers, and measurement definitions;
  • stationarity and seasonality;
  • goodness of fit and tail behavior;
  • dependence between variables;
  • plausibility of generated values;
  • differences between historical and future operating conditions.

Goodness-of-fit tests should not be treated as automatic arbiters. With very large samples, trivial deviations may be statistically significant; with small samples, important deviations may not be detected. Graphical diagnostics, domain expertise, predictive validation, and stress testing should complement formal tests.

3. Designing and Validating Simulation Experiments

3.1 Verification and validation

Verification asks, “Was the model implemented correctly?” Validation asks, “Is the model sufficiently representative for this decision?” Verification uses code inspection, unit tests, conservation checks, boundary tests, and comparisons with simplified cases. Validation uses historical comparisons, expert review, face validation, sensitivity analysis, and out-of-sample tests.

A model need not replicate every detail of reality. It must represent the features that materially affect the decision. A highly detailed model can still be invalid if its data, assumptions, or behavioral logic are wrong.

3.2 Terminating and steady-state simulations

A terminating simulation has a natural beginning and end, such as a day of operations, a project, or a seasonal campaign. Independent replications can normally begin from the same specified initial condition.

A steady-state simulation represents a continuing system, such as a call center or manufacturing line. Initial conditions may bias early observations. A warm-up period is discarded before collecting performance data. The warm-up length should be justified through diagnostic plots, multiple initial conditions, or statistical procedures rather than selected arbitrarily.

3.3 Replications and precision

Suppose a manager requires a half-width no greater than h for a confidence interval. A pilot run estimates the output standard deviation as s. An approximate replication requirement is:

n ≈ (t₀.₉₇₅,ₙ₋₁ s/h)²

Because the critical value depends on n, the calculation is iterative. More replications reduce the standard error at a rate proportional to 1/√n; quadrupling the replication count approximately halves the standard error.

When observations within a single run are autocorrelated, treating them as independent exaggerates the effective sample size. Batch means, independent replications, or other time-series methods are needed for valid uncertainty estimates.

3.4 Output distributions and risk measures

A manager may need more than an expected value. Important outputs include:

  • variance or standard deviation;
  • quantiles, such as the 95th percentile of waiting time;
  • probability of loss, stockout, or service-level violation;
  • value at risk, a specified loss quantile;
  • conditional value at risk, the average loss beyond that quantile;
  • probability that one policy outperforms another.

For a loss variable L, the α-quantile is a threshold q_α such that approximately α of outcomes are no greater than that threshold. Conditional value at risk for a continuous loss distribution can be written as:

CVaRₐ(L) = E[L | L ≥ VaRₐ(L)]

For discrete or mixed distributions, the tail average should be computed carefully, including the probability mass at the quantile. Risk measures must identify whether larger or smaller values are undesirable and must use consistent units.

3.5 Comparing policies

For policies A and B, define the paired difference in replication i as:

Dᵢ = Yᵢᴬ − Yᵢᴮ

The estimated mean difference is Ḋ, with standard error sD/√n when paired differences are independent across replications. A confidence interval for Ḋ indicates whether the observed advantage is distinguishable from simulation noise.

Statistical significance is not the same as managerial significance. A tiny cost reduction may be statistically reliable but operationally irrelevant. Conversely, a large apparent improvement may require more replications before a decision is justified.

4. Worked Example: Monte Carlo Inventory Risk

A retailer must choose a base-stock level for a one-period product. Demand is modeled as discrete:

DemandProbability
800.20
1000.50
1200.30

The retailer receives revenue of $30 per unit sold, incurs a purchase cost of $12 per stocked unit, and has no salvage value. Unsatisfied demand is lost. For stock level Q, profit is:

Π(Q,D) = 30 min(Q,D) − 12Q

where D is demand. For Q = 100, profits are $1,200 when demand is 80, $1,800 when demand is 100, and $1,800 when demand is 120. Therefore:

E[Π(100)] = 0.20(1200) + 0.50(1800) + 0.30(1800) = $1,680

For Q = 120, profits are $1,440, $1,680, and $2,160, respectively, giving:

E[Π(120)] = 0.20(1440) + 0.50(1680) + 0.30(2160) = $1,776

This small exact calculation illustrates what Monte Carlo would estimate by repeatedly sampling demand. The simulation becomes more valuable when demand is continuous, correlated with price, affected by replenishment timing, or embedded in a multi-period process. A single expected-profit comparison is insufficient if cash constraints, stockout risk, or service targets matter.

5. Stochastic Programming with Recourse

Simulation evaluates a specified policy under uncertainty. Stochastic programming instead represents decisions and uncertainty in an optimization model. A central distinction is whether a decision is made before or after uncertainty is observed.

5.1 Two-stage formulation

In a two-stage model, first-stage decisions are made now. A random scenario ξ is then observed, and second-stage recourse decisions respond to it. A generic formulation is:

minₓ cᵀx + Eξ[Q(x,ξ)]

subject to:

Ax ≥ b, x ≥ 0

where x is the first-stage decision, c is its cost vector, and Q(x,ξ) is the optimal recourse cost after scenario ξ occurs. A common linear recourse function is:

Q(x,ξ) = minᵧ q(ξ)ᵀy

subject to:

W(ξ)y ≥ h(ξ) − T(ξ)x, y ≥ 0

Here y is the recourse decision, q(ξ) its scenario-dependent cost, W(ξ) the recourse technology matrix, and h(ξ) − T(ξ)x the residual requirement after the first-stage decision. The formulation assumes that scenarios and probabilities are specified or estimated and that recourse is feasible or appropriately penalized.

The nonanticipativity principle requires decisions made before uncertainty is revealed to be identical across scenarios sharing the same information history. Violating this principle produces an artificially informed and infeasible plan.

5.2 Scenario trees and multi-stage decisions

A multi-stage stochastic program uses a scenario tree. Decisions at a node may depend on observations available at that node but not on future outcomes. A plan that orders inventory after observing current demand but before next month’s demand is revealed can condition on current demand only.

5.3 Value of stochastic solutions

The expected value of perfect information compares the stochastic optimum with the expected cost of a decision that knows future uncertainty in advance:

EVPI = zWS − zSP

for a minimization problem, where zWS is the expected wait-and-see objective and zSP is the stochastic-program objective. Since perfect information cannot worsen a minimization result, EVPI ≥ 0 under consistent models.

The expected value of sample information compares a solution based on estimated uncertainty with a solution using the true distribution, when that true distribution is available for evaluation. These measures are decision-quality diagnostics, not guaranteed financial benefits.

6. Simulation–Optimization

Many real systems cannot be represented adequately by a tractable mathematical program. A simulation–optimization framework searches over decisions while using simulation to estimate noisy objective values.

Common approaches include:

  • ranking and selection for a finite set of policies;
  • response-surface methods for approximately smooth objectives;
  • evolutionary algorithms for complex discrete decisions;
  • Bayesian optimization for expensive black-box evaluations;
  • stochastic approximation for continuous decisions;
  • sample-average approximation, which replaces an expectation by a finite scenario sample.

Sample-average approximation estimates:

minₓ cᵀx + (1/N)∑ⱼ₌₁ᴺ Q(x,ξⱼ)

where ξj are sampled scenarios. Increasing N generally improves representation of the uncertainty distribution but increases computational cost. Candidate solutions should be evaluated with fresh validation scenarios; otherwise the search may overfit the optimization sample.

A sound workflow is:

  1. Define decisions, constraints, objectives, and performance metrics.
  2. Build and verify the simulation independently.
  3. Select a search method appropriate to the decision space.
  4. Use common random numbers or controlled seeds when comparing candidates.
  5. Allocate simulation effort adaptively toward promising or statistically ambiguous alternatives.
  6. Validate the selected policy with independent replications and stress scenarios.
  7. Document assumptions, seeds, code versions, and decision authority.

7. Illustrative Case: Regional Vaccine Distribution

Background

A regional health network must allocate refrigerated vaccine inventory among three clinics before the next delivery cycle. Demand is uncertain, clinic capacities differ, and emergency transfers are possible but expensive. The network is considering a deterministic allocation, a stochastic-program allocation, and a simulation-informed policy.

Problem

The first-stage decision is the quantity sent to each clinic. After demand is observed, the network may transfer stock, accept limited unmet demand, or dispose of expired doses. Demand is correlated because regional outbreaks affect all clinics. Refrigeration capacity and minimum service requirements constrain allocations.

Analysis

A naive model uses independent average demand and therefore understates simultaneous shortages. The analytical team instead fits clinic-level demand using historical observations, includes a common outbreak factor, and validates the joint model against correlations and tail events. A discrete-event simulation represents daily demand, transfers, expiry, and refrigeration utilization.

The stochastic program uses outbreak scenarios to choose initial allocations and recourse transfer decisions. Because the operational transfer process includes truck schedules and queueing at a central depot, the final candidate policies are evaluated in the discrete-event simulation. Common random numbers are used when comparing policies so that each receives the same simulated outbreak and demand paths.

Approach and solution

The deterministic policy minimizes expected procurement and transfer cost using mean demand. The stochastic policy minimizes expected cost plus penalties for unmet demand. The simulation–optimization policy searches over allocation rules, including a reserve-stock parameter and transfer trigger.

The recommended policy is not necessarily the policy with the lowest average cost. The decision committee examines expected cost, the 95th percentile of unmet demand, refrigeration utilization, and the probability of violating the service target. It selects a policy whose average cost is slightly higher than the deterministic alternative but whose shortage risk is materially lower.

Outcome and learning points

The case demonstrates four principles. First, dependence matters when common shocks create simultaneous shortages. Second, recourse has value because decisions can adapt after demand information arrives. Third, optimization and simulation answer different questions and should be combined rather than confused. Fourth, a policy must be evaluated on distributions and tail risks, not only expected cost.

8. Challenges, Governance, and Ethical Issues

Simulation models can create false confidence through precise-looking output. Key risks include poor data quality, hidden assumptions, inappropriate independence, inadequate warm-up, insufficient replications, coding errors, and optimization overfitting.

Governance should require version-controlled code, documented input sources, reproducible seeds, reviewable scenario definitions, validation evidence, and clear ownership of assumptions. Material decisions should retain human accountability. A model should not be used to conceal value judgments, such as assigning a monetary penalty to unmet healthcare demand without stakeholder approval.

Fairness is relevant when simulation allocates scarce resources among groups or locations. Historical data may reflect unequal access rather than true need. Models should examine subgroup outcomes, test sensitivity to contested assumptions, and disclose uncertainty. Privacy-preserving data practices are required when individual-level records are used.

AI can assist with parameter estimation, anomaly detection, scenario generation, and surrogate modeling. However, machine-learning predictions do not remove the need for causal interpretation, calibration, uncertainty quantification, and governance. A fast surrogate may be useful inside an optimization loop, but it must be tested against the original simulation, especially in extreme regions where decisions are likely to be sensitive.

9. Best Practices

  1. Define the decision and the relevant uncertainty before selecting a simulation method.
  2. Separate input uncertainty, model uncertainty, and implementation uncertainty.
  3. Preserve important dependence structures rather than sampling every input independently.
  4. Verify code using simplified cases with known answers.
  5. Validate outputs against historical or expert benchmarks.
  6. Use independent replications and report confidence intervals.
  7. Discard warm-up observations when modeling steady state, with documented justification.
  8. Compare policies using paired differences when common random numbers are appropriate.
  9. Evaluate tail risks and constraint-violation probabilities, not just means.
  10. Validate optimized policies on fresh scenarios.
  11. Conduct sensitivity, stress, and scenario analysis.
  12. Document assumptions, data provenance, software versions, and limitations.

Chapter Summary

Simulation represents uncertain systems by generating scenarios and observing resulting outcomes. Monte Carlo simulation is suitable for repeated scenario evaluation, whereas discrete-event simulation explicitly represents events, queues, resources, and time. Credible simulation requires valid random-input models, appropriate dependence structures, verification, validation, warm-up treatment, sufficient replications, and statistically defensible output analysis.

Policy comparison should use confidence intervals for differences and should distinguish statistical from managerial significance. Stochastic programming makes uncertainty part of optimization by separating first-stage decisions from recourse decisions after information is observed. Nonanticipativity prevents decisions from using unavailable future information. Simulation–optimization is valuable when realistic system behavior cannot be captured by a tractable analytical model. Across all methods, governance, fairness, transparency, and independent validation are essential.

Key Terms

Monte Carlo simulation: Repeated evaluation of a model using sampled uncertain inputs.

Discrete-event simulation: Simulation in which state changes occur at discrete events.

Replication: One independently generated simulation run.

Random seed: An initial value controlling a reproducible pseudorandom sequence.

Common random numbers: A variance-reduction method using matched random inputs across policies.

Warm-up period: Initial simulation time discarded to reduce initialization bias.

Steady state: Long-run operating behavior of a continuing system.

Terminating simulation: Simulation with a natural beginning and end.

Input distribution: Probabilistic representation of an uncertain model input.

Empirical distribution: Distribution constructed directly from observed data.

Recourse: A later decision that responds to realized uncertainty.

Scenario tree: Representation of information and decisions across multiple stages.

Nonanticipativity: Requirement that decisions cannot depend on unknown future information.

Expected value of perfect information: Expected benefit of knowing future uncertainty in advance.

Sample-average approximation: Replacement of an expectation by an average over sampled scenarios.

Verification: Determining whether the implemented model conforms to its specification.

Validation: Determining whether the model is adequate for its intended decision.

Value at risk: A specified quantile of a loss distribution.

Conditional value at risk: Expected loss in the tail beyond a selected quantile.

Simulation–optimization: Optimization in which simulation estimates objective or constraint performance.

Review Questions

5 Short Answer Questions

  1. What is the difference between verification and validation?
  2. Why can independent input sampling be inappropriate?
  3. What is the purpose of a warm-up period?
  4. Define recourse in a stochastic program.
  5. Why are fresh scenarios useful when validating an optimized policy?

5 Long Answer Questions

  1. Compare Monte Carlo, discrete-event, agent-based, and system-dynamics simulation, including suitable applications for each.
  2. Explain how input distributions should be selected, estimated, and validated in a business simulation.
  3. Discuss confidence intervals, replication requirements, and the distinction between statistical and managerial significance.
  4. Explain a two-stage stochastic program and the role of nonanticipativity.
  5. Evaluate the governance and ethical risks of using simulation–optimization for resource allocation.

3 Analytical / Application Questions

  1. Design a simulation experiment for a call center with time-varying arrivals, multiple customer classes, and limited agents. Specify inputs, events, outputs, warm-up treatment, and validation tests.
  2. A supply chain policy has lower expected cost but a higher 95th-percentile shortage than its competitor. Explain how a manager should compare the policies and what additional analysis is required.
  3. Formulate a two-stage inventory allocation model in which initial stock is chosen before demand is known and emergency transfers are chosen afterward. Identify first-stage variables, recourse variables, objective components, and nonanticipativity considerations.

Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes simulation from optimization?

A. Simulation always identifies the mathematically optimal decision.

B. Optimization cannot represent uncertainty.

C. Simulation evaluates specified policies, while optimization searches for decisions under a model.

D. Simulation requires all inputs to be deterministic.

Correct Answer: C. Simulation evaluates specified policies, while optimization searches for decisions under a model.

Question 2

For independent replications, the standard error of the estimated mean is approximately:

A. s × √n

B. s/n

C. s + n

D. s/√n

Correct Answer: D. s/√n

Question 3

What is the primary purpose of a warm-up period in a steady-state simulation?

A. To increase the number of events per replication

B. To reduce bias caused by artificial initial conditions

C. To eliminate all random variation

D. To guarantee optimality

Correct Answer: B. To reduce bias caused by artificial initial conditions

Question 4

In a two-stage stochastic program, recourse decisions are made:

A. Before any uncertainty is modeled

B. After relevant uncertainty is observed

C. Only after the optimization is discarded

D. Independently of all scenarios

Correct Answer: B. After relevant uncertainty is observed

Question 5

Which principle prevents a scenario-specific decision from using information that was not yet available?

A. Stationarity

B. Normality

C. Nonanticipativity

D. Replication

Correct Answer: C. Nonanticipativity

Question 6

If the number of independent replications is quadrupled, the approximate standard error becomes:

A. Twice as large

B. Half as large

C. Four times as large

D. Unchanged

Correct Answer: B. Half as large

Question 7

Which method is especially useful for comparing two policies under matched random scenarios?

A. Common random numbers

B. Discarding all replications

C. Setting all inputs to their means

D. Removing the objective function

Correct Answer: A. Common random numbers

Question 8

For a minimization problem, expected value of perfect information is generally calculated as:

A. Stochastic-program value minus wait-and-see value

B. Wait-and-see value minus stochastic-program value

C. Mean input minus mean output

D. Simulation variance divided by cost

Correct Answer: B. Wait-and-see value minus stochastic-program value

Question 9

What is a major danger of evaluating an optimized policy only on the scenarios used during optimization?

A. Underfitting the random-number generator

B. Overfitting the sampled scenarios

C. Eliminating nonanticipativity automatically

D. Increasing the physical capacity of the system

Correct Answer: B. Overfitting the sampled scenarios

Question 10

Which output is a tail-risk measure?

A. Mean profit only

B. Median input value

C. 95th percentile of loss

D. Number of decision variables

Correct Answer: C. 95th percentile of loss

Prescriptive Analytics & Decision Trees
Chapter 9 of 15