Agent-Based Modelling in NetLogo
(ABM-NetLogo)
Lab Sessions
Below are listed the provisional planned lab sessions. However, these
are subject to change. The aim is to respond to student interests and
also to support them while working on their own projects.
The slides briefly introduce the topic. Work through the exercise
sheets and complete the tasks. The videos cover some of the material in
the exercise sheets if you get stuck.
1. First NetLogo session
What are ABM? What is NetLogo? The basic NetLogo environment; Using the
command center to directly execute commands; Turtles, Patches and
Links; Agentsets and lists; Creating buttons and sliders; Using
built-in help: manual and dictionary; Models library.
Slides: Intro. slides (pdf).
Exercise sheet: Exercise 1 - a first
netlogo session (pdf).
Video: Quck start video to
NetLogo (youtube).
Link: 6-page Quick
guide to the language (pdf) by Luis R. Izquierdo. For those with
programming experience in other languages.
2. First NetLogo
program
The structure of a NetLogo program; Setup and Go procedures; Birth and
death of turtles; Adding outputs to the interface screen; Turtle
variables
and global variables.
Slides: First netlogo
program (pdf).
Exercise sheet: Exercise 2 - a first
netlogo program (pdf).
Video: part 1, part 2, part 3 (youtube).
Code: Final program after tasks completed (netlogo)
3. Segregation
model
Brief background and motivation of the model. Step-by-step explanation
of the code of the Schelling segregation model
in NetLogo; Modify the model to incorporate more colours and a
different movement rule. Implement a procedure to count the number of
distinct clusters.
Slides: Segregation model
(pdf).
Exercise sheet: Exercise 3 - segregation
model (pdf).
Video: part 1, part 2, part 3 (youtube).
Paper: Schelling, Thomas C. (1971) Dynamic Models of Segregation.
Journal of Mathematical Sociology 1:143-186. (pdf)
NetLogo Models Library: Sample Models > Social Science >
Segregation
Code: Final program after tasks completed (netlogo)
4. Predation model
Step-by-step explantion of the code of the Wolf Sheep predation model.
This model demonstrates multiple dynamically interacting turtle breeds
and was developed for education purposes.
Modify the model to incorporate another preditor who feeds on wolves.
Slides: Predation
model
(pdf)
Exercise sheet: Exercise 4 - wolf sheep
predation model (pdf).
Video: part 1, part 2, part 3, part 4 (youtube)
Link: Tutorial #1 in the NetLogo manual uses this model: https://ccl.northwestern.edu/netlogo/docs/tutorial1.html
NetLogo Models Library: Sample Models > Biology > Wolf Sheep
Predation
Code: humans eat wolves (netlogo),
humans and wolves fight v1 (netlogo),
humans and wolves fight v2 (netlogo)
Paper: Wilensky, U. & Reisman, K. (2006). Thinking like a Wolf, a
Sheep or a Firefly: Learning Biology through Constructing and Testing
Computational Theories – an Embodied Modeling
Approach. Cognition & Instruction, 24(2), pp. 171-209. (pdf)
5 & 6. Networks
Using links to create networks. Create random and other common network
topologies. Preferential attachment and small-world construction
algorithms. Clustering coefficent and average path length measures.
Determining if a network is connected.
Virus on a network model. Modify it to incorporate pref. attach.
network. Implement turtles that move on a network.
Slides: Networks
(pdf)
Exercise sheet: Exercise
5 - preferential attachment model (pdf). (note: this exercise will
not be
covered in detail in the lab)
Video: part 1 (undirected
links), part 2 (directed
links), part 3 (network
examples program), part 4
(pref attach), part 5
(small world), part 6
(connected), part 7
(clustering coeff.)
Code: network examples program (netlogo),
random network (netlogo),
pref. attach and small-world (netlogo),
virus on a network with extra networks (netlogo),
pref. attach model with Exercise 5 tasks competed (netlogo)
NetLogo Models Library: Sample Models > Networks > Preferential
Attatchment | Small Words | Virus on a Network | Team Assembly
NetLogo Models Library: Sample Models > Code Examples >
Link-walking turtles example | Lattice-walking turtles example
Link: The NetLogo network extension supports many useful network
functions: http://ccl.northwestern.edu/netlogo/docs/nw.html
Paper: Albert-László Barabási & Reka Albert.
Emergence of Scaling in Random Networks, Science, Vol 286, Issue 5439,
15 October 1999, pages 509-512. (pdf)
Paper: DJ Watts and SH Strogatz. Collective dynamics of ‘small-world’
networks, Nature, 393:440-442 (1998). (pdf)
Paper:
R Guimera, B Uzzi, J Spiro, L Amaral (2005) Team Assembly Mechanisms
Determine Collaboration Network Structure and Team Performance.
Science, 308(5722), p697-702. (pdf)
7. Lists and the El
Farol Bar
model
Describe some list primatives. Implement simple model in which agents
store and update lists. Introduce Brian Arthur's El Farol Bar model.
Describe NetLogo model implementation step-by-step. This model
demonstrates the
use of lists to compactly represent simple learning in turtles. Modify
to include new output measures, correct the learning function and give
agents the ability to adapt strategies.
Slides: Lists
and El Farol model (pdf)
Exercise sheet: Exercise
6 - El Farol Bar model (pdf). (note: this exercise will
not be
covered in detail in the lab)
NetLogo Models Library: Sample Models > Social Science > El Farol
Code: List example task 1 (netlogo),
Simplified El Farol (netlogo), model
with excerise 6 tasks completed (netlogo)
Paper: W. Brian Arthur (1994) “Inductive Reasoning and Bounded
Rationality”, American Economic Review, 84,406–411. (pdf)
8. Evolution of
cooperation
Evolution in ABM. Implicit and explicit fitness and selection. A simple
evolutionary algorithm with explicit fitness, selection and mutation.
Cooperation in the Prisoner's Dilemma (PD) game from game theory.
Evolution applied to the PD game. Mean field game interactions model.
Structured game interactions model on fixed lattice (spatial PD model).
Evolving dynamic interaction
structures using tags and a network. Repeated (or Iterated) PD games.
Slides: Evolution of
Cooperation (pdf)
Code: mean field model (netlogo),
fixed lattice model (netlogo),
tag model (netlogo), network
rewire model (netlogo),
task 1 - modified mean-field model to implement games on a nework (netlogo), task 2
- modified lattice model to implement mutation and different payoffs (netlogo)
Paper: Nowak, M. & May, R. (1992) Evolutionary games and spatial
chaos. Nature 359, 826-829 [lattice PD model]
Paper: Nowak, M. & May, R. (1993) The Spatial Dilemmas of
Evolution. Int. J. of Bifurcation and Chaos, Vol. 3, No. 1. 35-78 (pdf)
[further analysis with lattice PD model]
Paper: Szabo, G. & Fath, G. (2006) Evolutionary games on graphs (http://arxiv.org/abs/cond-mat/0607344)
[an extensive survey paper.]
Book: Axelrod, R. (1984) The evolution of cooperation. Basic Books.
[describes results of a tournament in which people submitted agents
(programs) to play the iterated PD game]
Link: lecture slides (from another course) that describe Axelrod's
iterated PD tournaments in detail (pdf)
9. Experimental
methods and tools
Issues when designing ABM experiments. Verifcation, validation and
replication of ABM. The BehaviorSpace tool in NetLogo. Vary a
parameter in the Schelling model using BehaviorSpace. Load the results
into a statistical package.
Produce a visual plot of the effect of varying the parameter. How to
run NetLogo experiments as a background headerless process on a server
utilising
multiple cores.
Slides: Experimental
methods and tools (pdf)
Code: Segregation model with BehaviorSpace experiments discussed in the
slides (netlogo). R scripts for
creating 2D level plot from netlogo
exp2 ouptut csv file (R
script simple, R
script fancy), Shell script for running
headless experiments easily (nrl.sh).
Link: NetLogo BehaviorSpace tool manual pages: https://ccl.northwestern.edu/netlogo/docs/behaviorspace.html
Papers:
- Epstein, J. (2008) Why Model? Journal of Artificial Societies and
Social Simulation vol. 11, no. 4. <http://jasss.soc.surrey.ac.uk/11/4/12.html>
[a short and easy to read article that makes the case for modelling for
reasons other than prediction or mapping to data]
- Axelrod, R. (1997) Advancing the art of simulation in the social
sciences. In Conte and Hegselmann (eds) Simulating Social Phenomena.
Springer (pdf)
[general approach of the ABM method in social science]
- Edmonds, B. and Hales, D. (2003) Replication, Replication and
Replication - some hard lessons from model alignment. Journal of
Artificial Societies and Social Simulation 6(4) <http://jasss.soc.surrey.ac.uk/6/4/11.html>
[an example of a model replication]
- R Guimera, B Uzzi, J Spiro, L Amaral (2005) Team Assembly
Mechanisms
Determine Collaboration Network Structure and Team Performance.
Science, 308(5722), p697-702. (pdf)
[an example of am ABM along with emperical validation approach, and
implementation of the model can be found in NetLogo Models Library:
Sample Models > Networks > Team Assembly]
- Edmonds B and Moss S (2005) From KISS to KIDS — an
'anti-simplistic' modelling approach. In Davidsson P et al (eds.) Multi
Agent Based Simulation. Springer. (pdf)
[discussion of two different approaches to ABM modelling]
- Hales, D. (2010) Mix, Chain and Replicate: Methodologies for
Agent-Based Modelling of Social Systems. In Mollona, E., (ed)
Computational Analysis of Firms’ Organization and Strategic Behaviour.
Routledge (pdf)
[an overview of my take on ABM methods]