Simulated Annealing — An Interactive Route Optimisation Simulator
Let the optimiser accept a worse route on purpose, control how long it is allowed to do that, and see whether the gamble pays off.
Open simulation →Simulation
Nobody plans the route. Dozens of simple ants each try one, the good attempts leave a stronger trail, and a dominant route emerges from accumulated evidence rather than from a planner.
Every other optimiser in this series improves a route by holding one plan and editing it. Two-Opt rearranges segments. Simulated Annealing follows a single solution and sometimes accepts a worse one. Tabu Search follows a single solution and forbids itself from undoing recent moves. Ant Colony Optimisation does something structurally different: it never edits a route at all.
Instead, each iteration throws away every route and builds new ones from scratch, one decision at a time. What carries across iterations is not a plan but a pheromone matrix — a number on every road link recording how often that link has appeared in good solutions. The colony’s memory lives in the components, not in the answers.
The consequence worth seeing on screen is that this makes the algorithm’s memory positive. Tabu Search remembers what to avoid. An ant colony remembers what seems worth repeating, which is a much more dangerous kind of memory: it can reinforce a bad early decision until no ant will consider the alternative.
The map is a synthetic Camden County road network with fast roads, slow roads, a railway barrier, and directional penalties. Geometric distance is deliberately not the objective, so the visually obvious circular route is usually not the cheapest.
Press Release ants and watch the Convergence metric rather than the route. It reports the share of ants using the current best edges. Early on it sits low — the colony is genuinely exploring, and the pheromone overlay is a faint wash across the whole network. As iterations accumulate the wash narrows into distinct trails and convergence climbs. That narrowing is the algorithm working.
Then break it deliberately, using the two parameters that fight each other:
Push β far above α and the colony collapses into greedy nearest-neighbour behaviour. Watch what it does with isolated stops: it takes every convenient local hop first and leaves the awkward outlier until the end, paying for it with a long run home.
Now do the opposite. Push α high and drop Evaporation rate to its minimum. Convergence spikes almost immediately and then the improvement figure flatlines. This is premature convergence: whichever route the first few ants happened to find has monopolised the probability distribution, and no ant will now try anything else. Use New map a few times with these settings — the colony locks onto a mediocre route with the same confidence it shows for a good one, which is the failure mode to recognise.
The evaporation slider is the interesting one because it is bad at both ends. Too low and old success never loses authority. Too high and useful experience is erased before it can guide anything — convergence never rises, the trails never form, and the colony just churns. Use Run one cycle to step through evaporation and reinforcement one iteration at a time.
The reason this algorithm is worth understanding in operational software has little to do with routing.
Pheromone without evaporation is how organisations accumulate process. A workaround solved a real problem once, it got reinforced because it was there, and now it is load-bearing — not because current evidence supports it, but because nothing ever removed the trail. The evaporation rate is the part most real systems omit entirely: shared templates, system defaults, and established workflows all accumulate authority through use, and almost none of them decay when the conditions that justified them change.
The other lesson is about feedback and scoring. A colony reinforces whatever the objective function rewards, efficiently and without argument. Score a delivery model on distance alone and it will confidently converge on routes that ignore congestion. The mechanism does not distinguish between learning and entrenching dysfunction — that distinction lives entirely in what you chose to measure.
Watch a colony of artificial ants learn a route through Camden County's uneven road network. Fast roads, slow roads, one-way penalties and the railway crossing mean that the visually obvious circular route is rarely the cheapest.
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.
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.
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: Earl Lets the Ants Take Over →
Explore the complete Transport Optimisation Explained series