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


To survive in nature, flying insects have to look for food. They often do so without any cues and hence require a sort of strategy to maximise their food gain. It has been observed that insects can have different strategies (Bell, 1990) . Two of them are:

1. Straight movement for a random distance with occasional random turn
2. Straight movement for a random distance with occasional random turn associated with spiral movement at a reduced speed when food is located.

In this model, two agents are set to employ the above two strategies. We are interested in monitoring the amount of food that can be consumed using each of the above strategies. Theory (Bell, 1990) suggests that the strategy that allows for spiral movement increases the chance of better food consumption since in reality food patches tend to occur close to each other.

Using this model, we would like to view this prediction.


(Bell, 1990) Bell, W.J. (1990). Searching behaviour: The behavioural ecology of finding resources. London: Chapman and Hall.


The model consists of two types of agents: butterflies and bees. Initially, the food consumption for each of them is set to 0 and they are created at the centre of the patch screen. Green patches imply that their is no food whereas red patches represent food that can be consumed by the agents.

The two agents [butterflies and bees] employ two different strategies to search for food. The butterflies are set to move forward randomly for a dstance between 0 and 49 units in a random direction between 0 and 359 deg and then to check whether the patch they land on is a red patch. If so, the butteflies undergo a spiral movement for a given number of time, in step of 1 unit, each time verifying whether the patch they land on is a red patch [i.e. contains food]. After a given time [set inside the codes], the butterflies set off again in a random direction for a random distance. Each time, a butterfy agent lands on a red patch, a count is incremented to keep a record of the food consumed by the butterflies after which the red patch is turned into green.

For the bees agents, a different strategy is employed. They are set to move randomly for a distance between 0 and 49 units only in a random direction between 0 and 360 degrees. They do not implement the spiral movement. Everytime, a bee agent stops, the patch color on which the bee lands is verified. If it is red, the food consumption count for the bee is incremented and the patch color is turned into green again. Then the bee starts off the same straight line, random direction movemnt to search for more food.

The above process is repeated until their is no more red patched [i.e food] available. The plot and the monitors provide us with a visual representation of the number of food consumed by each agents [butterflies and bees].

The 'ratio' monitor is a ratio of [amount of food consumed by butterflies] to [the amount of food consumed by bees].


1. If a view of the trail taken by each agent is desired, set the 'trail?' switch to ON, otherwise leave it in the OFF position.

2. Select the number of agents desired [butterflies or bees] using the corresponsing slide bar. The number of agents that can be chosen range from 1 to 10.

3. Select the 'patch-distibution' desired. Selecting 'random' will randomly distribute the red patches, whereas selecting 'clusters' will distribute the patches randomly in clusters.

4. Use the slide bar for 'patch density' to set the amount of food patches [red patches] desired. A low density will imply less food patches.

5. Click on 'setup' to initialize the Model.

6. Click on 'go' to visualize and simulate the different food search strategies.

The plot shows the amount of food consumed by each agent groups [butterflies and bees].
The 'butterfly' and 'bee' monitors display the amount of food consumed.
The 'ratio' monitor display the ratio of [amount of food consumed by butterflies] to [the amount of food consumed by bees].


Different food search strategy allow agents to consume different amount of food. Given that the number of both agents is kept the same, it is observed that when agents undergo spiral movement, as in the case of butterflies, the amount of food consumed is always higher than when the agents undergo straight random movement, as illustrated by the bees. This is clearly visible by the plots and the ratio value which is always > 1.

However, it is noticed that as the density of food patches is increased from low to high, both strategies seem to provide for similar amount of food consumption. This can be seen by the plots getting closer to each other and the ratio value getting closer to 1.

Furthermore, it is noticed that when food patches are randomly distributed in clusters, search strategies involving spiral movements perform much better in getting more food than when agents undergo only random straight line movements. This difference in amount of food consumed is however less significant when the food patches are randomly scattered.


Set the number of agents for each of butterflies and bees to 1 and Set the 'trail?' button ON. Choose an average patch density, and select 'either random' or 'clusters' from the 'patch-distribution' menu. Set the speed of the simulation to low to see how the different path trails taken by each agents vary over time.


Other search patterns such as 'parallel movement', 'expanding square' and 'brownian motion' could be applied to see how the agents behave. Furthermore, in this model, the
spiral size was kept constant as well as the distance covered by the agents. Sliders could be added to convert these constants into variables and see the net effect.
Moreover, the model could be extended to accomodate other real life features like : death of an agent, energy of agent, repulsion among different breeds, presence of predators, birth of agents and so on


Most Netlogo models use the 'move' command to move turtles around patches. For this model, we are interested in modeling different movement styles, namely random straight lines movements with occasional random turns [for bees] and random straight lines movements with occasional random turns associated with spiral movement [for butterflies].


Despite the difference in movement mechanism for the agents, the current model can be related to the Sheep-Wolves model in NetLogo Model Library


The model is hosted at Indiana University, School of Library and Information Science available at

This project is part of the requirements for a Summer Workshop in Agent Based Modeling Techniques taught at the School of library and Information Science, Indiana University, USA.

The instructor was Dr Hamid Ekbia. This short course has led to a full semester course in Fall 08. Full syllabus and course details available at

The search strategies modeled here have been documented in "Bell, W.J. (1990). Searching behaviour: The behavioural ecology of finding resources. London: Chapman and Hall. "

(back to the NetLogo User Community Models)