851 0585 04 L Modeling and Simulating Social

  • Slides: 63
Download presentation
851 -0585 -04 L – Modeling and Simulating Social Systems with MATLAB Lecture 4

851 -0585 -04 L – 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 | 2010 -10 -18

Lesson 4 – Contents § Cellular Automata § Neighborhood definitions § Models Game of

Lesson 4 – Contents § Cellular Automata § Neighborhood definitions § Models Game of Life § Highway Simulation § Disease Spreading, revisited § § Exercises 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 2

Cellular Automaton (plural: Automata) § A cellular automaton is a rule, defining how the

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. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 3

Cellular Automaton § The grid can have an arbitrary number of dimensions: 1 -dimensional

Cellular Automaton § The grid can have an arbitrary number of dimensions: 1 -dimensional cellular automaton 2010 -10 -18 2 -dimensional cellular automaton G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 4

Moore Neighborhood § The cells are interacting with each neighbor cells, and the neighborhood

Moore Neighborhood § The cells are interacting with each neighbor cells, and the neighborhood can be defined in different ways, e. g. the Moore neighborhood: 1 st order Moore neighborhood 2010 -10 -18 2 nd order Moore neighborhood G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 5

Von-Neumann Neighborhood § The cells are interacting with each neighbor cells, and the neighborhood

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: 1 st order Von-Neumann neighborhood 2010 -10 -18 2 nd order Von-Neumann neighborhood G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 6

Game of Life § Ni = Number of 1 st order Moore neighbors to

Game of Life § Ni = Number of 1 st order Moore neighbors to cell i that are activated. § For each cell i: Deactivate: If Ni <2 or Ni >3. 2. Activate: if cell i is deactivated and Ni =3 1. www. mathworld. wolfram. com 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 7

Highway Simulation § As an example of a 1 -dimensional cellular automaton, we will

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. 2. Move: Otherwise, move one step to the right, with probability p 1. Move to the next cell, with the probability p 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 8

Highway Simulation § We have prepared some files for the highway simulations: § draw_car.

Highway Simulation § We have prepared some files for the highway simulations: § draw_car. m : Draws a car, with the function draw_car(x 0, y 0, w, h) § simulate_cars. m: Runs the simulation, with the function simulate_cars(move. Prob, in. Flow, with. Graphics) 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 9

Highway Simulation § Running the simulation is done like this: simulate_cars(0. 9, 0. 2,

Highway Simulation § Running the simulation is done like this: simulate_cars(0. 9, 0. 2, true) 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 10

Kermack-Mc. Kendrick Model § In lesson 3, we introduced the Kermack. Mc. Kendrick model,

Kermack-Mc. Kendrick Model § In lesson 3, we introduced the Kermack. Mc. Kendrick model, used for simulating disease spreading. § We will now implement the model again, but this time within the cellular-automata framework. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 11

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2010 -10 -18 S β transmission R γ recovery G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch I 12

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 13

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 14

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 15

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 16

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: For the MATLAB

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick 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 S S S 0 0 0 0 I I I S S 1 1 1 0 0 I I S S S 1 1 0 0 0 R I I I S S S 2 1 1 1 0 0 0 I I I S S 1 1 1 0 0 I S S S 1 0 0 0 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 17

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: We now define

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: We now define a 2 -dimensional cellularautomaton, by defining a grid (matrix) x, where each of the cells is in one of the states: 0: Susceptible § 1: Infected § 2: Recovered § 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 18

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick model is specified as: At each time

Kermack-Mc. Kendrick Model § The Kermack-Mc. Kendrick 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 γ. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 19

Cellular-Automaton Implementation § Implementation of a 2 -dimensional cellularautomaton model in MATLAB is done

Cellular-Automaton Implementation § Implementation of a 2 -dimensional cellularautomaton model in MATLAB is done like this: Iterate the time variable, t Iterate over all cells, i=1. . N, j=1. . N Iterate over all neighbors, k=1. . M § The iteration over the cells can be done either sequentially, or randomly. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 20

Cellular-Automaton Implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-Automaton Implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 21

Cellular-Automaton Implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-Automaton Implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 22

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 23

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 24

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 25

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 26

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 27

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 28

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 29

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 30

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 31

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 32

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 33

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 34

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 35

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 36

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Sequential update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 37

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 38

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 39

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 40

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 41

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 42

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 43

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 44

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 45

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Cellular-automaton implementation § Random update: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 46

Boundary Conditions § The boundary conditions can be any of the following: § Periodic:

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. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 47

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

Boundary Conditions § The boundary conditions can be any of the following: Fixed boundaries 2010 -10 -18 Periodic boundaries G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 48

MATLAB Implementation of the Kermack. Mc. Kendrick Model 2010 -10 -18 G. L. Ciampaglia,

MATLAB Implementation of the Kermack. Mc. Kendrick Model 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 49

Set parameter values MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Set parameter values MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 50

Define grid, x MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti &

Define grid, x MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 51

Define neighborhood MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K.

Define neighborhood MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 52

Main loop. Iterate the time variable, t MATLAB implementation 2010 -10 -18 G. L.

Main loop. Iterate the time variable, t MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 53

Iterate over all cells, i=1. . N, j=1. . N MATLAB implementation 2010 -10

Iterate over all cells, i=1. . N, j=1. . N MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 54

For each cell i, j: Iterate over the neighbors MATLAB implementation 2010 -10 -18

For each cell i, j: Iterate over the neighbors MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 55

The model, i. e. updating rule goes here. MATLAB implementation 2010 -10 -18 G.

The model, i. e. updating rule goes here. MATLAB implementation 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 56

Breaking Execution § When running large computations or animations, the execution can be stopped

Breaking Execution § When running large computations or animations, the execution can be stopped by pressing Ctrl+C in the main window: 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 57

Projects 1. Find somebody to work with. 2. Have a look at the projects

Projects 1. Find somebody to work with. 2. Have a look at the projects on: www. soms. ethz. ch/matlab/ 3. When you have found an interesting topic, inform us and we will put you on the projects list. 4. Within one week, send to: kdonnay@ethz. ch and sbalietti@ethz. ch a short plan about your project 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 58

Project Plan: § Small summary: half an A 4 page § This summary should

Project Plan: § Small summary: half an A 4 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. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 59

Projects – Suggested Topics 1 Artificial 7 Emergence of Financial Markets Culture 13 Language

Projects – Suggested Topics 1 Artificial 7 Emergence of Financial Markets 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 16 Pedestrian Dynamics 22 Wikipedia 5 Emergence of Conventions 10 Friendship Network Formation 11 Innovation Diffusion 17 Self-organized criticality ? 6 Emergence of Cooperation 12 Interstate Conflict 18 Social Networks ? Evolution 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 60

Exercise 1 § Download the files draw_car. m and simulate_cars. m from the course

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. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 61

Exercise 2 § Download the file disease. m which is an implementation of the

Exercise 2 § Download the file disease. m which is an implementation of the Kermack-Mc. Kendrick 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. 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 62

Exercise 2 b § Modify the model in the following ways: Change from the

Exercise 2 b § Modify the model in the following ways: Change from the 1 st order Moore neighborhood to a 2 nd and 3 rd order Moore neighborhood. § Make it possible for Removed individuals to change state back to Susceptible. § 2010 -10 -18 G. L. Ciampaglia, S. Balietti & K. Donnay / ciampagg@ethz. ch sbalietti@ethz. ch kdonnay@ethz. ch 63