What this simulation shows
Local improvement algorithms such as Two-Opt stop when every available move makes the route worse. Often that is not the best route — it is merely the best route in the immediate neighbourhood. Reaching something genuinely better may require a sequence of moves where the first one increases cost and the later ones more than repay it. A greedy search never gets there, because it refuses the first step.
Simulated Annealing, published by Kirkpatrick, Gelatt and Vecchi, borrows its logic from metallurgy. Cool metal too quickly and it locks into a brittle, badly ordered structure. Cool it slowly and the atoms have time to settle into a stronger arrangement. Applied to routing: allow the search to accept worse solutions readily at the start, then steadily reduce that tolerance until it behaves like an ordinary local search and settles.
The crucial parameter is temperature. High temperature means “accept almost anything and explore widely”. Low temperature means “only accept improvements and converge”. The cooling schedule decides how you travel between the two.
How to use it
Run it once on Balanced cooling and watch the two panels that matter: Worse moves attempted and Current search state. Early on, the search will visibly accept routes that are worse than the best one it has already found. That is the mechanism working, not a bug.
Then compare the extremes deliberately.
Fast cooling converges quickly and usually lands on a mediocre answer. The temperature drops before the search has had a chance to explore, so it commits to whichever region it happened to start in. This is the most common misconfiguration in practice, because fast looks efficient right up until you compare the output with a slower run.
Slow cooling explores far more and generally finds better routes, at the cost of time. In a real TMS that time is a hard product constraint: planners will not wait four minutes for a plan they need in twenty seconds, so the schedule is tuned against the operational clock rather than against solution quality alone.
Earl’s chaotic cooling is the instructive failure. Tolerance never really falls, so the search wanders indefinitely and never settles. It explores beautifully and commits to nothing.
Adjust Starting temperature alongside the schedule, and use Surprise Me to sample configurations you would not have chosen — some of the better outcomes come from combinations that look wrong on paper.
What to take away
Simulated Annealing trades determinism for reach. The same inputs can produce slightly different plans on different runs, which is a genuine product problem in transport: planners reasonably expect a stable answer, and “the algorithm is stochastic” is a poor explanation at 6am. Systems usually manage this by fixing the random seed, capping runtime, and always retaining the best solution found rather than the last one visited.
The Optimiser Series
Earl Learns to Make Things Worse Before They Get Better
Simulated Annealing is counterintuitive because it sometimes accepts a worse answer deliberately. Adjust Earl’s decisions, increase the difficulty, and find the point where a controlled step in the wrong direction creates a route to something better.
The experiment
Earl’s misadventures
Stack increasingly awkward decisions on top of one another. The aim is not simply to make the situation worse, but to discover the turning point beyond the local minimum.
Live result
Current search state
Earl’s current solution may deteriorate, but the best solution discovered remains protected.
Waiting for the first move
The search has a workable route, but nearby improvements are limited. A controlled deterioration may be needed before a better sequence becomes reachable.
Not reached yet
Keep exploring. The search is still moving around the same basin of attraction.
Greedy search protects every immediate gain. Simulated Annealing protects the best answer while allowing the current answer to become temporarily worse.
How to use this simulation
Change one input at a time, run the model, and compare the result with the starting state. Then repeat the experiment with a different constraint or strategy so you can see which relationships drive the outcome.
What to look for
Look for trade-offs, thresholds, feedback loops, and points where a locally attractive decision produces a worse system-wide result. The simulation is intended to make the article's idea observable, not to predict a real operation.
Limitations
This is a deliberately simplified model. It omits the data quality, exceptions, human judgement, and operational constraints of a live system, so treat its behaviour as an illustration of a mechanism rather than as a planning recommendation.
Read the related article
Explore the complete Transport Optimisation Explained series