What is simulation? Should I use simulation or optimisation? (Or both)
Simulation and mathematical optimisation are best friends, but they’re deployed to solve different problems. They both have strengths and weaknesses, so it really is a matter of “what problem are you trying to solve?” and not that one technology dominates the other.
Simulation is more prominent in industry as it is typically easier to deploy and understand. There is a large range of off-the-shelf tools designed to support simulation modelling such as AnyLogic and Arena.
Mathematical optimisation remains a more specialised discipline, although recent improvements to generative AI (e.g. ChatGPT/Claude) are starting to lower the barrier to entry.
As we’ll explore below, a combination of simulation and optimisation (SimOpt) is typically the most advanced and highest-value work done in the industrial mathematics sector.
Simulation (DES)
The technical term is discrete event simulation (DES), where the model is built around events which occur based on a logic engine, e.g. the engine decides a train moves forward to the next section, and that event carries a large amount of stateful information that can be probed for insights. For contrast, other sim methods may advance time in fixed increments, e.g. move every train forward every 1 second. In rail we prefer DES because it doesn’t waste computing time when nothing is changing, and we can’t lose detail between the events.
Simulation is very powerful for capacity modelling because it natively deals with uncertainty (‘stochastics’), which a deterministic MIP is generally weaker at. More on why MIP struggles in the next section.
However, decisions in a simulation model are made by the modeller ahead of time. Your opinion of how to obey the rules and how you expect the system to behave entirely shape the outputs. Naturally, this can completely warp the solution space and resulting insights. E.g. you may need to encode a rule that says empty trains yield to loaded trains for meet/pass, which fundamentally encodes detail of the “solution”. Deciding which train stops is an optimisation problem after all.
DES provides distributions of performance for the decisions that you (the modeller) encode as rules/logic. In other words, there is a lot of time spent writing down how the system operates now with less regard for improvement. Indeed, the modeller needs to encode improvements back into the model.
Mathematical optimisation (MIP / LP)
MIP is spectacular at prescribing solutions. Given a set of inputs, it will determine the best course of action within the bounds of the model (and a proven optimality gap). Change the inputs or your objectives, and you get a different answer.
However, MIP will tend to deliver “brittle” solutions because its job is to extract the very best possible answer, which often means exploiting all slack on your constraints. A brittle solution may break down when making contact with the uncertain nature of reality.
Yet taking precise data and delivering a precise solution is still extremely useful. Often exposure to the nitty-gritty detail will cause users to throw stones at the model because of the level of detail exposed in outputs that may not seem possible in the “real world”. It is important to contrast this with manual decision-making methods, like Excel models, that do not and cannot expose this detail, and which may therefore on a surface level appear more useful or reliable. Optimisation practitioners are responsible for explaining and highlighting this dilemma.
MIP may be unhelpful in some cases of capacity modelling because it’s attempting to deterministically answer a question from a set of possible answers. As you layer in uncertainty (e.g. variable dwell times), the number of answers increases multiplicatively (Google “combinatorics” for more info). As the number of potential solutions explodes, the time to solve the MIP increases significantly, often to the point of intractability.
Alternatively, you run the MIP model many times in succession with different inputs in order to showcase how that input variability affects your answer. E.g. trying to build a train crew allocation plan for 100 services – if you want to accommodate “what if any given service is late at any given node” then you’re no longer optimising over 100 services. Instead you’re running a multitude of models over different train service options and then perhaps averaging or aggregating those result sets.
Techniques like stochastic programming directly embed the variability, though this comes with its own trade-offs (we explore this in a forthcoming article). However, as we noted earlier, a MIP can prescribe a solution.
Simulation with optimisation
We mentioned that simulation and optimisation are friends. A team-up is one of the best ways to address the weaknesses we raised earlier: simulation handles uncertainty and the detailed logic, and optimisation supplies the decisions.
- Optimise then simulate. The MIP builds the plan (e.g. train cycles) and then the DES runs that plan many times against variability (e.g. dwell times, late arrivals, breakdowns, possessions).
- Simulation with an optimiser. Instead of hard-coding decision rules into the simulation, the simulation calls an optimiser whenever a decision needs to be made (e.g. which train passes, which train dwells). This is a fantastic way to sidestep the modelling bias we discussed earlier.
- Simulation-based optimisation. An optimisation algorithm proposes candidate solutions (e.g. fleet allocation), the simulation scores each one under realistic variability, and the optimiser uses those scores to steer its search.
Summary
Use simulation to understand how a system performs for a given set of rules. It is also an excellent communication tool, as stakeholders can readily visualise the system behaviour.
Optimisation should be used to decide what to do when many interacting decisions, hard constraints and a clear objective make manual planning impractical or leave dollars on the table.
SimOpt should be used when you need both a good decision and confidence that it holds up under real-world variability. It also applies when the decision logic inside a simulation is the very thing you’re trying to improve.
Start from the problem you’re trying to solve:
- “How will this system behave?” use simulation.
- “What should we do?” use optimisation.
- “What should we do, and will it hold up?” use both.
Not sure where to start? Get in touch with Ponco today.