Ant Colony
Hundreds of ants build pheromone trails to food; turn on births and deaths, place spiders or pit two colonies.
- Ant
- Carrying food
- Nest
- Food
- Home scent
- Food trail
Ants wander from the nest, lay a blue home trail, and lay an amber food trail on the way back with food. Paint food, rich food or walls, erase them, tap to place a nest or a spider, and watch new trails form; Rerun starts again from step 0 with what you placed. A spider's catches leave red alarm scent that ants turn away from.
How is Ant Colony working for you?
About Ant Colony
- Model
- Pheromone trail foraging with two scents (Deneubourg and colleagues 1990)
- World
- 1,000 × 1,000 units, scent on a 200 × 200 grid, up to 3,000 ants
- Evaporation
- 0.1–2% of the scent per step; at 0.4% a food trail halves in about 170 steps
- Colony life
- Food store, response thresholds (Bonabeau and colleagues 1996), brood and lifespans
- Fights
- Lanchester's square law (Franks and Partridge 1993)
Good for: Learning by watching
Ant Colony simulates how a colony of ants finds and gathers food with two scents and no leader. Each ant smells the scent at three points 20 units ahead of it, in a field 1,000 units across: straight ahead and to the left and right. A searching ant lays home scent and follows food scent; an ant carrying food lays food scent and follows home scent. A mark is strongest where the ant last left the nest or the food and weakens by 0.2% with every step after, so trails point at their source. Coordination through marks left in the environment is called stigmergy (Grassé 1959; Camazine and colleagues 2001).
The Pheromones controls set how ants read and keep the scent. Sensor angle is the angle between the straight-ahead sample and the side ones, 34° by default; each step an ant turns 17° to 26° toward the side that smells stronger. Sensor reach sets how far ahead the samples sit, 20 units or 4 scent cells. Wander adds a random turn of up to 7° either way each step. Evaporation is the share of the scent each cell loses per step: at 0.4% a food trail halves in about 170 steps, and home scent fades 0.3 times as fast. Spread passes a share of each cell's scent to its four neighbors every third step, 3.75% to each at 0.15. A loaded ant that smells nothing heads straight for the nearest nest, as desert ants do by path integration (Müller and Wehner 1988).
Births and deaths gives the colony a life cycle. A food store feeds every worker, Food eaten crumbs per 1,000 steps each, and deliveries refill it; while it is empty each worker has a 1 in 4,000 chance per step of starving. Workers hatched from the brood wait in the nest and go out by response thresholds: each has its own threshold, and its chance of leaving rises as the store falls below 2,000 steps of food (Bonabeau, Theraulaz and Deneubourg 1996). The queen lays Egg laying eggs per 1,000 steps while the store holds food; each egg costs 1 crumb and becomes a worker 2,000 steps later. Each worker lives about Lifespan steps, give or take 20%, so a well-fed colony levels off near Egg laying × Lifespan ÷ 1,000 workers, 2,000 at the defaults.
A Spider waits in one place and takes the nearest ant within 15 units with a chance of 50% per step, then spends 10 steps eating it. Each catch raises a third scent, alarm, to full strength within 30 units; it loses 4% per step and is gone after about 230 steps. Ants subtract twice the alarm from the scent they follow, so trails bend around the spider, and a hungry colony weighs alarm less, as hungry animals take more risks (Lima and Dill 1990). In Rival colonies two colonies share the field, each with its own scents, store and queen. Where their ants meet within 15 units they fight: each enemy there kills with a chance of 1% per step, shared among the allies there, so the larger local group loses fewer and kills more, Lanchester's square law as Franks and Partridge applied it to ants (1993). Rich food starts a trail three times as strong, and the colony takes more from the richer of two piles (Beckers, Deneubourg and Goss 1993).
The Double bridge repeats the experiment of Simon Goss and colleagues (1989): two branches, one about 2.3 times as long as the other, lead to the same food, and because ants on the short one return sooner its trail grows faster until the colony uses it. Growing colony, Spiders, Rival colonies and Rich and poor food each ask one question that the Colony chart, the readout or the trails answer.
How to use Ant Colony
- Pick a scene. Start with Nest and food piles, the Double bridge, Obstacles, Two nests or an Empty field, or with one of the colony scenes: Growing colony, Spiders, Rival colonies or Rich and poor food.
- Watch the trails form. Blue shows the home scent left by searching ants; amber shows food trails laid by ants carrying food. Ants with food are drawn green, and red marks alarm scent around a spider's catches.
- Paint the world. Choose Food, Rich food, Wall or Erase and drag on the canvas, or tap with Nest or Spider to place one. Moving food or blocking a trail with a wall makes the colony search and settle on a new route. Rerun starts a new colony from t = 0 on the world as painted, with every food pile full; Restart clears the painting and starts the scene again; Reset also returns every setting to its default.
- Tune the ants. Sensor angle and Sensor reach set where ants smell, Wander adds random turns, Evaporation sets how fast trails fade and Spread how much they blur. The ? beside each setting explains it with numbers.
- Turn on Births and deaths. In Colony, Births and deaths adds a food store, a queen and brood, aging and starvation. Food eaten, Lifespan and Egg laying set how much each worker eats, how long it lives and how fast the queen lays; the Colony chart plots workers, brood and the store.
- Read the charts. The Foraging chart plots how many ants are carrying food and how many crumbs reach the nest. In Rival colonies the Colonies chart follows the workers of each colony, and the readout under the charts counts deaths by cause.
- Export. Save a PNG or record a short video or GIF of the colony at work. Record 30 s from the start runs the same setup again from the beginning and records its first 30 seconds, frame by frame.
Frequently asked questions
How do real ants find the shortest path?
By reinforcing it: ants that take a shorter route get back sooner and mark it more often, so its trail grows while longer ones fade. In the double-bridge experiment of Goss and colleagues (1989), Argentine ants given two routes to the same food came to use the shorter one. The Double bridge scene repeats it with a long branch about 2.3 times as long as the short one.
What does pheromone evaporation do?
It lets a colony forget routes it no longer uses. Every cell of scent loses a share each step, so a trail lasts only while ants keep laying it: at the default 0.4% per step a food trail halves in about 170 steps. Ant colony optimization (Dorigo, Maniezzo and Colorni 1996) evaporates its simulated pheromone for the same reason, so early choices can be forgotten.
How long do worker ants live?
Far shorter than their queen. Ant queens can live nearly 30 years and up to 10 times longer than workers (Jemielity and colleagues 2005), and workers that do the risky work outside the nest age faster than those inside (Chapuisat and Keller 2002). In this simulation Lifespan sets a worker's mean life, 10,000 steps by default, give or take 20%.
What happens when an ant colony runs out of food?
It shrinks: the queen stops laying and workers die faster than new ones hatch. Fire ant colonies followed through a year by Walter Tschinkel (1993) shrank in the months when worker deaths exceeded births and grew when births exceeded deaths. With Births and deaths on, an empty store stops egg laying and gives each worker a 1 in 4,000 chance per step of starving; the Growing colony scene rises to about 2,000 workers and falls when its piles run low.
How do ants respond to predators?
With alarm scent, and by weighing food against danger. Ants near an attack release alarm pheromone that alerts the workers around them (Wilson 1958). In the experiment of Nonacs and Dill (1990), 12 Lasius pallitarsis colonies valued a food patch guarded by a predatory ant as highly as a safe one where the extra colony growth offset the foragers lost. In the Spiders scene each catch raises alarm that fades within about 230 steps, and the trails bend around the spider.
What is stigmergy?
Coordination through changes left in the environment, where one individual's trace guides the next. Pierre-Paul Grassé named it in 1959 after watching termites build, and ant pheromone trails are the standard example (Camazine and colleagues 2001).
What are the colors of trail?
Blue is the home scent that searching ants lay as they leave the nest, and ants carrying food follow it back; it fades 0.3 times as fast as the amber food trail that returning ants lay and searching ants follow. In Rival colonies the second colony's home scent is teal and its food trail rose. Red is alarm scent around a spider's catches.
Is this related to ant colony optimization?
Yes. Ant colony optimization solves routing and scheduling problems with simulated ants and evaporating pheromone; Marco Dorigo, Vittorio Maniezzo and Alberto Colorni described its first form, the Ant System, in 1996. This simulator shows the biological behavior that inspired it.
Is this a scientific model?
It is a teaching model built from published mechanisms: trail laying and following (Deneubourg and colleagues 1990), response thresholds (Bonabeau and colleagues 1996), alarm scent (Wilson 1958) and Lanchester battles (Franks and Partridge 1993). Its numbers are model settings chosen so a run plays out in minutes, not measurements of any species, among them the starving chance, the 2,000 steps from egg to worker, the spider's reach and the chance of a fight.
References
- Goss, S., Aron, S., Deneubourg, J.-L., & Pasteels, J. M. (1989). Self-organized shortcuts in the Argentine ant. Naturwissenschaften 76, 579–581.
- Deneubourg, J.-L., Aron, S., Goss, S., & Pasteels, J. M. (1990). The self-organizing exploratory pattern of the Argentine ant. Journal of Insect Behavior 3, 159–168.
- Grassé, P.-P. (1959). La reconstruction du nid et les coordinations interindividuelles chez Bellicositermes natalensis et Cubitermes sp. La théorie de la stigmergie. Insectes Sociaux 6, 41–80.
- Camazine, S., Deneubourg, J.-L., Franks, N. R., Sneyd, J., Theraulaz, G., & Bonabeau, E. (2001). Self-Organization in Biological Systems. Princeton University Press.
- Müller, M., & Wehner, R. (1988). Path integration in desert ants, Cataglyphis fortis. Proceedings of the National Academy of Sciences 85(14), 5287–5290.
- Dorigo, M., Maniezzo, V., & Colorni, A. (1996). Ant system: optimization by a colony of cooperating agents. IEEE Transactions on Systems, Man, and Cybernetics, Part B 26(1), 29–41.
- Bonabeau, E., Theraulaz, G., & Deneubourg, J.-L. (1996). Quantitative study of the fixed threshold model for the regulation of division of labour in insect societies. Proceedings of the Royal Society B 263, 1565–1569.
- Gordon, D. M. (1996). The organization of work in social insect colonies. Nature 380, 121–124.
- Prabhakar, B., Dektar, K. N., & Gordon, D. M. (2012). The regulation of ant colony foraging activity without spatial information. PLoS Computational Biology 8(8), e1002670.
- Schmid-Hempel, P., & Schmid-Hempel, R. (1984). Life duration and turnover of foragers in the ant Cataglyphis bicolor. Insectes Sociaux 31, 345–360.
- Hölldobler, B., & Wilson, E. O. (1990). The Ants. Springer.
- Jemielity, S., Chapuisat, M., Parker, J. D., & Keller, L. (2005). Long live the queen: studying aging in social insects. AGE 27(3), 241–248.
- Chapuisat, M., & Keller, L. (2002). Division of labour influences the rate of ageing in weaver ant workers. Proceedings of the Royal Society B 269, 909–913.
- Tschinkel, W. R. (1993). Sociometry and sociogenesis of colonies of the fire ant Solenopsis invicta during one annual cycle. Ecological Monographs 63(4), 425–457.
- Oster, G. F., & Wilson, E. O. (1978). Caste and Ecology in the Social Insects. Princeton University Press.
- Holling, C. S. (1959). Some characteristics of simple types of predation and parasitism. The Canadian Entomologist 91(7), 385–398.
- Wilson, E. O. (1958). A chemical releaser of alarm and digging behavior in the ant Pogonomyrmex badius (Latreille). Psyche 65, 41–51.
- Nonacs, P., & Dill, L. M. (1990). Mortality risk vs. food quality trade-offs in a common currency: ant patch preferences. Ecology 71(5), 1886–1892.
- Lima, S. L., & Dill, L. M. (1990). Behavioral decisions made under the risk of predation: a review and prospectus. Canadian Journal of Zoology 68(4), 619–640.
- Franks, N. R., & Partridge, L. W. (1993). Lanchester battles and the evolution of combat in ants. Animal Behaviour 45(1), 197–199.
- Batchelor, T. P., & Briffa, M. (2011). Fight tactics in wood ants: individuals in smaller groups fight harder but die faster. Proceedings of the Royal Society B 278, 3243–3250.
- Adams, E. S. (1990). Boundary disputes in the territorial ant Azteca trigona: effects of asymmetries in colony size. Animal Behaviour 39(2), 321–328.
- Beckers, R., Deneubourg, J.-L., Goss, S., & Pasteels, J. M. (1990). Collective decision making through food recruitment. Insectes Sociaux 37, 258–267.
- Beckers, R., Deneubourg, J.-L., & Goss, S. (1993). Modulation of trail laying in the ant Lasius niger and its role in the collective selection of a food source. Journal of Insect Behavior 6, 751–759.




