Topic 9- General Principles of International Law.pptx
GIS and Agent-based modeling: Part 1
1. Department of Computational Social Science
GIS and Agent-
based Modeling
Andrew Crooks
Center for Social Complexity
George Mason University
acrooks2@gmu.edu, www.gisagents.org, @AndyCrooks
2. Presentation Outline
• Scene Setting:
– Why Study Urban Systems
• Introduction to Agent-based Modeling
• Why Model?, Approaches to Modeling Human Behavior
• Why is Space important and what is GIS?
• Why Link ABM and GIS?
• The Building Blocks of Spatial Models
• Raster Data
• Sample Application: Pedestrian Modeling
• Vector Data
• Sample Application: Residential Segregation
• Simple Examples of GIS & ABM Applications
• Toolkits for Spatial Agent-based Modeling
• Summary
6. Why Study Urban Systems?
• Cities provide habitats for more than half the
world’s population (3.6 billion people, UN, 2011).
– Predicted to increase to 6.3 billion by 2050.
• Understanding cities is extremely complex as they
are composed of many parts, they are dynamic
and composed of large numbers of discrete actors
interacting within space.
– “..one of the major scientific challenges of our
time” (Wilson, 2000).
7. Why Study Urban Dynamics?
Source: http://www.census.gov/popclock/
8.
9. Why are Urban Systems
Difficult to Understand?
• Human behavior cannot be understood or
predicted in the same way as in the physical
sciences.
• Focus has shifted to a bottom-up approach to
urban systems, specifically researching the
reasoning on which individual decisions are made.
• ABM allows one to simulate the individual actions
of diverse agents, measuring the resulting system
behavior and outcomes over time.
10. Agent-based Modeling
• Simulation Models (representations of
behavior).
• AKA: IBM, MAS
• Generally implemented as computer code.
• ABMs do not have a set of equilibrium
conditions imposed on the model; generally,
you do not “solve” or “estimate” the model.
• ABMs can both complement and substitute
for other modeling techniques.
11. • Agents:
– Autonomous
–I.e. Individuals are not
centrally governed.
– Heterogenous
– Active
– Adaptive
Crooks & Heppenstall (2012), Introduction to Agent-based Modelling, in Heppenstall, Crooks, See & Batty (eds.), Agent-based Models of
Geographical Systems, Springer.
Agent-Based Modeling
Mobile agents
Immobile agents
Artificial World
If <cond> then
<action1> else
<action2>
12. A Simple Agent-based Model
can form without any obvious
incident.
–Simple rules can explain complex
phenomena.
Source: NetLogo
New Scientist Article: http://
technology.newscientist.com/
article/dn13402
•Example:
–Models the movement of cars on a road.
–Each car follows a simple set of rules:
• If there’s a car close ahead, it slows down.
• If there’s no car ahead, it speeds up.
–Demonstrates how traffic jams
Link to Movie
13. Shockwave Traffic Jam in Reality
• 22 cars equally spaced on
a 230m single lane circle.
• Drivers asked to cruise
steadily at 30km/h.
• 1st traffic moved freely.
• Disturbances/clusters
soon appear.
• Causing cars to slow/stop.
• Cars at front of cluster can
accelerate at 40km/h.
• But these join another jam.
Source: http://www.youtube.com/watch?v=Suugn-p5C1M
New Scientist Article: http://technology.newscientist.com/article/dn13402
14. Modeling Cycles
• Why Model?
– Explore, explain,
understand, forecast etc…
• The aim of modelling is to
simplify as much as
possible, but not to
oversimplify.
• The aim is to create a model
of the target that is simpler
to study than the target
itself.
Target
Collected
data
Model
Simulated
data
Data gathering
Simulation
Abstraction Similarity
Source: Gilbert & Troitzsch (2005)
15. Stages in Building a Simulation
• Identify the question
– e.g. reasons for settlement patterns
• Define the target of the model
– e.g. settlement dynamics
• Observations of the target, to provide parameters and initial conditions
of the model
– e.g. Historical and archeological remains
• Make assumptions and design the model
– e.g what is a household, how much do people eat etc.
• Execute the program and record the output
• Verification, validation, sensitivity analysis
Kohler, et al., (2000), 'Be There Then: A Modeling Approach to Settlement Determinants and Spatial Efficiency Among Late Ancestral Pueblo Populations of the
Mesa Verde Region, U.S. Southwest',
19. Real World Segregation:
Calculation of Residential Dissonance
• Two factors are considered in calculating dissonance:
– Agent-building dissonance:
• E.G., Arab agents highly dislike modern blocks
– Agent-neighbors dissonance:
• Arab Christians don't mind living in neighborhoods predominantly
populated by Arab Muslims,
• But Jews and Muslims both dislike neighborhoods dominated by
the other
– Dissonance causes the agents to move or not
Source: Benenson, I., Omer, I. and Hatna, E. (2002), 'Entity-Based Modelling of Urban Residential Dynamics: The Case
of Yaffo, Tel Aviv', Environment and Planning B, 29(4): 491-512.
24. Approaches to Modeling Human Behavior
• Three Main Approaches:
1. The mathematical approach:
• e.g. threshold-based rules
2. Conceptual cognitive frameworks.
• Beliefs, Desires, and Intentions (BDI)
• Physical, Emotional, Cognitive, and Social factors
(PECS)
• Fast and Frugal
3. Cognitive architectures:
• e.g. Soar and ACT-R
–Focus one agent at a time.
Kennedy, W. (2012), 'Modelling Human Behaviour in Agent-Based Models', in Heppenstall, A., Crooks, A.T., See,
L.M. and Batty, M. (eds.), Agent-based Models of Geographical Systems, Springer, New York, NY, pp. 167-180.
25. Why is Space Important?
• Our perception of the world is inherently spatial: objects
have a location and events are embedded in time
(Wegener, 2000).
• Geographic information links a place, and often a time,
with some property of that place (and time)
– “The temperature at 38 N, 14 E at noon local time on
26/7/15 was 32 Celsius”
• The potential number of properties is vast
– In GIS we term them attributes
– Attributes can be physical, social, economic,
demographic, environmental, etc.
Wegener, M. (2000), 'Spatial Models and GIS', in Fotheringham, A.S. and Wegener, M. (eds.), Spatial Models and
GIS: New Potential and New Models, Taylor and Francis, London, UK, pp. 3-20.
26. What is GIS?
Objects are
represented
as layers
• GISystems: Emphasis on technology and tools
• GIScience: Explores issues related to the use of GIS
(e.g. spatial analysis, accuracy and visualization)
27. Why Link GIS and ABM? - Macro-Scale Basic Functional Map
Smith & Crooks (2010), From
Buildings to Cities: Enabling the
Multi-Scale Analysis of Urban
Form and Function through the
integration of Geographical and
Geometric Methods.
28. Why Link GIS and ABM? - Residential Density
Smith & Crooks (2010), From
Buildings to Cities: Enabling the
Multi-Scale Analysis of Urban
Form and Function through the
integration of Geographical and
Geometric Methods.
29. Fine Scale Data: Building Function and Land Use
Smith & Crooks (2010), From Buildings to Cities: Enabling the Multi-Scale Analysis of Urban Form and Function through the integration of Geographical and Geometric Methods.
30. • Why link GIS and ABM?
– Allows agents to be related to actual
geographic locations.
– Provides the ability to model the
emergence of phenomena through the
individual interaction of features in a
GIS over space & time
• GIS represent the world as a series
of layers and objects of different
types
– All can geo-referenced and translated
into an ABM
– GIS provides no mechanism to
discover new decision making
frameworks. Crooks & Castle, (2012), The Integration of Agent-Based Modelling
and Geographical Information for Geospatial Simulation.
Linking GIS & ABM
31. Why is Spatial Data Important for
ABM?
• ABM focus on individual and how through individual interactions
more aggregate properties of system emerge.
• Spatial data allows us to:
– To document the macro-phenomena.
– To inform micro-level process modeling - drivers of change.
• E.g. calculating accessibility indexes impact on house prices
or analysis of land use histories.
• Derive maps of the agents environments e.g. of physical
networks such as roads for the agents to inhabit.
• Derive demographic variables for agent populations.
• Modelers can use macro data for model validation thus providing a
independent test of the micro-level processes encoded in the
model.
32. Areas of Application for GIS
and ABM
• Where space matters
• Where individual variability matters
• Where distribution is the object of study
• Where bounded rationality matters
– Imperfect information (e.g. limited vision, limited
contacts) etc.
• Where equilibrium is not the dominant state
33. Two ways of digitally representing Geographic
Phenomenon (& Space): Rasters and Vectors
• How to represent phenomena conceived as fields or
discrete objects?
• Raster:
– Divide the world into square cells
– Register the corners to the Earth
– Represent discrete objects as collections of one or
more cells
– Represent fields by assigning attribute values to cells
– More commonly used to represent fields than
discrete objects
The Building Blocks of Spatial Models
34. Raster Representation
• Each color represents a different value of a
nominal-scale field denoting land cover class.
Mixed conifer
Douglas fir
Oak savannah
Grassland
36. Vector Data
• Used to represent points, lines, and
areas
• All are represented using
coordinates
– One per point
– Lines as polylines
• Straight lines between points
– Areas as polygons
• Straight lines between points,
connecting back to the start
• Point locations recorded as
coordinates
Point
Line
(X=1, Y=1)
Polygon
38. Source: Castle, C.J.E. (2007), Guidelines for Assessing Pedestrian Evacuation Software Applications, Centre for Advanced Spatial Analysis (UCL): Working Paper
115, London, UK.
9
12
3
Cell Space Continuous SpaceNetwork Space
Representing Space in ABM: Networks, Cells & Continuos Space
42. Why use ABM for Pedestrian
Modeling?
• ABM are particularly suited to understanding processes
and their consequences (Gilbert, 2007)
• ABM serve as artificial laboratories where we can test
ideas and hypothesis of phenomena which are not easy to
do in the real world:
– E.g. without actually setting a building on fire we cannot
easily identify people’s reactions to such an event.
• Focusing on the individual allows us to focus on how
people will use a space
– Individuals are constrained and interact with their
environment and more aggregate properties emerge
Gilbert, N. (2007), Agent-Based Models, Sage Publications Inc, London, UK.
43. Source: de Smith, M.J., Goodchild, M.F. and Longley, P.A. (2009), Geospatial Analysis: A Comprehensive Guide to Principles, Techniques and
Software Tools (3rd Edition), The Winchelsea Press, Winchelsea, UK.
Direction of Movement: Cost Surface
• Agents move to lower value
cell
• Decision rules are needed if
2 agents want the same cell
48. Enclosure Representation:
Regular lattice
• Pros
• Cells can approximate the
space an average person
occupies (0.4*0.4 or 0.5*0.5m).
• Internal building structures can
be represented.
• Individuals are represented.
• Pedestrians can make route
choices.
• Cons
• Cell size the same.
• One agent per cell (in general).
Pedestrian Model: Entering a Stadium
50. Cell Size & Anthropometric Dimensions
Human shoulder breadth and chest depth. Anthropometric dimensions of adults (19-65), by nationality and
gender.
Source: Pheasant and Haslegrave (2006).
51. Raster (50 cm): One Car Park Bay Example
Pedestrian Model: Entering a Stadium
52. • Assumes agents
can walk anywhere
Pedestrian Model: Entering a Stadium
All Areas
57. !
!
Average frequency of a particular
space being walked up
Paths between one exit and
entrance
Crooks et al., (Under Review), Walk this Way: Improving Pedestrian Agent-Based Models through Scene Activity Analysis, ISPRS International
Journal of Geo-Information.
Developing Realistic Patterns of
Movement for Pedestrian Models
59. What if the Camera Goes Down?
Agents generated from the data for the rest of the day (i.e. excluding 8-9am)
60. What if the Scene changes or foot traffic increases
(a) Obstacles (black squares) added to the scene; (b) Heat map of increased traffic without
obstacle; Normalized heat maps for low (c) and high (d) volumes of pedestrian traffic following the
introduction of the obstacle for the 25th of August.
63. Converting Vector
GIS data into
agents
Vector Data as a Basis for a Model
Crooks, A.T. (2007), The Repast Simulation/Modelling System
for Geospatial Simulation, Centre for Advanced Spatial
Analysis (University College London): Working Paper 123,
London, UK.
64. Reading in the Data & Building Models
Base agents on “real world” data
Actions of individual agents will create changes in their physical environment.
Vector Data as a Basis for a Model
66. public void init(){
ArrayList <AttributeField> attribs =
(ArrayList <AttributeField>) geometry.getUserData();
for(AttributeField af: attribs){
if(af.name.equals("ID_ID")){
Double d = (Double) af.value;
id = (int) Math.floor( d );
}
else if(af.name.equals("SOC"))
soc = (String) af.value;
else if(af.name.equals("POPU"))
initPop = (Integer) af.value;
}
}
Reading in the Attribute
Information
Vector Data as a Basis for a Model
71. Vector data as a basis for a model: Polygon (Voronoi) Tessellation of Space
• Reimplementation
of the Schelling
Model, each agent
wants >=50% of
their neighbors like
themselves.
72. Source: Crooks, A.T. (2010), 'Constructing and Implementing an Agent-Based Model of Residential Segregation through Vector GIS', International
Journal of GIS, 24(5): 661-675.
• Visualization at
different scales
• By looking only at the
aggregate information
we loose what is
happening at the
boundaries.
Vector Data as a Basis for a Model
73. Pedestrian dynamics
(E.g. Castle)
Space
Time
Micro
Meso
Macro
Minutes Hours Days Years
Traffic
(E.g. Nagel)
Land use change
(E.g. Clarke)
Migration
(E.g. Portugali)
Gentrification
(E.g Torrens)
Urban growth (E.g. Barros)
House price evolution
(E.g. Bossomaier)
Segregation (E.g. Benenson)
Crime
(E.g. Malleson)
Retail Markets
(E.g Heppenstall)
Examples of GIS & ABM Applications
77. MATSim
• Microsimulation
model.
• 1 day of individual
cars driving
around an area of
Zurich.
• Morning rush hour.
• For performance
reasons, only 10%
of the cars are
shown.
Source: http://www.matsim.org/examples
Modeling Traffic: Network Data
79. Model
Land-use change
Time
Slope
Land-use
Excluded
Urban
Transport
Hillshade
ModelInputs
Adapted from: Clarke, K.C. and Gaydos, L.J. (1998), 'Loose-Coupling a Cellular Automaton Model and GIS: Long-Term Urban
Growth Predictions for San Francisco and Baltimore', International Journal of Geographic Information Science, 12(7): 699-714.
Urban Growth
5 growth coefficients:
dispersion, breed,
spread, slope & road-
gravity
4 growth rules:
spontaneous, new
spreading centers, edge
& road-influenced
81. Elementary Schools Middle Schools High Schools
Hypothetical Spread of Disease in Fairfax County Schools
• What policy responses are most
effective at stopping the spread of
an epidemic?
– E.g. Closing the schools
• Global Parameters:
– Incubation Period
– Disease Duration
– TransmissionProbability Link to Movie
82. Simulation of a pandemic flu outbreak in the
continental United States, initially introduced by the
arrival of 10 infected individuals in Los Angeles
• Each dot represents a Census tract and changes color
from green to red as more people in that tract become
infected Source: http://tinyurl.com/4oxxx3l & http://tinyurl.com/4lerjwv
Source: Los Alamos National Laboratory
83. Toolkits for GIS & ABM
Crooks, A.T. and Castle, C. (2012), 'The Integration of Agent-Based Modelling and Geographical Information for Geospatial Simulation', in
Heppenstall, A., Crooks, A.T., See, L.M. and Batty, M. (eds.), Agent-based Models of Geographical Systems, Springer, New York, NY, pp. 219-252.
85. • See NetLogo for more information
Toolkits for GIS and ABM
NetLogo
86. • Elevation data.
• Rain drops fall at
random and flow
down hill.
• If there is no lower
elevation the rain
drops pool until they
flow over land
nearby.
• Similar principles
could be applied to
pedestrian models. Source: http://ccl.northwestern.edu/netlogo/models/GrandCanyon
Toolkits for GIS and ABM: NetLogo
Raster Data as a Basis of a Model
87. • Vector Data as a Basis for modeling
Toolkits for GIS and ABM: NetLogo
91. Summary
• Urban areas play a crucial role in our lives but are extremely
complex.
• Patterns at the macro-level emerge from micro-level interactions of
many diverse individuals:
– E.g. traffic jams, crowds, urban growth.
• Agents interact with each other and their environment:
– Decisions and actions of agents can be influenced by past
decisions.
– Agents can influence future decisions of other agents.
• Linking agent-based models to GIS allow us create models directly
related to space:
– Acts as a container for agents.
– Allows us to compare aggregate outputs to the ‘real world’.
• Provides a new way to explore urban dynamics at a variety of
spatial and temporal scales.