L – Modeling and Simulating Social Systems with MATLAB

Slides:



Advertisements
Similar presentations
Chapter 8 Geocomputation Part A:
Advertisements

Jacob Goldenberg, Barak Libai, and Eitan Muller
Modeling of Complex Social Systems MATH 800 Fall 2011.
10.2 Diffusion and Cellular Automata. Simulating Motion: Cellular Automata If all we have to work with is a grid of cells (spreadsheet), how can we simulate.
CELLULAR AUTOMATON Presented by Rajini Singh.
Cellular Automata MATH 800 Fall “Cellular Automata” 588,000 results in 94,600 results in 61,500 results in 2.
Joanne Turner 15 Nov 2005 Introduction to Cellular Automata.
Towards A Multi-Agent System for Network Decision Analysis Jan Dijkstra.
Nawaf M Albadia Introduction. Components. Behavior & Characteristics. Classes & Rules. Grid Dimensions. Evolving Cellular Automata using Genetic.
Parallelization: Conway’s Game of Life. Cellular automata: Important for science Biology – Mapping brain tumor growth Ecology – Interactions of species.
CITS4403 Computational Modelling Fractals. A fractal is a mathematical set that typically displays self-similar patterns. Fractals may be exactly the.
Multiscale Modelling Mateusz Sitko
Indiana GIS Conference, March 7-8, URBAN GROWTH MODELING USING MULTI-TEMPORAL IMAGES AND CELLULAR AUTOMATA – A CASE STUDY OF INDIANAPOLIS SHARAF.
Centre for Advanced Spatial Analysis (CASA), UCL, 1-19 Torrington Place, London WC1E 6BT, UK web Talk.
Cellular Automata Spatio-Temporal Information for Society Münster, 2014.
Cellular Automata Martijn van den Heuvel Models of Computation June 21st, 2011.
Model Iteration Iteration means to repeat a process and is sometimes referred to as looping. In ModelBuilder, you can use iteration to cause the entire.
Cellular Automata based Edge Detection. Cellular Automata Definition A discrete mathematical system characterized by local interaction and an inherently.
Traffic Flow. What is it? Traffic flow is the study of interactions between vehicles, drivers, and infrastructure (including highways, signage, and traffic.
Geosimulation Geosimulation models are developed to represent phenomena that occur in urban systems in highly realistic manner In particular, Cellular.
Showcase /06/2005 Towards Computational Epidemiology Using Stochastic Cellular Automata in Modeling Spread of Diseases Sangeeta Venkatachalam, Armin.
Unifying Dynamical Systems and Complex Networks Theories ~ A Proposal of “Generative Network Automata (GNA)” ~ Unifying Dynamical Systems and Complex Networks.
L – Modelling and Simulating Social Systems with MATLAB Lesson 6 – Graphs (Networks) Anders Johansson and Wenjian Yu (with S. Lozano.
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 FRES 1010 Eileen Kraemer Fall 2005.
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,
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.
L – Modeling and Simulating Social Systems with MATLAB Lecture 2 – Statistics and plotting © ETH Zürich | Giovanni Luca Ciampaglia,
© 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
L – Modeling and Simulating Social Systems with MATLAB
Modelling and Simulating Social Systems with MATLAB
Self-Organizing Network Model (SOM) Session 11
Hiroki Sayama NECSI Summer School 2008 Week 2: Complex Systems Modeling and Networks Network Models Hiroki Sayama
Courtesy: Dr. David Walker, Cardiff University
Spatio-Temporal Information for Society Münster, 2014
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Sangeeta Venkatachalam, Armin R. Mikler
Pedro Ribeiro de Andrade Münster, 2013
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Modelling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Modelling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Líliam César de Castro Medeiros,
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
A Cellular Automata Approach to Population Modeling
Illustrations of Simple Cellular Automata
L – Modeling and Simulating Social Systems with MATLAB
Pedro Andrade Gilberto Câmara
Spatio-temporal information in society: cellular automata
Hiroki Sayama NECSI Summer School 2008 Week 2: Complex Systems Modeling and Networks Cellular Automata Hiroki Sayama
Computer Architecture and Assembly Language
Data Structures & Algorithms
Computer Architecture and Assembly Language
A Cellular Automata Approach to Population Modeling
Von Neumann’s Automaton and Viruses
Cave generation with cellular automata
Introduction to Computer Science
Chapter 4 The Von Neumann Model
Presentation transcript:

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

Lesson 4 – Contents Cellular Automata Neighborhood definitions Models 18.05.2018 Lesson 4 – Contents Cellular Automata Neighborhood definitions Models Game of Life Highway Simulation Disease Spreading, revisited Exercises

Cellular Automaton (plural: Automata) 18.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. They are represented as grids with arbitrary dimension. Cellular-automata simulations are discrete both in time and space.

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

18.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 18.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

18.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

18.05.2018 Highway Simulation As an example of a 1-dimensional cellular automaton, we will present a highway simulation. 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

18.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)

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

Kermack-McKendrick Model 18.05.2018 Kermack-McKendrick Model In lesson 3, we introduced the Kermack- McKendrick model, used for simulating disease spreading. We will now implement the model again, but this time within the cellular-automata framework.

Kermack-McKendrick Model 18.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 18.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 18.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 18.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 18.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 18.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 18.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 18.05.2018 Kermack-McKendrick Model The Kermack-McKendrick model is specified as: At each 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 18.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

Cellular-Automaton Implementation 18.05.2018 Cellular-Automaton Implementation Sequential update:

Cellular-Automaton Implementation 18.05.2018 Cellular-Automaton Implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Sequential update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

Cellular-automaton implementation 18.05.2018 Cellular-automaton implementation Random update:

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

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

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

MATLAB implementation 18.05.2018 Set parameter values MATLAB implementation

MATLAB implementation 18.05.2018 Define grid, x MATLAB implementation

MATLAB implementation 18.05.2018 Define neighborhood MATLAB implementation

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

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

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

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

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

Projects Find somebody to work with. 18.05.2018 Projects Find somebody to work with. Have a look at the projects on: www.soms.ethz.ch/matlab/ When you have found an interesting topic, inform us and we will put you on the projects list. Within one week, send to: kdonnay@ethz.ch and sbalietti@ethz.ch a short plan about your project

Project Plan: Small summary: half an A4 page 18.05.2018 Project Plan: Small summary: half an A4 page This summary should include a brief plan which model to implement, what to simulate and which kind of results to expect. Add additional references you have found (pdf) The purpose is to get feedback and make sure that the project will develop in the right direction.

Projects – Suggested Topics 18.05.2018 Projects – Suggested Topics 1 Artificial Financial Markets 7 Emergence of Culture 13 Language Formation 19 Specialization of Labor 2 Civil Violence 8 Emergence of Values 14 Learning 20 Traffic Dynamics 3 Collective Behavior 9 Evacuation Bottleneck 15 Opinion Formation 21 Trail Formation 4 Disaster Spreading 10 Friendship Network Formation 16 Pedestrian Dynamics 22 Wikipedia 5 Emergence of Conventions 11 Innovation Diffusion 17 Self-organized criticality ? 6 Emergence of Cooperation 12 Interstate Conflict 18 Social Networks Evolution 60 60

18.05.2018 Exercise 1 Download the files draw_car.m and simulate_cars.m from the course web page, www.soms.ethz.ch/matlab 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.

18.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 old implementation.

Exercise 2b Modify the model in the following ways: 18.05.2018 Exercise 2b Modify the 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.