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)

[no screen shot for this model]

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 extension of "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.


The original framework was designed by Uri Wilensky (see copyright notice below) with extensions made by Andrew Erickson. Extensions were made in collaboration with the Prof. Adam Norris Ant Seminar Class at University of Colorado at Boulder (APPM 4950, Fall '10).


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 brown, at center) and three piles of food. Click the GO button to start the simulation. The chemical is shown in a black-to-green-to-white gradient. Play with the user defined variables to find the best colony characteristics.


If you want to change the number of patroller ants (ants that don't go away), move the POPULATION slider before pressing SETUP. More patrollers means you find food faster but the base level of energy usage costs more.

The EVAPORATION-RATE slider controls the evaporation rate of the chemical. The DIFFUSION-RATE slider controls the diffusion rate of the chemical.

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 with 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.

The two reporter windows below these sliders tell us what area is covered by chemicals. LOW CHEM AREA tells us the amount of area that has more than the lower threshold of chemicals ants can 'smell'. UPPER CHEM AREA tells us the area ants will cover when on a hot trail (what area).

There is a window that ants foragers use to decide to leave the nest. If the total chemical within a circle of 6 patches from the nest center satisfies the window conditions, ant foragers will leave the nest. LEAVE-(LOW/HIGH)-CHEMICAL adjusts the window.

FORAGER-FLOW is the amount of ant foragers that come out of the nest when the window conditions are met. If there are over 1000 ants, no more will come out. This is to protect the program from having an ant explosion. If you want to change this you can modify the code:
if ;Ticks Mod 10 = 0 and
count turtles < 1000 and
window = 0 and

If an ant does not find food within DEATH-FROM-HUNGER ticks it will die. Another way of thinking of this parameter is that the ants just goes back into the nest and waits for the window conditions to be met again.

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.

If ADD FOOD WITH CLICK? is on, you can add food with a mouse click, but the program will become very slow. 'Food-per-Energy' won't work if you add food.


There is a PLOT? switch. If off plotting will be disabled and the model runs faster.

FOOD IN EACH PILE graphs the amount of food in each of the four food piles. The red line is the user added food.

NUMBER OF FORAGERS graphs the amount ant foragers at any one time.

SIGNAL TO LEAVE graphs the amount of chemical within a 6 patch radius of the nest.

ENERGY is the total power throughout time used. See Power below for more details

POWER sums the amount of ants outside the nest adds and the amount of chemical being used. Each of these sums is weighted with the sliders below: ANT-COST and CHEM-COST.

FOOD-PER-ENERGY is the ratio of food gathered to energy spent. The best ant colonies will maximize this. The reporter window tells us at that particular tick what the food/energy is and the graph below measures it throughout time.


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)