Modeling and Simulating Social Systems with MATLAB Lecture 5 – Cellular Automata Olivia Woolley, Stefano Balietti, Lloyd Sanders Computational Social Science (D GESS) 2015-10-26 ETH Zürich
Strategies for Research Projects “Data project”: Choose a dataset for which you have an interesting question Come up with a research question that can be tested with that data Implement an existing model form the scientific literature Run simulations that either use the dataset as input or that reproduce certain aspects of the data 2015-10-26 2 Modelling and Simulating Social Systems with Matlab
Strategies for Research Projects “Paper project”: Choose a scientific paper (or several papers) on a modeling and simulation approach that looks interesting Come up with a research question that builds upon the paper but is different from their research questions Extend, simplify, modify, and/or combine existing models for testing your research question Run simulations for your model and compare the results to the ones for the original model 2015-10-26 3 Modelling and Simulating Social Systems with Matlab
Repetition D y n a m i c a l s y s t e m s d e s c r i b e d b y a s e t o f differential equations; numerical solutions can be calculated iteratively using Euler's method ( e x a m p l e s : L o t k a - Volterra and Kermack-McKendrick) The values and ranges of parameters critically matter for the system dynamics (Example 2, epidemiological threshold) Time resolution in Euler's method must be sufficiently high to capture “fast” system dynamics (Example 3) MATLAB provides the commands ode23 and ode45 for solving differential equations (Example 3) 2015-10-26 4 4 Modelling and Simulating Social Systems with Matlab
Simulation Models W h a t d o w e m e a n w h e n w e s p e a k o f (simulation) models? Formalized (computational) representation of social (or other kinds of) dynamics Reduction of complexity, i.e. highly simplifying assumptions The goal is not to reproduce reality in general (only very specific aspects of it) Formal framework to test and evaluate causal hypotheses against empirical data 2015-10-26 5 5 Modelling and Simulating Social Systems with Matlab
Simulation Models Strength of (simulation) models? Computational laboratory: test how micro dynamics lead to macro patters Experiments with computer models are particularly useful in the social sciences, where experiments in the real world are typically not possible Suitable where analytical models fail or where dynamics are too complex for analytical models 2015-10-26 6 6 Modelling and Simulating Social Systems with Matlab
Simulation Models Weakness of (simulation) models? The choice of model parameters and implementation details can have a strong influence on the simulation outcome We can only model aspects of a system, i.e. the models are necessarily incomplete and reductionist More complex models are generally not better (only when simplification is not possible) It can be hard to relate simulation results to a realistic and relevant empirical question 2015-10-26 7 7 Modelling and Simulating Social Systems with Matlab
Simulation Models How to we deal with the known limitations? Simple models with only few parameters Test whether simulation results depend on details of the implementation or model Validate the model mechanism with observations and causal plausibility Use empirical data to evaluate the predictive power of the simulation model 2015-10-26 8 8 Modelling and Simulating Social Systems with Matlab
Cellular Automaton (plural: Automata) 2015-10-26 9 9 Modelling and Simulating Social Systems with Matlab
Cellular Automaton (plural: Automata) A cellular automaton is a set of rules, defining how the state of a cell in a grid is updated, depending on the states of its neighboring cells Cellular-automata simulations are discrete in time and space 2015-10-26 10 10 Modelling and Simulating Social Systems with Matlab
Cellular Automaton The grid can have an arbitrary number of dimensions: 1-dimensional cellular automaton 2-dimensional cellular automaton 2015-10-26 11 Modelling and Simulating Social Systems with Matlab
Moore Neighborhood The cells are interacting with each neighbor cells, and the neighborhood can be defined in different ways, e.g. the M o o r e n e i g h b o r h o o d : 1 st order Moore neighborhood 2 nd order Moore neighborhood 2015-10-26 12 Modelling and Simulating Social Systems with Matlab
Von-Neumann Neighborhood T h e c e l l s a r e i n t e r a c t i n g w i t h e a c h n e i g h b o r c e l l s , and the neighborhood can be defined in different ways, e.g. the V o n - N e u m a n n n e i g h b o r h o o d : 2 nd order Von-Neumann 1 st order Von-Neumann neighborhood neighborhood 2015-10-26 13 Modelling and Simulating Social Systems with Matlab
Game of Life N i = Number of 1 s t order Moore neighbors to cell i that are activated . For each cell i : 1. D e a c t i v a t e active cell iff N i < 2 o r N i >3. 2. A c t i v a t e inactive cell iff N i =3 i 2015-10-26 14 Modelling and Simulating Social Systems with Matlab
Game of Life N i = Number of 1 s t order Moore neighbors to cell i that are activated . For each cell i : 1. Deactivate active cell if N i <2 or N i >3. 2. Activate inactive cell if N i =3 2015-10-26 15 15 Modelling and Simulating Social Systems with Matlab
Game of Life Want to see the Game of Life in action? Type: l i f e 2015-10-26 16 16 Modelling and Simulating Social Systems with Matlab
Complex Patterns “ Gosper Glider Gun”: 2015-10-26 17 17 Modelling and Simulating Social Systems with Matlab
Game of Life: Some Bits of History 1970: Conway presents the Game of Life; discovery of the glider (speed c/4) and the standard spaceships (speed c/2); discovery of the Gosper glider gun (first pattern found with indefinite growth) 1971: First garden of eden (pattern that has no parent pattern and can only occur at generation 0) was discovered; first patter with quadratic growth (breeder) 1989: Discovery of the first spaceships with velocities c/3 and c/4 1996: Game of Life simulated in Game of Life 2000: A Turing machine was built in Game of Life 2004: Construction of the largest interesting pattern so far: caterpillar spaceship with speed 17c/45 consisting of 11,880,063 alive cells 2013: The first complete replicator (a pattern that produces an exact copy of itself) was built 2014: Game of Life wiki contains more than 3000 interesting patterns 2015-10-26 18 Modelling and Simulating Social Systems with Matlab
Surprising discoveries continue “The loafer” is a very small spaceship It is the slowest known orthogonal spaceship (speed of c/7) It was discovered only in 2013 2015-10-26 19 Modelling and Simulating Social Systems with Matlab
Life in Life The Game of Life can be used to simulate the Game of Life: h t t p : / / w w w . y o u t u b e . c o m / w a t c h ? v = x P 5 - i I e K X E 8 2015-10-26 20 20 Modelling and Simulating Social Systems with Matlab
Life in Life The Game of Life can be used to calculate everything (if a Turing machine can): http://www.youtube.com/watch?v=My8AsV7bA94 2015-10-26 21 21 Modelling and Simulating Social Systems with Matlab
1-dimensional Cellular Automata 2015-10-26 22 22 Modelling and Simulating Social Systems with Matlab
Cellular Automaton: Principles 1. S e l f O r g a n i z a t i o n : Patterns appear from random start patterns 2. Emergence: High-level phenomena can appear such as gliders, glider guns, etc. 3. Complexity: Simple rules produce complex phenomena 2015-10-26 23 23 Modelling and Simulating Social Systems with Matlab
Highway Simulation Simple example of a 1-dimensional cellular automaton Rules for each car at cell i : S t a y : I f t h e c e l l d i r e c t l y t o t h e r i g h t i s o c c u p i e d . 1. Move : Otherwise, move one step to the right, with 2. probability p Move to the next cell, with the probability p 2015-10-26 24 24 Modelling and Simulating Social Systems with Matlab
Highway Simulation We have prepared some files for the highway simulations: d r a w _ c a r . 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) 2015-10-26 25 25 Modelling and Simulating Social Systems with Matlab
Highway Simulation Running the simulation is done like this: s i m u l a t e _ c a r s ( 0 . 9 , 0 . 2 , t r u e ) 2015-10-26 26 26 Modelling and Simulating Social Systems with Matlab
Kermack-McKendrick Model In lecture 4, 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 use the approach of cellular automata 2015-10-26 27 27 Modelling and Simulating Social Systems with Matlab
Kermack-McKendrick model 2015-10-26 28 Modelling and Simulating Social Systems with Matlab
Recommend
More recommend