Upload
others
View
14
Download
0
Embed Size (px)
Citation preview
Modelling with cellular automata
Modelling with cellular automata
Shan He
School for Computational ScienceUniversity of Birmingham
Module 06-23836: Computational Modelling with MATLAB
Modelling with cellular automata
Outline
Outline of Topics
Concepts about cellular automata
Elementary Cellular Automaton
Langton’s ant
Game of life
CA for Lotka-Volterra model
Conclusion
Modelling with cellular automata
Concepts about cellular automata
What are cellular automata?
I cellular automaton: a discrete model consists of a regulargrid of cells, each in one of a finite number of states, such as“On” and “Off”.
I The grid is usually in 2D, but can be in any finite number ofdimensions.
I The cells evolves through a number of discrete time stepsaccording to a set of rules based on the states of neighboringcells.
I Originated from von Neumann, populated in 70s’ by JohnConway’s Game of Life, further researched by StephenWolfram
I Can be seen as the simplest agent-based models
Modelling with cellular automata
Concepts about cellular automata
Why CA are important?
I The best tool to model and study complex system, because:I They are simple;I The mechanisms are completely known;I They can do just about anything
I They might help us understand our universe: is the universe acellular automaton?
I They have lots of applications, e.g., random numbergenerator.
Modelling with cellular automata
Concepts about cellular automata
Some CA based biological models
I Pattern formation in biology, e.g., Conus textile
I Modelling cell interactions: brain tumor growth.
Modelling with cellular automata
Elementary Cellular Automaton
Elementary Cellular Automaton
I The simplest: One dimensional;
I Two possible states per cell: ‘0’ and ‘1’;
I A cell’s neighbors defined to be the adjacent cells on eitherside of it.
I A cell and its two neighbors form a neighborhood of 3 cells:23 = 8 possible patterns for a neighborhood.
I A rule consists of deciding, for each pattern, whether the cellwill be a 1 or a 0 in the next generation: 28 = 256 possiblerules.
Modelling with cellular automata
Elementary Cellular Automaton
Wolfram code
I Invented by Stephen Wolfram, the inventor of Mathematicaand promulgator of cellular automata.
I Clever idea: “Each possible current configuration is written onorder, 111, 110, ... , 001, 000, and the resulting state for eachof these configurations is written in the same order andinterpreted as the binary representation of an integer”.
I Summarised as a transition rule table, for example:current pattern 111 110 101 100 011 010 001 000
new state for center cell 0 1 1 0 1 1 1 0
I We have 28 = 256 possible rules, named from rule 1 to rule255.
Modelling with cellular automata
Elementary Cellular Automaton
Question
I The previous transition table is for rule 100, because thebinary number string of decimal number 110 is 01101110.
I Using the transition rule table you derived above, show howthe following initial configuration of the rule 110 cellularautomaton evolves in the next three time steps:
Initial configuration 0 0 1 1 0 0 0 0
Modelling with cellular automata
Elementary Cellular Automaton
Unique rules
I Many of the 256 rules are trivially equivalent to each other:simple transformation of the underlying geometry:
I Mirror: reflection through a vertical axis.I Complement: exchange the roles of 0 and 1 in the definition.
I Rule 110: The mirror image is rule 124, the complement isrule 137, and the mirrored complement is rule 193.
I There are 88 unique rules.
Modelling with cellular automata
Elementary Cellular Automaton
Wolfram Classes
I Class 1: rapidly converge to a uniform state. Examples arerules 0, 32, 160 and 250.
I Class 2: rapidly converge to a repetitive or stable state.Examples are rules 4, 108, 218 and 232.
I Class 3: appear to remain in a random state. Examples arerules 22, 30, 126, 150, 182.
I Class 4: form areas of repetitive or stable states, but also formstructures that interact with each other in complicated ways.Local changes to the initial pattern may spread infinitely. Anexample is rule 110. Rule 110 has been shown to be capableof universal computation.
Modelling with cellular automata
Elementary Cellular Automaton
Rule 30 and Chaos
I Rule 30: Discovered by Stephen Wolfram, his “all-timefavourite rule”.
I Displays aperiodic, chaotic behaviour.
I The key to understanding how simple rules produce complexstructures and behaviour in nature
Modelling with cellular automata
Elementary Cellular Automaton
Rule 110 and Universal Computation
I Also called universal Turing machine, a machine exhibitsuniversality
I Universality: ”the property of being able to perform differenttasks with the same underlying construction just by beingprogrammed in a different way.” - from Wolfram Mathworld
I Basically means: in principle, Rule 110 can simulated anycalculation or computer program (with even a polynomialoverhead!!)
Modelling with cellular automata
Elementary Cellular Automaton
Rule 110 and Universal Computation
I The proof of the universality is complicated: to proof it iscapable to emulate cyclic tag system, which is known to beuniversal.
I A cyclic tag system: a binary string of finite but unboundedlength evolves under the action of production rules applied incyclic order.
I Requires an infinite number of localized patterns (binarystring) to be embedded self-perpetuating localized patterns asbackground pattern (production rules)
I Self-perpetuating localized patterns (spaceships):00010011011111
I Example localized patterns: 0001110111, 1001111 and 111.
Modelling with cellular automata
Elementary Cellular Automaton
Other interesting rules and an interesting article
I Rule 62: Appears to be class 4 in the beginning but evolvesinto a repetitive state (class 2).
I Rule 73: Class 2, a lot of repetitive states separated by ‘walls’.But some are not obvious.
I Rule 54: Class 4 but its capability of universal computationhas not been proved.
I The Simplest Universal Turing Machine Is Proved
Modelling with cellular automata
Langton’s ant
Langton’s ant
I A very simple 2D CA: very simple rules, but complicatedemergent behavior
I A grid of cells with two possible states per cell: ‘0’ (white)and ‘1’ (black);
I Two simple rules:I At a white cell, turn 90 right, flip the color of the cell, move
forward one unitI At a black cell, turn 90 left, flip the color of the cell, move
forward one unit
I Complex behaviour: Initial period of chaotic behaviour forabout 10,000 steps, then builds a recurrent “highway” patternof 104 steps that repeats indefinitely.
Modelling with cellular automata
Langton’s ant
Extension of Langton’s ant
I Instead of just black and white, more colors can be used.
I For each of the successive colors, a letter ‘L’ or ‘R’ is used toindicate whether a left or right turn should be taken.
I Example: Black ⇒ Red ⇒ Green ⇒ Blue ⇒ BlackI Black: LI Red: RI Green: LI Blue: L
I Click here to see more example.
Modelling with cellular automata
Game of life
Game of life
I Also know as life.
I A CA invented by the John Conway in 1970.
I Originally devised on a board for the game of GO.
I A zero-player game, meaning that its evolution is determinedby its initial state.
I Opened up a whole new field of mathematical research, thefield of cellular automata.
I Also shown to be capable of universal computation.
Modelling with cellular automata
Game of life
Game of life
Every cell interacts with its eight neighbours (cells are horizontally,vertically, or diagonally adjacent) following the three simple rules:
I Any live cell with two live neighbours lives on to the nextgeneration.
I Any cell with exactly three live neighbours becomes orremains a live cell.
I Any other cell dies.
Modelling with cellular automata
Game of life
Game of life
Let’s try this on a very simple pattern:
{{{
{{{
Modelling with cellular automata
Game of life
Game of life
Next step:
{{{{{{{
Modelling with cellular automata
Game of life
Interesting patterns in game of life
I Period 2 oscillator: Blinker, Toad and Beacon
I Period 3 oscillator: Pulsar
I Methuselah patterns: small ”seed” pattern of initial live cellsthat take a large number of generations in order to stabilize.
I Spaceships: Glider
I Patterns grow indefinitely: Gosper glider gun
I Click here for common patterns in game of life
Modelling with cellular automata
Game of life
Other life-like CA rules
I Notation for rules:I Wolfram Code;I MCell notation: a string x/y . Digit d ∈ {0, . . . , 8} in the x
means that a live cell with d live neighbors survives into thenext generation, and the presence of d in the y string meansthat a dead cell with d live neighbors becomes alive in the nextgeneration. For example: Game of Life can be denoted as 23/3
I Golly notation: similar to above, but written in the formBy/Sx , e.g., Game of Life can be denoted as B3/S23
I Examples: Modern CA Entrance
Modelling with cellular automata
Game of life
Advantages of CA modelling approach
I They are simple and easy to be implemented.
I The are able to verify the relevance of physical mechanisms.
I They can include relationships and behaviors which aredifficult to formulate as continuum equations.
I They reflect the intrinsic individuality of cells.
Modelling with cellular automata
Game of life
Disadvantages of CA modelling approach
I Difficult for quantitative simulations.
I The artificial constraints of grid (lattice discretisation)
I Difficult to interpret the simulation outcomes
Modelling with cellular automata
CA for Lotka-Volterra model
CA for Lotka-Volterra model
I Pick a site (only stochastic updates allowed), and a neighbour.
I If fox is adjacent to rabbit, rabbit gets eaten (becomes foxwith probability r). Else fox dies with probability p.
I If rabbit is adjacent to bare ground, reproduces withprobability q.
I If bare ground is adjacent to anything, the thing moves intobare ground.
Modelling with cellular automata
Conclusion
Reading and video
I Complex Systems http://www.complex-systems.com/
I TED: Computing: a theory of everything
Modelling with cellular automata
Conclusion
Take home messages
I Complex behaviour, e.g., choatic behaviour, emerges fromlocal simple rules.
I By CA, we have demonstrated the four importantcharacteristics of complex systems:
I Self-organisation;I Non-Linearity;I Chaotic behaviour;I Emergent Properties.
I CA can be used to model complex systems, e.g., biologicalsystems.
I CA are the simplest agent-based models.
Modelling with cellular automata
Conclusion
Assignment
I Write a MATLAB programme to convert patterns on LifeLexicon Home Page for our MATLAB Game of Life (Clickhere for Life Lexicon Home Page)