NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)


This is an extention "Ants", a model included in the default model library of NetLogo.
In this project, a colony of ants forages for food. Though each ant follows a set of simple rules, the colony as a whole acts in a sophisticated way.


When an ant finds a piece of food, it carries the food back to the nest, dropping a chemical as it moves. When other ants "sniff" the chemical, they follow the chemical toward the food. As more ants carry food to the nest, they reinforce the chemical trail.


Click the SETUP button to set up the ant nest (in violet, at center) and three piles of food. Click the GO button to start the simulation. The chemical is shown in a green-to-white gradient.

The EVAPORATION-RATE slider controls the evaporation rate of the chemical. The DIFFUSION-RATE slider controls the diffusion rate of the chemical. There is an on-off PLOT? switch. Turning off the plotting lets the model run faster.

If you want to change the number of ants, move the POPULATION slider before pressing SETUP.

The original sliders were teaked a little to add functionality.

You can click the screen to add food.

AMOUNT-OF-WIGGLE is a parameter that controls how much the ants divate from a straight path. It randomly chooses a number from a normal distribution and tells the ant to step slightly in that direction. The slider adjusts the standard deviation. If this slider is set to 0, the ants will walk in straight lines. If it is set higher than 100, the ants pretty much act like Brownian motion. Optimal wiggle is about 20.

LoS is an abbreviation for Line of Sight. This parameter tells the ant how far to the left and right it should ‘sniff’. Optimal value is about 40. Anything under 15 and over 150 seems to be dysfunctional.

CHEM-LOW-THRESHOLD tells the ant to ignore scents that are below this threshold. Setting this number to 0 lets the ants smell infinitely small amounts of pheromone. The optimal value for this seems to be dependent on the food source, amount of ants, evaporation-rate and diffusion-rate.

CHEM-UPPER-THRESHOLD tells the ants to ignore the difference in scent for pheromone over this threshold. The optimal value for this seems to be dependent on the food source and the amount of ants.

RETURN-WIGGLE is a switch that when on lets ants with food wiggle as much as ants without food. When this is switched off, ants returning with food walk in a straight line towards the nest.


The ant colony generally exploits the food source in order, starting with the food closest to the nest, and finishing with the food most distant from the nest. It is more difficult for the ants to form a stable trail to the more distant food, since the chemical trail has more time to evaporate and diffuse before being reinforced.

Once the colony finishes collecting the closest food, the chemical trail to that food naturally disappears, freeing up ants to help collect the other food sources. The more distant food sources require a larger "critical number" of ants to form a stable trail.

The consumption of the food is shown in a plot. The line colors in the plot match the colors of the food piles.


Try different placements for the food sources. What happens if two food sources are equidistant from the nest? When that happens in the real world, ant colonies typically exploit one source then the other (not at the same time).

In this project, the ants use a "trick" to find their way back to the nest: they follow the "nest scent." Real ants use a variety of different approaches to find their way back to the nest. Try to implement some alternative strategies.


Copyright 1997 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:
a) this copyright notice is included.
b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was developed at the MIT Media Lab using CM StarLogo. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, MA: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 1998.

(back to the NetLogo User Community Models)