The travelling salesman problem, or TSP to its aficionados, is one of a select band of computational puzzles that has broken heads for decades.
Like all true brain-benders, the problem is easier to state than to solve. Imagine that you're travelling in monogrammed left-handed belly-button warmers and you have to hawk your fluffy-yet-stylish wares to department-store buyers up and down the land.
It will save time and fuel if you work out the shortest possible itinerary that takes you to each destination just once and gets you back home. Easy? In computerspeak, the TSP is known as "NP-hard", which means that it reduces grown programmers to jelly, and there is no known general solution.
But there is a new way to approach the problem. It is kind of zen: rather than throw even more brains at the problem, divide up your brainpower into individual units, each of which is little more than a mindless automaton. But before that, look at the ground.
Looking? If you are, you will see nature's perfect answer to distributed-systems programming - the ant. Ants and other social insects such as termites, bees and wasps live in sophisticated, highly centralised societies that appear to live by a complex series of rules.
But they have no written records or laws, nor even instructions badly typed, upside-down and in Finnish. And you could probably count the smarts inside the brain of any one ant on the fingers of one thumb.
So how do ants and other insects forge their complex societies? The answer lies in distributed-systems programming in which a solution grows out of the combined activities of a large number of near-autonomous units, in other words, a pile of little-bitty busy little pismires.
Here, then, is the route to formic success: as each ant forages, it leaves a trail of pheromone scent for other ants to follow. The routes to the best sources of food are likely to be the best-trodden, and so richest in pheromones.
But pheromones evaporate in time, allowing ants to track shifting resources flexibly. And that's more or less it. There is no central planning or other organisation - the appearance of order grows out of the behaviour of thousands of individuals, a kind of "swarm intelligence". Ant colonies are what researchers call "self-organsing" phenomena, rather like Spike Milligan's self-made giraffe, mentioned in despatches for making himself from sawdust, string and patches.
Using "ant colony optimisation", or ACO, researchers have been able to tackle problems such as the TSP using far less computer time than taken up by other approaches.
An artificial software "ant", playing the part of the travelling salesman, will visit a string of destinations, laying notional cyber-pheromone in an amount proportional to the success of its tour. Subsequent ants tend to follow existing pheromone trails that are the strongest - after a few runs, a solution emerges.
ACO and related distributed-systems approaches are of immense practical importance. Unilever is believed to be using ACO in planning factory scheduling, and petrol tankers in Italian Switzerland are routed to petrol stations using an ant-inspired algorithm.
Switching strategies in telecommunications networks are naturally suited to take a tip from ants: British Telecom and MCI-Worldcom use switching systems based on ant foraging behaviour.
"The initial appeal of Swarm Intelligence to computer scientists was almost entirely due to their fascination with ants," wrote Eric Bonabeau of the Santa Fe Institute, New Mexico and colleagues in a recent article in Nature. But the fascination works both ways - entomologists are beginning to get worked up about robotics, to the benefit of both approaches.
In today's issue of Nature, the entomologist Laurent Keller of the University of Lausanne, Switzerland, and colleagues use their rich haul of data about real-life ant behaviour to design robot swarms. Each ant is represented by a pepperpot-sized robot; the robots search for tokens (resources) on a nine-square-metre surface, and bring them back to a base station (nest).
Using extremely simple programming, Keller and colleagues found that there is an optimum number for robot foragers: too few, and resources lay unfound, too many, and the robots kept bumping into one another.
This finding paralleled what they had found in real life: ants tend to have foraging parties of a certain size.
In another parallel to insect societies, the group foraging effort became much more efficient if a robot could "recruit" another for a foraging trip to exploit resources, especially if they were clustered in certain areas. The researchers' robot swarm behaved uncannily like ants, even though each robot was programmed in an extremely simple way and behaved essentially autonomously.
• Henry Gee's Book Deep Time: Cladistics, the Revolution in Evolution, is published by Fourth Estate, price £20.