Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Steven F. Railsback
Volker Grimm
Preface
In 2005, we published Individual-based Modeling and Ecology, which laid out our ideas
on why and how individual-based models can be used in ecology and, by analogy, in
many other fields. As we wrote that book we realized that a separate introductory book
on how to build and use agent-based and individual-based models was still needed—
with all the general and conceptual material to cover, we could not provide the practical
detail and examples needed for people to teach themselves and others how to get started.
Our goal in writing this book is to eliminate a barrier that currently limits use of agent-
based and individual-based modeling: in most research fields, few professors and
professionals are trained in the essential skills of simulation modeling and software
development. This situation is in stark contrast to statistical modeling: almost every
university department in every science has faculty skilled in statistics and expects its
students to develop some facility in statistical modeling. As individual-based and agent-
based simulation becomes an ever-more-important tool, we expect more and more
departments will want to offer classes while lacking instructors with the necessary
experience. We designed this book to help “bootstrap” the adoption of this new
technology by allowing researchers of all experience levels to get themselves and their
students started doing science with agent-based models.
We designed this book so it can be used by itself, but many of its users will benefit from
reading Individual-based Modeling and Ecology first or at the same time. Our first book
focused on conceptual aspects of how to design individual-based models and analyze
them to do science, and this book focuses on implementing and analyzing models on the
computer. Unlike Individual-based Modeling and Ecology, this book is not specific to
ecology: we intend it to be useful for the many fields in which a textbook on individual-
based or agent-based simulation is needed. Because the term “agent-based model”
(ABM) is widely used outside ecology, we chose to use the term “agent-based” in this
book. There have been historical differences between individual- and agent-based
models, but these differences are fading away and we consider the terms interchangeable.
Likewise, we also implicitly include and address “multi-agent systems”, a branch of
agent-based modeling that originated from computer science and research on artificial
intelligence and artificial life.
Course overview
This book and its supporting materials are designed both for people who want to learn
agent-based modeling by themselves and for introductory classes in agent-based
modeling for scientists. These classes could be offered in the many academic fields
(especially the biological and human sciences) in which ABMs are becoming an
important research tool, and could easily be interdisciplinary. The book is designed to
support instructors with little previous experience in simulation modeling or computer
programming, although such experience (perhaps in the form of a computer scientist co-
instructor) would be helpful.
The course is targeted to graduate students and advanced undergraduates who are starting
their research careers, but it is also appropriate for experienced scientists who want to
begin using agent-based modeling. No previous formal training in mathematical
Major themes
This course is not primarily about programming with NetLogo. Instead, this is a course
on how to do science using ABMs as a tool. We want to remove barriers to using ABMs
for addressing appropriate questions and problems, and to improve how they are used in
science. Therefore, throughout the course we emphasize several themes about doing
science:
(1) Using models for solving research problems. The primary characteristic of scientific
models is that they are designed to solve a specific problem about a specific system or
class of systems. These problems might include predicting how the system responds to
novel conditions, or just understanding the mechanisms that drive the system.
(2) Basing models on theory, and using models to develop theory. We focus on theory for
the agent-level adaptive behaviors that produce complex system behaviors.
(3) Learning and following the conventions and theory of scientific modeling. Modeling
is often treated as a completely intuitive process that lacks the standard procedures and
theory of (for example) statistical or chemical analysis. But there is, in fact, much that
modelers need to learn from our precedessors.
(4) Documenting models and testing software. These tasks are often treated by novices as
tedious distractions but they are in fact essential―and productive, and even sometimes
fun―parts of scientific modeling. And they are especially essential and productive for
agent-based models.
(5) Standardization. One of the biggest historic difficulties with ABMs is that the
standard “languages” we have for thinking about and describing other kinds of models
(especially, differential equations and statistics) are not sufficient for formulating ABMs.
Luckily, a great deal of recent work has gone into developing standards for ABMs, and
we emphasize their use. Throughout this book we will use a standard protocol (called
“ODD”) for describing models and a set of standard concepts for thinking about and
designing ABMs; and NetLogo itself is a standard language for programming ABMs.
Why NetLogo?
Choosing which software platform to use in this book was a critical decision for us. There
are now many platforms for agent-based modeling, and they vary in many ways. We
learned to use the most popular platforms and tried teaching several of them. This
experience led us to three clear conclusions. First, there is no one ideal platform:
platforms are inevitably compromises that cannot be best for all applications. Second, the
ABM platform situation is unstable; new platforms appear regularly while long-term
funding for maintenance and support of established platforms remains uncertain. But
third, we concluded that NetLogo stands clearly ahead of the others as a platform for
beginners and even for many advanced scientific models.
NetLogo provides a simplified programming language and graphical interface that lets us
build, observe, and use ABMs without needing to learn the complex details of a standard
programming language. NetLogo can be used for quite complex models, including many
used in real science published in real journals. Just as importantly, Uri Wilensky and the
NetLogo team at Northwestern University provide an extremely complete, helpful, and
Despite NetLogo’s capabilities, we expect that some students will eventually want more
programming flexibility and power, and faster execution speed. Therefore, we also try to
prepare interested students for additional training in programming and software
development. Upon finishing the material in this book, some students may wish to follow
with, for example, a class in Java programming and training in one of the IBM platforms
(e.g., Repast, MASON) that use Java.
Luckily, there are reasons not to fear NetLogo. First, NetLogo’s excellent documentation
and example models will be a great help to you and your students. And NetLogo is fun: if
you try to learn it completely by yourself, expect to have an initial hour or two of
The third thing we hope for from instructors is help keeping students from picking up bad
modeling habits that are unfortunately common in science. Our experience, after building
many ABMs, is that software that has not been tested seriously is very likely to contain
important mistakes, even with a platform as simple as NetLogo. And a written
description of the model is necessary for both scientific communication and software
testing. NetLogo encourages experimentation: it is very easy and fun to make little
changes and see their effect on the model. This experimentation is fine, but students need
to learn that they are not really modeling until they write down what they want their
model to do and why, and then provide solid evidence that their software is actually
doing what they wrote down. We hope instructors will do what computer programming
instructors do: treat assignments as incomplete unless software is accompanied with
documentation of (a) its purpose and design and (b) a serious attempt to find mistakes in
it. You will find your students making much more rapid progress with modeling after
these steps become habit.
needed in an ABM and how to represent agent behaviors. Then in Part III we move on to
analyzing models: the techniques we use to learn from and do science with ABMs.
Finally, in Part V we provide some direction to students that want to go further,
especially with alternatives to NetLogo.
A course using this book is expected to include both lecture and hands-on computer lab
time. We present many general modeling and software concepts that are best explained in
a lecture format. But most of the learning will take place in a computer laboratory as
students work on exercises, building, testing, and using their own programs and models.
For a college class, we envision each week to include one or two lecture hours plus at
least one computer lab of two to four hours. The course starts with an introductory
chapter intended for lecture. The next four chapters that introduce NetLogo and how to
implement and test models are intended entirely for the computer lab, but with the
instructor leading the class. Then, in parts II and III, each chapter includes concepts to be
introduced in lecture, followed by exercises that reinforce the concepts. In the computer
labs for these chapters, students should be able to work more independently, with the
instructor spending less time in front of the class and more time circulating to help
individual students. Exercises started in lab can be completed as homework.
Many of our exercises are based on example models that we have developed. We provide
the example models to help new instructors, but they have the disadvantages of not being
specific to any one discipline or familiar to instructors. As instructors develop experience,
we expect they will want to develop some of their own example models and exercises.
However, doing so takes a fair amount of time, so we would caution new instructors
against trying to rely on too many of their own models.
Because software platforms change rapidly, we have chosen to support this book by
maintaining a web site (www.railsback-grimm-abm-book.com) that provides complete
versions of the example models, example solutions to exercises, and other supporting
materials. New versions of NetLogo are released regulary and sometimes include changes
in concepts and syntax. Therefore, code examples in the book will no doubt become
obsolete and it would be impossible to keep the book entirely up to date. Hence,
instructors should check our web site as they plan a class and whenever they encounter a
problem with our example models and code. On this book’s web site we will also provide
additional material for instructors, e.g. detailed outlines of semester-long courses or
short-courses.
The independent learner may find it especially hard to stay focused on scientific
modeling instead of getting overly drawn into NetLogo programming. NetLogo is great
fun, but remember that writing and playing with a program is not your only goal. To
become a scientific modeler, you must learn to design, document, and analyze models to
solve particular problems. And we trust that, after you try it once or twice, you will find
that testing your NetLogo program is not only quite easy but also important for avoiding
embarassment and saving time. We encourage you to keep thinking about all five of the
major themes we list above.