L – Modeling and Simulating Social Systems with MATLAB

Slides:



Advertisements
Similar presentations
Jacob Goldenberg, Barak Libai, and Eitan Muller
Advertisements

Modeling of Complex Social Systems MATH 800 Fall 2011.
Modeling and Simulation By Lecturer: Nada Ahmed. Introduction to simulation and Modeling.
Modeling Malware Spreading Dynamics Michele Garetto (Politecnico di Torino – Italy) Weibo Gong (University of Massachusetts – Amherst – MA) Don Towsley.
Dealing with Complexity Robert Love, Venkat Jayaraman July 24, 2008 SSTP Seminar – Lecture 10.
CITS4403 Computational Modelling Agent Based Models.
1 Stefano Redaelli LIntAr - Department of Computer Science - Unversity of Milano-Bicocca Space and Cellular Automata.
FIN 685: Risk Management Topic 5: Simulation Larry Schrenk, Instructor.
Knowledge Acquisitioning. Definition The transfer and transformation of potential problem solving expertise from some knowledge source to a program.
Wizer – What-If Analyzer: Validation of Large Scale Stochastic Agent Models Project Investigator: Kathleen M. Carley – CMU, ISRI, CASOS Why is Validation.
Simulation Models as a Research Method Professor Alexander Settles.
Joanne Turner 15 Nov 2005 Introduction to Cellular Automata.
Lectures on Cellular Automata Continued Modified and upgraded slides of Martijn Schut Vrij Universiteit Amsterdam Lubomir Ivanov Department.
Nawaf M Albadia Introduction. Components. Behavior & Characteristics. Classes & Rules. Grid Dimensions. Evolving Cellular Automata using Genetic.
Agent Based Modeling and Simulation
CITS4403 Computational Modelling Fractals. A fractal is a mathematical set that typically displays self-similar patterns. Fractals may be exactly the.
Emergy & Complex Systems Day 1, Lecture 1…. Energy Systems Diagramming Energy Systems Diagramming A Systems language...symbols, conventions and simulation…
Discovery of Cellular Automata Rules Using Cases Ken-ichi Maeda Chiaki Sakama Wakayama University Discovery Science 2003, Oct.17.
The Role of Artificial Life, Cellular Automata and Emergence in the study of Artificial Intelligence Ognen Spiroski CITY Liberal Studies 2005.
Chapter 1 Introduction to Simulation
Dynamic Models of Segregation
BsysE595 Lecture Basic modeling approaches for engineering systems – Summary and Review Shulin Chen January 10, 2013.
Indiana GIS Conference, March 7-8, URBAN GROWTH MODELING USING MULTI-TEMPORAL IMAGES AND CELLULAR AUTOMATA – A CASE STUDY OF INDIANAPOLIS SHARAF.
Course material – G. Tempesti Course material will generally be available the day before the lecture Includes.
Centre for Advanced Spatial Analysis (CASA), UCL, 1-19 Torrington Place, London WC1E 6BT, UK web Talk.
Introduction to Lattice Simulations. Cellular Automata What are Cellular Automata or CA? A cellular automata is a discrete model used to study a range.
Cellular Automata Spatio-Temporal Information for Society Münster, 2014.
Cellular Automata Martijn van den Heuvel Models of Computation June 21st, 2011.
Conceptual Modelling and Hypothesis Formation Research Methods CPE 401 / 6002 / 6003 Professor Will Zimmerman.
A Stochastic Model of Platoon Formation in Traffic Flow USC/Information Sciences Institute K. Lerman and A. Galstyan USC M. Mataric and D. Goldberg TASK.
4th International Conference on High Performance Scientific Computing 4th International Conference on High Performance Scientific Computing A Framework.
L – Modelling and Simulating Social Systems with MATLAB © ETH Zürich | Lesson 3 – Dynamical Systems Anders Johansson and Wenjian.
Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally.
An Agent Epidemic Model Toward a general model. Objectives n An epidemic is any attribute that is passed from one person to others in society è disease,
MA354 An Introduction to Math Models (more or less corresponding to 1.0 in your book)
Conway’s Game of Life Jess Barak Game Theory. History Invented by John Conway in 1970 Wanted to simplify problem from 1940s presented by John von Neumann.
Why use landscape models?  Models allow us to generate and test hypotheses on systems Collect data, construct model based on assumptions, observe behavior.
MA354 Math Modeling Introduction. Outline A. Three Course Objectives 1. Model literacy: understanding a typical model description 2. Model Analysis 3.
Lecture ISI_10 CELLULAR AUTOMATA INTRODUCTION. OUTLINE OF PRESENTATION Some facts from history Definition of Cellular Automata Parameters of Cellular.
Application of a CA Model to Simulate the Impacts of Road Infrastructures on Urban Growth Nuno Pinto and António Antunes, University of Coimbra with Josep.
Traffic Simulation L2 – Introduction to simulation Ing. Ondřej Přibyl, Ph.D.
© ETH Zürich | L – Modeling and Simulating Social Systems with MATLAB Lecture 3 – Dynamical Systems © ETH Zürich | Giovanni Luca.
L – Modeling and Simulating Social Systems with MATLAB
Self-Organizing Network Model (SOM) Session 11
Spatio-Temporal Information for Society Münster, 2014
L – Modeling and Simulating Social Systems with MATLAB
On Routine Evolution of Complex Cellular Automata
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Models.
L – Modeling and Simulating Social Systems with MATLAB
SIMULATION SIMULAND PURPOSE TECHNIQUE CREDIBILITY PROGRAMMATICS
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
ADVANTAGES OF SIMULATION
Models, Scientific and Otherwise, and Theories
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Dynamical Models - Purposes and Limits
Modelling Dr Andy Evans In this lecture we'll look at modelling.
Digital Control Systems (DCS)
Advantages of ABS An advantage of using computer simulation is that it is necessary to think through one’s basic assumptions very clearly in order to create.
An introduction to Simulation Modelling
Developing and Evaluating Theories of Behavior
Cellular Automata.
11-12 June Third International Symposium on Climate and Earth System Modeling, NUIST, 南京 (Nanjing) On the added value generated by dynamical models.
Hiroki Sayama NECSI Summer School 2008 Week 2: Complex Systems Modeling and Networks Cellular Automata Hiroki Sayama
Computational Fluid Dynamics - Fall 2001
Cellular Automata What could be the simplest systems capable of wide-ranging or even universal computation? Could it be simpler than a simple cell?
Presentation transcript:

851-0585-04L – Modeling and Simulating Social Systems with MATLAB 13.05.2018 851-0585-04L – Modeling and Simulating Social Systems with MATLAB Lecture 4 – Cellular Automata Karsten Donnay and Stefano Balietti Chair of Sociology, in particular of Modeling and Simulation © ETH Zürich | © ETH Zürich |

Schedule of the course Introduction to MATLAB 13.05.2018 Schedule of the course Introduction to MATLAB 20.02. 27.02. 05.03. 12.03. 19.03. 26.03. 02.04. 23.04. 30.04. 07.05. 14.05. 21.05. 28.05. Create and Submit a Research Plan DEADLINE: 19.03. Introduction to social-science modeling and simulations Working on projects (seminar thesis) Handing in seminar thesis and giving a presentation

Projects – Suggested Topics 13.05.2018 Projects – Suggested Topics 1 Traffic Dynamics 9 Evacuation Bottleneck 17 Self-organized Criticality 25 Facebook 2 Civil Violence 10 Friendship Network Formation 18 Social Networks Evolution 26 Sequential Investment Game 3 Collective Behavior 11 Innovation Diffusion 19 Task Allocation & Division of Labor 27 Modeling the Peer Review System 4 Disaster Spreading 12 Interstate Conflict 20 Artificial Financial Markets 28 Modeling Science 5 Emergence of Conventions 13 Language Formation 21 Desert Ant Behavior 29 Simulation of Networks in Science 6 Emergence of Cooperation 14 Learning 22 Trail Formation 30 Opinion Formation in Science 7 Emergence of Culture 15 Opinion Formation 23 Wikipedia 31 Organizational Learning 8 Emergence of Values 16 Pedestrian Dynamics 24 Social Contagion 3 3

Goals of Lecture 4: students will Consolidate their knowledge of dynamical systems, through brief repetition of the main concepts and revision of the exercises. Get familiar with how and why simulation models may contribute to our understanding of complex socio-dynamic processes. Understand the important concept of Cellular Automata as discrete representations of interactions on an abstract grid (or configuration space). Implement simple Cellular Automata in MATLAB (Game of Life, Highway Simulation, Epidemics: Kermack- McKendrick model revisited)

Repetition dynamical systems described by a set of differential equations (example: Lotka-Volterra) numerical solutions iteratively for instances using 1st Euler’s Method (example: Kermack-McKendrick) the values and ranges of parameters critically matter; they determine which dynamics the model represents (Ex. 2, the ratio of recuperation to infection parameter determines the epidemiological threshold) time resolution in Euler Method must be sufficiently high to capture (‘fast’) system dynamics (Ex. 3) not all MATLAB-own ODE solvers work equally well for every dynamical system under consideration (Ex. 3)

13.05.2018 Simulation Models What do we mean when we speak of (simulation) models? Formalized (computational) representation of social, economic etc. dynamics Implies reduction of complexity, i.e. usually making (strong) simplifying assumptions Not trying to reproduce reality but rather systematize specific interdependencies of “real” systems Formal framework to test and evaluate causal hypotheses against empirical data (or stylized facts)

Simulation Models Strength of (simulation) models? 13.05.2018 Simulation Models Strength of (simulation) models? Computational laboratory: test how micro dynamics lead to macro patters There are usually no experiments in social sciences but computer models can be a “testing ground” Particularly suitable where formal models fail (or where dynamics are too complex for formal modeling) Possible to combine empirical input with quantitative validation of both the results and mechanisms

Simulation Models Weakness of (simulation) models? 13.05.2018 Simulation Models Weakness of (simulation) models? The choice of model parameters, implementation etc. may strongly influence the simulation outcome We can only model aspects of a system, i.e. the models are necessarily incomplete & reductionist More complex models are NOT necessarily better: dynamics between model components often poorly understood (a known problem in climate modeling) Can construct a computational model of virtually anything but hard to verify if you are actually studying a realistic empirical question!

Simulation Models How to we deal with known limitations? 13.05.2018 Simulation Models How to we deal with known limitations? Use empirical input and formal optimization to rule out arbitrariness of the model Test for implementation- and specification- dependence of simulations Validate the model mechanism both with observations and causal theory Use empirical data to evaluate the predictive power of the simulation model

Cellular Automaton (plural: Automata) 13.05.2018 Cellular Automaton (plural: Automata)

Cellular Automaton (plural: Automata) 13.05.2018 Cellular Automaton (plural: Automata) A cellular automaton is a rule, defining how the state of a cell in a grid is updated, depending on the states of its neighbor cells. May be represented as grids with arbitrary dimension. Cellular-automata simulations are discrete both in time and space.

Cellular Automaton (plural: Automata) 13.05.2018 Cellular Automaton (plural: Automata) Simplest example for a (reduced) representation of an interaction model Automata dimensions represent an abstract “distance” that could be spatial, social relations etc. Natural micro-to-macro link from interactions between cells to patterns visible in the automaton

13.05.2018 Cellular Automaton The grid can have an arbitrary number of dimensions: 1-dimensional cellular automaton 2-dimensional cellular automaton

13.05.2018 Moore Neighborhood The cells are interacting with each neighbor cells, and the neighborhood can be defined in different ways, e.g. the Moore neighborhood: 1st order Moore neighborhood 2nd order Moore neighborhood

Von-Neumann Neighborhood 13.05.2018 Von-Neumann Neighborhood The cells are interacting with each neighbor cells, and the neighborhood can be defined in different ways, e.g. the Von-Neumann neighborhood: 1st order Von-Neumann neighborhood 2nd order Von-Neumann neighborhood

13.05.2018 Game of Life Ni = Number of 1st order Moore neighbors to cell i that are activated. For each cell i: Deactivate: If Ni <2 or Ni >3. Activate: if cell i is deactivated and Ni =3 www.mathworld.wolfram.com

Game of Life Want to see the Game of Life in action? Type: life 13.05.2018 Game of Life Want to see the Game of Life in action? Type: life

Game of Life Patterns: can you find them? 13.05.2018 Game of Life Patterns: can you find them? Ants B-52 Blinker puffer Diehard Canada goose Gliders by the dozen Kok’s galaxy Rabbits R2D2 Spacefiller Wasp Washerwoman …

Cellular Automata: A New Kind of Science? 13.05.2018 Cellular Automata: A New Kind of Science? A thorough study of all 256 “behavioral” rules of a 1-D cellular automata.

Cellular Automata: A New Kind of Science? 13.05.2018 Cellular Automata: A New Kind of Science?

Cellular Automaton: Principles 13.05.2018 Cellular Automaton: Principles Self Organization: Patterns appear without a designer Emergence: Gliders, glider guns, wasps, rabbits appear Complexity: Simple rules produce complex phenomena

13.05.2018 Highway Simulation Simple example of a 1-dimensional cellular automaton Rules for each car at cell i: Stay: If the cell directly to the right is occupied. Move: Otherwise, move one step to the right, with probability p Move to the next cell, with the probability p

13.05.2018 Highway Simulation We have prepared some files for the highway simulations: draw_car.m : Draws a car, with the function draw_car(x0, y0, w, h) simulate_cars.m: Runs the simulation, with the function simulate_cars(moveProb, inFlow, withGraphics)

13.05.2018 Highway Simulation Running the simulation is done like this: simulate_cars(0.9, 0.2, true)

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model In lecture 3, we introduced the Kermack- McKendrick model, used for simulating disease spreading. We will now implement the model again, but this time instead of using differential equations we define it within the cellular-automata framework.

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate S β transmission R I γ recovery

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: For the MATLAB implementation, we need to decode the states {S, I, R}={0, 1, 2} in a matrix x. S I R 1 2

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: We now define a 2-dimensional cellular- automaton, by defining a grid (matrix) x, where each of the cells is in one of the states: 0: Susceptible 1: Infected 2: Recovered

Kermack-McKendrick Model 13.05.2018 Kermack-McKendrick Model Define microscopic rules for Kermack- McKendrick model: In every time step, the cells can change states according to: A Susceptible individual can be infected by an Infected neighbor with probability β, i.e. State 0 -> 1, with probability β. An individual can recover from an infection with probability γ, i.e. State 1 -> 2, with probability γ.

Cellular-Automaton Implementation 13.05.2018 Cellular-Automaton Implementation Implementation of a 2-dimensional cellular- automaton model in MATLAB is done like this: The iteration over the cells can be done either sequentially, or randomly. Iterate the time variable, t Iterate over all cells, i=1..N, j=1..N Iterate over all neighbors, k=1..M … End k-iteration End i-iteration End t-iteration

Cellular-Automaton Implementation 13.05.2018 Cellular-Automaton Implementation Sequential update:

Cellular-Automaton Implementation 13.05.2018 Cellular-Automaton Implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 13.05.2018 Cellular-automaton implementation Attention: Simulation results may be sensitive to the type of update used! Random update is usually preferable but also not always the best solution Just be aware of this potential complication and check your results for dependency on the updating scheme!

13.05.2018 Boundary Conditions The boundary conditions can be any of the following: Periodic: The grid is wrapped, so that what exits on one side reappears at the other side of the grid. Fixed: Agents are not influenced by what happens at the other side of a border.

13.05.2018 Boundary Conditions The boundary conditions can be any of the following: Fixed boundaries Periodic boundaries

MATLAB Implementation of the Kermack-McKendrick Model 13.05.2018 MATLAB Implementation of the Kermack-McKendrick Model

MATLAB implementation 13.05.2018 Set parameter values MATLAB implementation

MATLAB implementation 13.05.2018 Define grid, x MATLAB implementation

MATLAB implementation 13.05.2018 Define neighborhood MATLAB implementation

MATLAB implementation 13.05.2018 Main loop. Iterate the time variable, t MATLAB implementation

MATLAB implementation 13.05.2018 Iterate over all cells, i=1..N, j=1..N MATLAB implementation

MATLAB implementation 13.05.2018 For each cell i, j: Iterate over the neighbors MATLAB implementation

MATLAB implementation 13.05.2018 The model, i.e. updating rule goes here. MATLAB implementation

13.05.2018 Breaking Execution When running large computations or animations, the execution can be stopped by pressing Ctrl+C in the main window:

13.05.2018 References Wolfram, Stephen, A New Kind of Science. Wolfram Media, Inc., May 14, 2002. http://www.bitstorm.org/gameoflife/ http://ddi.cs.uni- potsdam.de/HyFISCH/Produzieren/lis_projekt/pr oj_gamelife/ConwayScientificAmerican.htm Schelling, Thomas C. (1971). Dynamic Models of Segregation. Journal of Mathematical Sociology 1:143-186.

13.05.2018 Exercise 1 Get draw_car.m and simulate_cars.m from www.soms.ethz.ch/matlab or from https://github.com/msssm/lectures_files Investigate how the flow (moving vehicles per time step) depends on the density (occupancy 0%..100%) in the simulator. This relation is called the fundamental diagram in transportation engineering.

13.05.2018 Exercise 1b Generate a video of an interesting case in your traffic simulation. We have uploaded an example file, simulate_cars_video.m, and simulate_cars_video_w7.m

13.05.2018 Exercise 2 Download the file disease.m which is an implementation of the Kermack-McKendrick model as a Cellular Automaton. Plot the relative fractions of the states S, I, R, as a function of time, and see if the curves look the same as for the implementation last class

13.05.2018 Exercise 3 Modify the model Kermack-McKendrick model in the following ways: Change from the 1st order Moore neighborhood to a 2nd and 3rd order Moore neighborhood. Make it possible for Removed individuals to change state back to Susceptible. What changes?