Swarm intelligence is a property of a system of locally-interacting, unsophisticated agents which results in a global pattern emerging. Swarm intelligence is an emergent behaviour of such systems, that can result in collective and distributed methods of problem solving, using simple agents with no centralised control and no explicit model of their environment.

The agents should be able to interact with their local environment by sensing it and being able to change it. Swarm intelligence requires self-organisation, and for this to arise in any system, there are four mechanisms that must exist:

  • Multiple interactions - there must be many simple, interacting agents, usually with each following the same basic set of rules. If there was only one simple agent, nothing interesting can happen. If there are many simple agents but they do not interact, nothing interesting can happen. The agents must interact for behaviour beyond that of their rules to emerge.
  • Positive feedback - reinforcement of popular actions made by agents. Positive feedback is when an event occuring results in a greater chance of the same event happening again.
  • Negative feedback - if we have positive feedback, we need negative feedback to regulate the system and prevent it from running away into chaos. Negative feedback is when an event occuring results in a lesser chance of that event occuring again.
  • Amplification of fluctuations - a side effect of positive feedback. If something small happens in the system, positive feedback makes it more pronounced (see butterfly effect).

Ants are simple organisms, and on their own, they are capable of very little in the way of intelligent behaviour but in groups, they are capable of performing complex tasks that require some degree of intelligence. For instance, they are capable of finding food sources, communicating its location to other ants and finding the shortest path between the nest and the food, thus reducing wasted energy in harvesting the food.

Ants communicate by laying down trails of pheromones for other ants to follow. This allows for the multiple interaction mechanism to exist between the ants. These pheromones evaporate (negative feedback) unless more ants travel on the same trail, laying down more pheromones as they go. This is positive feedback and amplitude of fluctuations.

On emerging from the nest, an ant may 'choose' to follow an existing pheromone trail to a known food source, or choose to randomly walk in a different direction. Since the ant is basically stupid, this is a true random walk unless it is directed by some other pheromone trail. If this ant discovers a new food source, it will travel back to the nest laying down a new pheromone trail. If more ants find this trail, they may follow it to the nest or the food, reinforcing the trail as they go (positive feedback). If the food source is plentiful, more ants will follow this trail and the trail gets stronger. Thus more ants will follow it over a weaker trail to a lesser food source. As the food declines, less ants will follow it and other trails may become favoured again (negative feedback).

To explain how ants find the shortest path, consider two ants that leave the nest at the same time. One finds a near food source, while the other finds a food source twice as far awawy. By the time the first ant has returned to the nest, its pheromone trail has been laid down twice while the other ant has only just reached its food so its trail has only been laid down once, so other ants are more likely to follow the trail to the nearer food. As ants find shorter and shorter routes, those routes will be used more often simply because they take less time to traverse so the pheromones will be laid down more often.

This behaviour can be simulated in computers to solve problems like the Travelling Salesman problem. If numerous 'ants' are released onto the network, they can use exactly this technique to find the shortest path. This can also be used to route network traffic down faster routes by laying down a virtual pheromone trail inside the network as the packets are transmitted.