NetLogo is a software package that provides a programming environment for exploring, building and publishing agent-based models for use in research and education. It has been developed by Prof. Uri Wilensky at the Center for Connected Learning and Computer-Based Modeling (CCL) of NorthWestern University, USA. You can use its graphical user interface to explore and interact with a huge range of sample models that come with it. It provides a place for the (sample) models to provide documentation to the user in a consistent manner. Moreover, the environment provides access to the programming code of the model itself, written in the Logo language extended to support agent models. A lot of the routine operations to run, control and visualize the model is taken care of by the NetLogo package, so you can focus on programming the logic that is particular to your model.
NetLogo provides three types of agents to work with:
patchesrefer to cells in a grid. They function as a cellular automaton,
turtlesare free roaming agents that move through space without being confined to a grid,
linksare used to establish connections between turtles and allow you to construct a network model.
These three different types of agents allow you to construct hybrid models that include properties of both cellular automata (through the grid of
patches) and agents roaming freely through continuous space (the
turtles). As such the patches provide a background landscape through which the agents can move around. In addition, you can construct graphs with arbitrary connections (
links) between the nodes of the graph (the
NetLogo is probably one of the most accessible packages for getting started with agent-based modeling. If you are new to agent-based modeling and need to analyze and build your own models with little programming effort, this is the place to go. You can easily use it online or install NetLogo on your own computer (for improved performance). It does not take much space. Once installed, some of its most commendable features include:
- its easy-to-use Graphical User Interface, with an attractive and insightful default visualization of your model,
- the ability to adapt the GUI to your needs, easily moving, adding and implementing additional controls,
- most of the routine work of responding to the controls, running the simulation and visualizing the results is done for you, so you can focus on the model logic,
- very good documentation,both for the package itself and it encourages the models to be well-documented too,
- it comes with an extensive library of sample models, which are also well-documented and interesting enough to explore by themselves. You can build your own models from scratch or simply start with a pre-existing sample model and adapt it to your own needs.
The NetLogo package has been built for educational purposes. Although its ease of use may be convenient for researchers who are less familiar with programming themselves and/or don't want to waste their time on the routine operational programming tasks for running a model, it does lack some features for those who need to do more sophisticated analysis. The graphical visualization of the model maybe instructive while exploring the models, it also slows the simulations down considerably. You can turn of the updates of the view, which often speeds up the simulations considerably, but still: running simulations in NetLogo is relatively slow. For actual research applications, you usually need to explore results from multiple model runs at different settings and initial conditions of the model and perform more sophisticated analyses than plotting the results in a graph. NetLogo is not designed for such batch processing of multiple model runs. Since Logo is a full-featured programming language, you can implement such explorations of multiple model inputs by yourself, but then you lose much of the advantages of using NetLogo to do the routine processing for you.
Besides for agent-based modeling as described above, NetLogo can be used to analyze Dynamical Systems, solving (ordinary) differential equations and mappings/difference equations. It lacks tools for dedicated techniques such as continuation of stationary points, stability analysis and bifurcations though. Where NetLogo would be your first choice for agent-based modeling, there are better packages more suitable for the analysis of Dynamical Systems. The same holds good for Netwrok Theory. It is possible in NetLogo, but lacks sophisticated tools dedicated to those branches of Complex Systems Theory.
To summarize, the main weaknesses of NetLogo include:
- no built-in support for batch processing of model runs at different model settings;
- limited support for input/output to save your data;
- more sophisticated data analysis of the results beyond plotting graphs is lacking,
- in particular if you want to analyze Dynamical Systems (ODEs/mappings) or Network Dynamics, there would be more suitable packages,
- since your code is (partly) interpreted while running your model, performance is relatively slow. If your application requires high performance, it may be better to code entirely in a different (compiled) language yourself,
- the Logo language (dialect) you use for your NetLogo models, while very suitable for its aim of modeling agents, is a non-standard language. You might be better off learning a more widely used programming language instead.
It is possible to run NetLogo without installing any new software on your computer by using your browser to access NetLogo Web. However, downloading and installing NetLogo locally on your computer is recommend as it generally increases performance (unless you have a very slow computer and a very fast internet connection) and some NetLogo feature are not (yet) available through NetLogo Web. Downloading and installing NetLogo is not difficult and does not require much space on your hard disk. You can access NetLogo Web or download NetLogo Desktop through the buttons on the NetLogo homepage. The latter will bring you to the NetLogo download page. You can use NetLogo free of charge, but you are expected to leave your name, organisation and email address. Next you choose the operation system for which you are downloading the installer. After downloading is complete, you run the installer wizard to install NetLogo on your computer and you are ready to get started with agent-based modeling.
As mentioned above, one of the strong points of NetLogo is its documentation. You can find the NetLogo User Manual on the NetLogo website, but after installing NetLogo on your computer it is also available locally without internet connection: from within the NetLogo application, you can access it through the Help menu. The User Manual contains a series of three tutorials that will teach you everything you need to know to get started:
- Tutorial #1 introduces the Graphical User Interface. It teaches you how to find, open and run existing models and interpret their output.
- Tutorial #2 provides you with a first introduction of some basic commands to interact with a running model directly. It teaches you how to give commands to the main type of agents in the NetLogo environment:
- Tutorial #3 guides you through the process of building your own model from scratch. I teaches you how to build the Graphical User Interface to interact with your model as well as how to use the code tab to implement the behaviour of your model in response to the user interface and to tell the agents in your model what to do.
After working through these three tutorials, you will be ready to build your own models or adapt existing ones. Whenever you come across a feature that you need to know more about, you can check the Programming Guide section in the User Manual. In particular, important topics that have not been covered in the tutorials and you are likely to run into are: how to deal with
breeds, which allow you to distinguish between multiple types of agents, and on
links, should you want to work with network models.
NetLogo comes with an extensive Model Library with sample models on a wide range of topics, from Sociology, Psychology and Economics, through Biology to Chemistry, Physics and Earth Sciences. You can access the Model Library from within NetLogo through the File menu. By all means, you are encouraged to explore this Model Library by yourself, but below I will recommend a few to start with that are my favourites as they illustrate some key features of agent-based models and their emergent behaviour:
Predator-prey model (with resources)
In the Biology folder of the Sample Models, you will find the model called Wolf Sheep Predation. This model is used in Tutorial #1 to illustrate operating NetLogo's Graphical User Interface, so you can learn more about the model by working through that tutorial. As for all NetLogo Sample Models, you can also find a lot of information about the model in the Info tab. It is a standard agent-based predator-prey model in which wolves (the predators) and sheep (the prey) move around randomly. When a sheep meets a wolf, the sheep gets eaten. Wolves die from starvation if they don't eat enough. Both wolves and sheep reproduce at a fixed rate. As you see the wolves and sheep wandering through the NetLogo world, you clearly see the principle of an agent-based model in action. The interface also allows you to activate a third element of the model: grass. If you turn that on, the model keeps track of the grass that is eaten by the sheep. The sheep don't only die from being eaten, but also from starvation. Since the grass does not move, it is modeled by fixed patches. Hence that part of the model behaves more like a cellular automaton. This is what I mean when I say that NetLogo allows for a hybrid mix between cellular automata and (free-roaming) agent-based models in the traditional sense.
Of course, you would do well to start with the recommended settings for the model as suggested in the tutorial and on the Info tab, but you can play around with far more extreme changes of the setting to. According to the description of the model, the default setup of the model is unstable in the sense that one (or both) of the species will die out in the long run. You may want to take up the challenge to try to set up the initial conditions such that the wolves and sheep will coexist for more than a few oscillations. In fact: if you make the size of the model much larger (by right-clicking on the world view and choosing Edit, or by clicking the Settings button) you may get interesting oscillatory spatial dynamics of waves of wolves that seems to chase and encircle flocks of sheep, but then die because they ate all of the sheep they were chasing. However, if you made the world big enough, there may still be some stray sheep left somewhere that may revive the entire process. In the picture, I used a grid of 500 x 500 (instead of the default 50 x 50; and reduced the patch size from 10 to 1 pixel so it would take up the same size on the screen).This does not seem like normal behaviour for wolves and sheep any more, but may resemble populations of insects or grasshoppers that reproduce into huge swarms until they destroy the entire crops that they feed upon. This illustrates that the same model can describe rather different behaviour by using different settings.