Agent-based modeling is a technique used to explore both complexity and emergence by simulating individual actors and their actions within a system. Think of systems such as the traffic in a city, or like those in financial markets where one actor can have an effect on the decisions of others until the system’s direction changes its course. In this talk, you will learn about ABMs in Python.
5. 5
Overview
1. What Agent-based modeling (& Complexity)
2. Background in Agent-based modeling tools
3. Modeling in Python using Mesa
4. Future of Mesa
12. Conway’s Game of Life
Source:
Wikipedia user LucasVB,
https://commons.wikimedia.or
g/wiki/File:Gospers_glider_gun
.gif
12
13. Schelling Segregation Model
Source:
Case, “Parable of the Polygons”
http://ncase.me/polygons/
Source:
Schelling, 1971. “Dynamic
Models of Segregation.”
Journal of Mathematical
Sociology.
13
14. 14
Why ABMs?
Flows: evacuation, traffic, and customer flow
management.
Markets: stock market, shopbots and software agents,
and strategic simulation.
Organizations: operational risk and organizational design.
Diffusion: diffusion of innovation and adoption dynamics.
15. 15
Why ABMs?
ABMs capture the path as well as the solution, so one can
analyze the system’s dynamic history.
Most social processes involve spatial or network attributes,
which ABMs can incorporate explicitly.
When a model (A) produces a result (R), one has established
a sufficiency theorem, meaning R if A.
16. 16
Why ABMs?
Individual behavior is nonlinear; characterized by
thresholds, if-then rules, or nonlinear coupling
Individual behavior exhibits memory, path-dependence, or
temporal correlations, including learning and adaptation
Agent interactions are heterogeneous; can generate
network effects --> lead to deviations from predicted
aggregate behavior
17. Predator-Prey Dynamics
Source:
Wilensky, U.
(1997). NetLogo
Wolf Sheep
Predation model.
http://ccl.northwe
stern.edu/netlogo
/models/WolfShee
pPredation.
Center for
Connected
Learning and
Computer-Based
Modeling,
Northwestern
University,
Evanston, IL.
17
19. Migration Modeling
Source:
Gulden et al.
2011, “Modeling
Cities and
Displacement
through an
Agent-Based
Spatial Interaction
Model,”
Computational
Social Science
Society of America
Conference
19
26. 26
Most models are from...
netLogo (Logo) - bit.ly/abm-netlogo (~60%)
MASON (Java) - bit.ly/abm-mason
RePast (Java) -bit.ly/abm-repast
27. 27
Name 2.7 3+ Active
Dates
PyPI Description
Simx Y N 11/12-
12/14
Y Framework for discrete simulations,
optimized for parallel computing; no
built in visualization
PyCX Y Y 06/11-
03/16
N Repository of ABM examples & GUI
script for desktop visualization;
Focused on ease of writing; Mostly pure
python; not a framework
PyABM Y N 09/12-
03/14
Y Partial ABM framework, not working
Indra N Y 12/14-
Today
N ABM framework to write models similar
to Netlogo; lacks documentation;
visualization ability in the future?
Mesa N Y 09/14-
Today
Y ABM framework to build models with
repeatable components; uses browser
for visualization
28. Modeling in browser
Parable of the Polygons
(Javascript & HTML) -
ncase.me/polygons
Agent Base (Javascript) -
bit.ly/abm-ants
Agent Script (CoffeeScript) -
agentscript.org
Mesa (Python) - bit.ly/abm-mesa
28
33. Mesa’s Scheduling Feature
Notebook example & source: Prisoner’s dilemma
● Sequential activation, where agents are
activated in the order they were added to the
model
● Random activation, where they are activated in
random order every step
● Simultaneous activation, simulating them all
being activated simultaneously.
33
43. 43
Mesa Growth / Usage
Started in 2014 with 2 people. Now 26!
21 were from Sprints!
Most were not ABM experts.
Students have used it. Gov has shown interest.
ToDo list: Networks (in progress), GIS,
Parallelization of models, Front-end, Increase
usability, fix all things
45. 45
Things to read
Cioffi-Revilla, C. (2013). Introduction to computational social science.
Epstein, J. M., & Axtell, R. (1996). Growing artificial societies: social
science from the bottom up.
Gilbert, N., & Troitzsch, K. (2005). Simulation for the social scientist.
McGraw-Hill Education (UK).
Kupers, R., & Colander, D. (2014). Complexity & the Art of Public Policy.
Miller, J. H., & Page, S. E. (2009). Complex adaptive systems.
Simon, H. A. (1996). The sciences of the artificial.