flowchart TD
A["Define decision variables"] --> B["Choose candidate settings"]
B --> C["Run simulation model"]
C --> D["Measure performance"]
D --> E["Compare alternatives"]
E --> F["Choose best design"]
F --> G["Validate and interpret"]
style A fill:#e8f0fe,stroke:#333,stroke-width:1px
style B fill:#e8f0fe,stroke:#333,stroke-width:1px
style C fill:#e6f4ea,stroke:#333,stroke-width:1px
style D fill:#fff4ce,stroke:#333,stroke-width:1px
style E fill:#fce8e6,stroke:#333,stroke-width:1px
style F fill:#f3e8fd,stroke:#333,stroke-width:1px
style G fill:#e8f0fe,stroke:#333,stroke-width:1px
48 Simulation Optimisation
Simulation is not only used to understand a system. It can also be used to improve a system.
In earlier chapters, we used simulation to answer questions such as:
- What is the expected waiting time?
- What is the probability of a rare event?
- What is the posterior distribution of an unknown parameter?
- How much variability should we expect in the simulation output?
In practice, decision-makers often want to go one step further:
Which decision, policy, or design gives the best outcome?
This leads to simulation optimisation. Simulation optimisation uses simulation output to compare and improve decisions.
This helps us move from: What might happen? to What should we do?
Why Optimise Using Simulation?
Many real-world systems are too complex for a simple formula. For example:
- a hospital emergency department;
- an airport security queue;
- an EV charging station;
- a warehouse inventory system;
- a traffic network;
- a machine learning model.
In these systems, performance depends on many input choices. These choices may include:
- number of servers;
- staffing levels;
- queue rules;
- inventory thresholds;
- resource allocation;
- model hyperparameters.
A simulation model allows us to test different choices virtually before making expensive real-world changes.
Simulation optimisation means using simulation experiments to find input settings that produce better system performance.
General Simulation Optimisation Workflow
A typical simulation optimisation study follows the workflow below.
The process is usually iterative. If the first set of simulation runs does not give enough information, we refine the candidate settings and simulate again.
Decision variables
Decision variables are inputs controlled by the decision-maker.
Examples include:
| Context | Decision Variables |
|---|---|
| Queueing system | number of servers, service policy |
| Inventory system | reorder point, order quantity |
| EV charging station | number of charging bays |
| Traffic system | traffic light timing |
| Machine learning | learning rate, tree depth, number of hidden units |
Performance measures
Performance measures describe how well the system performs.
Examples include:
| Context | Performance Measures |
|---|---|
| Queueing system | average waiting time, queue length |
| Inventory system | stockout probability, holding cost |
| EV charging station | customer waiting time, charger utilisation |
| Traffic system | congestion, travel time |
| Machine learning | prediction accuracy, validation loss |
A simulation model may have many outputs, but optimisation requires us to define what βbestβ means.
For example, minimising waiting time may conflict with minimising cost.
A Simple Optimisation View
Suppose \(x\) represents a decision variable, such as the number of servers in a queue.
Let \(Y(x)\) be the simulation output for decision \(x\), such as average waiting time.
A simple simulation optimisation problem can be written as
\[ \min_x \; \mathbb{E}[Y(x)]. \]
That is, we want to find the decision \(x\) that minimises the expected simulation output.
In practice, we do not know \(\mathbb{E}[Y(x)]\) exactly. We estimate it by running simulations.
If we run \(R\) replications for decision \(x\), then
\[ \widehat{\mathbb{E}}[Y(x)] = \frac{1}{R} \sum_{r=1}^R Y_r(x). \]
This means optimisation is based on estimated performance, not exact performance.
Simulation outputs are random. A decision may look best in one set of simulation runs simply due to random variation.
For this reason, simulation optimisation should use enough replications and report uncertainty where possible.
Comparing Candidate Designs
A simple way to perform simulation optimisation is to compare a small number of candidate designs.
For example, suppose we simulate a queueing system with different numbers of servers.
| Number of Servers | Mean Waiting Time | Standard Error |
|---|---|---|
| 1 | 18.4 | 1.2 |
| 2 | 9.2 | 0.8 |
| 3 | 5.1 | 0.5 |
| 4 | 4.7 | 0.4 |
At first glance, 4 servers gives the shortest waiting time. However, the improvement from 3 servers to 4 servers may be small compared with the extra cost.
Thus, the best practical decision may be 3 servers rather than 4.
Simulation optimisation is not always about finding the mathematical minimum. Often, it is about finding a good trade-off between performance, cost, risk, and practicality.
This leads to multi-objective optimisation, where we consider multiple performance measures and constraints. However, this is outside the scope of this course.
Hyperparameter Tuning as Simulation Optimisation
Simulation optimisation also appears in machine learning.
Many machine learning algorithms have hyperparameters, which are settings chosen before training the model.
Examples include:
| Model | Hyperparameters |
|---|---|
| Decision tree | maximum depth, minimum split size |
| Random forest | number of trees, number of variables sampled |
| Neural network | learning rate, number of layers |
| Support vector machine | cost parameter, kernel parameter |
Hyperparameter tuning is similar to simulation optimisation:
- choose a set of hyperparameters;
- train the model;
- evaluate performance on validation data;
- compare results;
- choose the best setting.
The performance estimate is often noisy because it depends on random train/test splits, stochastic algorithms, or resampling procedures.
Grid Search and Random Search
Two simple approaches to hyperparameter tuning are grid search and random search.
- Grid search evaluates all combinations from a fixed grid.
For example, if we have two hyperparameters, learning rate and tree depth, we might evaluate the following grid:
| Learning Rate | Tree Depth |
|---|---|
| 0.01 | 3 |
| 0.01 | 5 |
| 0.01 | 7 |
| 0.10 | 3 |
| 0.10 | 5 |
| 0.10 | 7 |
Grid search is simple but can become expensive when there are many hyperparameters.
- Random search samples combinations randomly from a chosen range. This can be more efficient when:
- only a few hyperparameters strongly affect performance;
- the search space is large;
- exhaustive search is computationally expensive.
Both grid search and random search are forms of computational experimentation. We repeatedly evaluate different input settings and compare noisy performance estimates.