No ant can see the whole map. Each one wanders almost at random, and when it stumbles onto food it walks home leaving a chemical pheromone trail. Other ants are nudged to follow strong trails โ and short routes get reinforced faster because round trips finish sooner. Pheromone slowly evaporates, so stale paths fade. Out of these tiny local rules, the colony collectively discovers a short path. Scroll through and watch optimization emerge from nobody.
The nest (left) sends out ants toward the food (right), around the walls between them. Foragers wander, biased toward stronger pheromone; once one reaches food it returns home depositing pheromone (more for shorter trips). Trails you'll see in green are evaporating constantly. Tune the dials, then move the food or draw a wall and watch the colony re-route.
Try this: let a trail settle, then drop a wall across it. The old trail evaporates because no ant can complete it any more, while new exploratory trails get reinforced โ the colony heals around the obstacle on its own.
The classic experiment: one nest, one food, two bridges of different length. Ants start by choosing arms about 50/50. But an ant on the short arm completes its round trip sooner, so it lays fresh pheromone there first and more often. That tips the next ants' choice, which reinforces it further โ a feedback loop that locks the colony onto the shorter route. The bar shows the live split.
Evaporation is essential. Without it, the very first lucky trails would dominate forever and the colony could lock onto a bad route. Slow forgetting keeps the colony able to abandon stale paths and keep improving.
Three ideas turn a swarm of nearly-blind ants into an optimizer:
Ants don't talk to each other or follow a leader. They change their shared environment (laying pheromone) and react to those changes. The trail is the message. This indirect, trace-based coordination is called stigmergy.
Each ant runs a trivial rule: wander, prefer stronger scent, deposit on the way home. Yet the population as a whole solves a global problem โ the shortest route โ that no individual ant represents or even perceives. The solution emerges from local interactions plus feedback.
Dorigo's Ant Colony Optimization (1992) turns this into math: artificial ants build solutions step by step, choosing the next move with probability โ pheromoneฮฑ ร heuristicฮฒ, then deposit pheromone inversely proportional to their solution's cost while a decay factor evaporates the rest. It's used for vehicle routing, network packet routing, scheduling, and other hard combinatorial problems.