NetLogo: A tool to help you learn more than programming

We are here exploring a multi-agent programming environment which simulates natural and social phenomena. NetLogo can simulate complex systems that develop over time. By giving suitable programming instructions to ‘agents’, modellers can explore the connection between the micro-level behaviour of individuals and the macro-level patterns that emerge from their interaction.

Life does not consist of isolated ‘turtles’. There are many turtles/agents and they interact with each other. The surprising thing is that the seemingly complex, intelligent behaviour of many such agents can be modelled by remarkably simple interactions between them (for example, how migrating birds fly in the V-formation). NetLogo is a tool to help you model and study the complex behaviour that originates from simple interactions. It is available at

NetLogo is also a visual environment in which you create a number of turtles of multiple breeds, e.g., wolves and sheep, and study the dynamics of the world based on simple rules.

Its user interface consists of three tabs—interface, information and code.

A model requires two functions—Setup and Go (the names are just a convenient convention), which are created as buttons on the interface tab.

  • Setup is the function you write to initialise and set up the world.
  • Go is the function that is executed at a time interval. You can set the option for it to run forever.
    The code for the functions is written on the code tab. You may provide information about the model in the information tab.

The evolution of the world when you click the Go button is also shown on the interface tab.
The best way to learn NetLogo is to study the models that are included in the distribution.
An example is a line of ants. The leader ant moves towards the food using random movements; however, the ants that follow move in a line! The seemingly smart behaviour of the ants can be simulated as follows:

The code to achieve consists merely of the delay between two successive ants leaving the nest and each ant, other than the leader, moving towards the previous ant. If the delay is just 1 unit, the ants follow almost the same path as the leader. If the delay is 3 units, the path is close to a straight line.

Figure 1: NetLogo in action

In computer science models, it is nice to see the visualisation of the dining philosophers. You may want to speed up the simulation and observe the occurrence of a deadlock.

Given the interest in weather change, you may be interested in the earth science models. Some of the results would seem very reasonable; for example, the spread of a fire in a forest depends on the density of the trees. However, the non-linear increase in the extent of damage is disconcerting. The simple model just looks for a tree in the vicinity of each burning tree to determine whether the fire will continue or stop.

An example of a model that was not very obvious to me was that of the termites in the biology group.

The termites follow a set of simple rules. Each termite starts wandering randomly. If it bumps into a wood chip, it picks the chip up, and continues to wander randomly. When it bumps into another wood chip, it finds a nearby empty space and puts its wood chip down. With these simple rules, the wood chips eventually end up in a single pile.

Finally, here’s a model which affects us all–traffic. The basic traffic model illustrates the phenomenon of jams occurring for no apparent reason as the density of vehicles on the road increases. Apart from the number of cars on the road, the parameters affecting the jams are the acceleration and deceleration rates.

The true benefit of NetLogo and similar tools lies in modelling strategies before implementing policies and, hence, minimising adverse side effects. For example, it would make sense to first evaluate the implications and risks of an HR policy on increments and promotions, and study its effect on productivity, attrition, cooperation, etc, before implementing it.



Open source for you


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s