Modelling with cellular automata
Modelling with cellular automata
Shan He
School for Computational Science
University 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 regular
grid 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 of
dimensions.
I
The cells evolves through a number of discrete time steps
according to a set of rules based on the states of neighboring
cells.
I
Originated from von Neumann, populated in 70s’ by John
Conway’s Game of Life, further researched by Stephen
Wolfram
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
I
I
They are simple;
The mechanisms are completely known;
They can do just about anything
I
They might help us understand our universe: is the universe a
cellular automaton?
I
They have lots of applications, e.g., random number
generator.
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 either
side 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 cell
will be a 1 or a 0 in the next generation: 28 = 256 possible
rules.
Modelling with cellular automata
Elementary Cellular Automaton
Wolfram code
I
Invented by Stephen Wolfram, the inventor of Mathematica
and promulgator of cellular automata.
I
Clever idea: “Each possible current configuration is written on
order, 111, 110, ... , 001, 000, and the resulting state for each
of these configurations is written in the same order and
interpreted as the binary representation of an integer”.
I
Summarised as a transition rule table, for example:
current pattern
new state for center cell
I
111
0
110
1
101
1
100
0
011
1
010
1
001
1
We have 28 = 256 possible rules, named from rule 1 to rule
255.
000
0
Modelling with cellular automata
Elementary Cellular Automaton
Question
I
The previous transition table is for rule 100, because the
binary number string of decimal number 110 is 01101110.
I
Using the transition rule table you derived above, show how
the following initial configuration of the rule 110 cellular
automaton 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
I
Mirror: reflection through a vertical axis.
Complement: exchange the roles of 0 and 1 in the definition.
I
Rule 110: The mirror image is rule 124, the complement is
rule 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 are
rules 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 are
rules 22, 30, 126, 150, 182.
I
Class 4: form areas of repetitive or stable states, but also form
structures that interact with each other in complicated ways.
Local changes to the initial pattern may spread infinitely. An
example is rule 110. Rule 110 has been shown to be capable
of universal computation.
Modelling with cellular automata
Elementary Cellular Automaton
Rule 30 and Chaos
I
Rule 30: Discovered by Stephen Wolfram, his “all-time
favourite rule”.
I
Displays aperiodic, chaotic behaviour.
I
The key to understanding how simple rules produce complex
structures and behaviour in nature
Modelling with cellular automata
Elementary Cellular Automaton
Rule 110 and Universal Computation
I
Also called universal Turing machine, a machine exhibits
universality
I
Universality: ”the property of being able to perform different
tasks with the same underlying construction just by being
programmed in a different way.” - from Wolfram Mathworld
I
Basically means: in principle, Rule 110 can simulated any
calculation or computer program (with even a polynomial
overhead!!)
Modelling with cellular automata
Elementary Cellular Automaton
Rule 110 and Universal Computation
I
The proof of the universality is complicated: to proof it is
capable to emulate cyclic tag system, which is known to be
universal.
I
A cyclic tag system: a binary string of finite but unbounded
length evolves under the action of production rules applied in
cyclic order.
I
Requires an infinite number of localized patterns (binary
string) to be embedded self-perpetuating localized patterns as
background 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 evolves
into 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 computation
has 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 complicated
emergent behavior
I
A grid of cells with two possible states per cell: ‘0’ (white)
and ‘1’ (black);
Two simple rules:
I
I
I
I
At a white cell, turn 90 right, flip the color of the cell, move
forward one unit
At a black cell, turn 90 left, flip the color of the cell, move
forward one unit
Complex behaviour: Initial period of chaotic behaviour for
about 10,000 steps, then builds a recurrent “highway” pattern
of 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 to
indicate whether a left or right turn should be taken.
Example: Black ⇒ Red ⇒ Green ⇒ Blue ⇒ Black
I
I
I
I
I
I
Black: L
Red: R
Green: L
Blue: L
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 determined
by its initial state.
I
Opened up a whole new field of mathematical research, the
field 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 next
generation.
I
Any cell with exactly three live neighbours becomes or
remains 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 cells
that 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
I
I
I
Wolfram Code;
MCell notation: a string x/y . Digit d ∈ {0, . . . , 8} in the x
means that a live cell with d live neighbors survives into the
next generation, and the presence of d in the y string means
that a dead cell with d live neighbors becomes alive in the next
generation. For example: Game of Life can be denoted as 23/3
Golly notation: similar to above, but written in the form
By /Sx, e.g., Game of Life can be denoted as B3/S23
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 are
difficult 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 fox
with probability r ). Else fox dies with probability p.
I
If rabbit is adjacent to bare ground, reproduces with
probability q.
I
If bare ground is adjacent to anything, the thing moves into
bare 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
I
Complex behaviour, e.g., choatic behaviour, emerges from
local simple rules.
By CA, we have demonstrated the four important
characteristics of complex systems:
I
I
I
I
Self-organisation;
Non-Linearity;
Chaotic behaviour;
Emergent Properties.
I
CA can be used to model complex systems, e.g., biological
systems.
I
CA are the simplest agent-based models.
Modelling with cellular automata
Conclusion
Assignment
I
Write a MATLAB programme to convert patterns on Life
Lexicon Home Page for our MATLAB Game of Life (Click
here for Life Lexicon Home Page)
© Copyright 2026 Paperzz