0% found this document useful (0 votes)
66 views91 pages

4 Cellular Automata

Cellular automata (CA) are discrete mathematical models that simulate physical systems. They consist of a regular grid of cells that can be in a finite number of states according to a set of rules. The document discusses the definition and basic concepts of CA, including how they use local interactions and parallel updating to generate complex patterns from simple initial conditions. It provides an example of Langton's parity CA and how it can replicate structures through a reading and transformation mechanism. The historical background notes that John von Neumann originally conceived of CA to model self-replication and repair in computers.

Uploaded by

Sayed ElSheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views91 pages

4 Cellular Automata

Cellular automata (CA) are discrete mathematical models that simulate physical systems. They consist of a regular grid of cells that can be in a finite number of states according to a set of rules. The document discusses the definition and basic concepts of CA, including how they use local interactions and parallel updating to generate complex patterns from simple initial conditions. It provides an example of Langton's parity CA and how it can replicate structures through a reading and transformation mechanism. The historical background notes that John von Neumann originally conceived of CA to model self-replication and repair in computers.

Uploaded by

Sayed ElSheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

Simulation and modeling of natural processes

Week 4: Cellular Automata Modeling

B. Chopard et M. Droz: Cellular Automata Modeling of Physical Systems,


Cambridge University Press, 1998.
1. Definition and basic concepts
3.1 Définition et concepts de bases

What is a Cellular Automata?


I A mathematical abstraction of the real world, a modeling framework
I Fictitious Universe in which everything is discrete
I But, it is also a mathematical object, new paradigm for computation
I Elucidate some links between complex systems, universal computations,
algorithmic complexity, intractability.
Example: the Parity Rule
I Square lattice (chessboard)
I Possible states sij = 0, 1
I Rule: each cell sums up the states of its 4 neighbors (north, east, south and west).
I If the sum is even, the new state is sij = 0; otherwise sij = 1

Generate “complex” patterns out of a simple initial condition.


t=0 t=31 t=43

t=75 t=248 t=292

t=357 t=358 t=359

t=360 t=511 t=571


Pattern generated by the Parity Rule
CA Definition
I Discrete space A: regular lattice of cells/sites in d dimensions.
I Discrete time
I Possible states for the cells: discrete set S
I Local, homogeneous evolution rule Φ (defined for a neighborhood N ).
I Synchronous (parallel) updating of the cells
I Tuple: < A, S, N , Φ >
Neighborhood

I von Newmann
I Moore
I Margolus
I ...

(a) (b)
Boundary conditions
I periodic
I fixed
I reflexive
I ....

b a b 1 a
periodic fixed

a a b a b
adiabatic reflection
Generalization

I Stochastic CA
I Asynchronous update: loss of parallelism, but avoid oscillations
I Non-uniform CA
Implementation of the evolution rule

I On-the-fly calculation

sij (t + 1) = si−1,j (t) ⊕ si+1,j (t) ⊕ si,j−1 (t) ⊕ si,j+1 (t)


I Lookup table
index = si−1,j (t) + 2si+1,j (t) + 4si,j−1 (t) + 8si,j+1 (t)

and then
sij (t + 1) = Rule[index]
The possible universes...
k
I Finite number of possible universes: mm possible rules where m is the number of
states per cell and k the number of neighbors.
I Most of them are uninteresting
Wolfram classification of 1D rules with m = 1, k = 3:

(a) (b) (c) (d)


I Class III self-similar, chaotic attractor
I Class I Reaches a fixed point I Class IV unpredicable persistent
I Class II Reaches a limit cycle structures, irreducible, universal
computer
End of module
Definition and basic concepts

Coming next
Historical background
2. Historical background
Historical notes

I Origin of the CA’s (1940s): John von Neumann and S. Ulam


I Design a better computer with self-repair and self-correction mechanisms
I Simpler problem: find the logical mechanisms for self-reproduction:
I Before the discovery of DNA: find an algorithmic way (transcription and
translation)
I Formalization in a fully discrete world
I Automaton with 29 states, arrangement of thousands of cells which can
self-reproduce
I Universal computer
Langton’s CA

I Simplified version (8 states).


I Not a universal computer
I Structures with their own fabrication recipe
I Using a reading and transformation mechanism
Langton’s CA: basic cell replication
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
2 1 1 2 2 0 1 7 0 1 7 0 1 2 2 1 1 1 1 1 7 0 1 2
2 1 2 2 7 2 2 2 2 2 2 7 2 2 0 2 2 2 2 2 2 7 2
2 1 2 2 2 0 2 2 4 2 2 0 2
2 1 2 2 1 2 2 1 2 2 1 2
2 7 2 2 7 2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2 0 2 2 1 2 2 7 2
2 7 2 2 2 2 2 2 7 2 2 7 2 2 2 2 2 2 7 2 2 1 2 2 2 2 2 2 1 2 2 1 2 2 2 2 2 2 0 2
2 1 0 7 1 0 7 1 0 2 2 1 0 7 1 0 7 1 0 2 2 0 4 1 0 7 1 0 7 2 2 1 1 0 4 1 0 4 1 2
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

iteration=137 iteration=140 iteration=145 iteration=150

iteration=350

iteration 600
Langton’s CA: some conclusions

I Not a biological model, but an algorithmic abstraction


I Reproduction can be seen from a mechanistic point of view (Energy and
matter are needed)
I No need of a hierarchical structure in which the more compicated builds
the less complicated
I Evolving Hardware.
End of module
Historical background

Coming next
A mathematical abstraction of reality
3. A mathematical abstraction of
reality
CA as a mathematical abstraction of reality

I Several levels of reality: macroscopic, mesoscopic and microscopic.


I The macroscopic behavior depends very little on the details of the
microscopic interactions.
I Only “symmetries” or conservation laws survive. The challenge is to find
them.
I Consider a fictitious world, particularly easy to simulate on a
(parallel) computer with the desired macroscopic behavior.
I Simple, flexible, intuitive, efficient
A Caricature of reality

t=4 t=10 t=54

What is this ?
The real thing

Wilson Bentley, From Annual Summary of the "Monthly Weather Review", 1902.
Snowflakes model

I Very rich reality, many different shapes


I Complicated true microscopic description
I Yet a simple growth mechanism can capture some essential features
• A vapor molecule solidifies (→ice) if one and only one already
solidified molecule is in its vicinity
• Growth is constrained by 60o angles
Examples of CA rules
I Growth model in physics: droplet, interface, etc
I Biased majority rule: (almost copy what the neighbors do)
Annealing Rule:
sumij (t) 0123456789
sij (t + 1) 0000101111
Examples of CA rules

http://cui.unige.ch/~chopard/CA/Animations/img-root.html
Cells differentiation in drosophila

In the embryo all the cells are identical. Then during evolution they
differentiate
I slightly less than 25% become neural cells (neuroblasts)

I the rest becomes body cells (epidermioblasts).

Biological hypotheses:
I Cells produce a substance S (protein) which leads to differentiation when

a threshold S0 is reached.
I Neighboring cells inhibit the local S production.
CA model for a competition/inhibition process

I Hexagonal lattice
I The values of S can be 0 (inhibited) or 1 (active) in each lattice cell.
I A S = 0 cell will grow (i.e. turn to S = 1) with probability pgrow
provided that all its neighbors are 0. Otherwise, it stays inhibited.
I A cell in state S = 1 will decay (i.e. turn to S = 0) with probability
pdecay if it is surrounded by at least one active cell. If the active cell is
isolated (all the neighbors are in state 0) it remains in state 1.
Differentiation: results

The two limit solutions with density 1/3 and 1/7, respectively.
I CA produces situations with about 23% of active cells, for almost any
value of panihil and pgrowth .
I Model robust to the lack of details, but need for hexagonal cells
Excitable Media, contagion models

I 3 states: (1) normal (resting), (2) excited (contagious), (3)


refractory (immuned)
1. excited → refractory
2. refractory→ normal
3. normal → excited, if there exists excited neighbors (otherwise, normal → normal).
Greenberg-Hastings Model
I s ∈ {0, 1, 2, ..., n − 1}
I normal: s = 0; excited s = 1, 2, ..., n/2; the remaining states are refractory
I contamination if at least k contaminated neighbors.

t=5 t=110

t=115 t=120
Belousov-Zhabotinski (tube worm)
The state of each site is either 0 or 1; a local timer with values 0, 1, 2 or 3 controls the 0
period.

(i) where the timer is zero, the state is excited;


(ii) the timer is reset to 3 for the excited sites
which have two, or more than four, excited
sites in their Moore neighborhood.
(iii) the timer is decreased by 1 unless it is 0;
Forest fire
(1) a burning tree becomes an empty site;
(2) a green tree becomes a burning tree if at
least one of its nearest neighbors is burning;
(3) at an empty site, a tree grows with
probability p;
(4) A tree without a burning nearest neighbor
becomes a burning tree during one time step
with probability f (lightning).
End of module
A mathematical abstraction of reality

Coming next
Traffic models
4. Cellular Automata Models for Traffic
Traffic Models
A vehicle can move only when the downstream cell is free (Wolfram rule 184).

time t

time t+1
Flow diagram
The car density at time t on a road segment of length L is defined as
N (t)
ρ(t) =
L
where N is the no of cars along L
The average velocity < v > at time t on this segment is defined as
M (t)
< v >=
N (t)
where M (t) is the number of car moving at time t
The traffic flow j is defined as
j=ρ<v>
Flow diagram of rule 184
1

flow

0
0 1
car density
Traffic in a Manhattan-like city

f g

(a) (b)
d c

a b h (a) (b)
1 0.35
e free rotary

Traffic flow
<v>

road spacing=256 flip-flop


road spacing=32 free rotary
road spacing=4 traffic-light
0 0
0 1 0 1
car density car density
Case of the city of Geneva

Origin
Destination
2

I 1066 junctions
4
3 3
I 3145 road segments
1
4
I 560886 road cells 2

1
I 85055 cars
Travel time during the rush hour
insertion probability Trip 2 Trip 3
35 35

30 30

Travel time [minutes]

Travel time [minutes]


p2 25 25

20 20

Average travel time


15 15 Average travel time

p1
10 10

0 5 10 15 20 25 30 35 40 45 0 5 10 15 20 25 30 35 40 45
time Departure time [minutes] Departure time [minutes]
0 I 2 I I
3 3
End of module
Traffic models

Coming next
Complex systems
5. Complex systems
Complex systems
Rule of the Conway’s Game of Life:
I Birth if exactly 3 living
I Square lattice, 8 neighbors neighbors
I Cells are dead or alive (0/1) I Death if less than 2 or more
than 3 neighbors

t t+10 t+20
Complex Behavior in the game of life

Collective behaviors develop (beyond the local rule)


“Gliders” (organized structures of cell) can emerge and can move collectively.

t=0 t=1 t=2 t=3 t=4


Complex Behavior in the game of life

A glider gun

I A glider gun is a structure that keeps creating


gliders
I There are more complex structures with more
complex behavior: a zoology of organisms.
I The game of life is a Universal computer

iteration=150
The Langton’s Ant

This is a hypothetical animal moving on a 2D lattice, accoring to


a simple rule. This rule depends on the “color” of the cell on
which the ant is.
The rule of motion
Several steps
Several steps
Several steps
Several steps
Several steps
Several steps
Several steps
Several steps
Several steps
Were does the ant go in the long term?
I Animation...
Were does the ant go in the long term?

I t=6900 t=10431 t=12000


The ants always escape to infinity
What about many ants?
I The trajectory can be bounded or
I Adapt the “change of color” rule not
I Cooperative and destructive effects I Past/futur symmetry explains
periodic motion

t=2600 t=4900 t=8564


Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


I ...because we define it ourselves
Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


I ...because we define it ourselves
I However we cannot predict the detailed motion of tha ant (e.g. at what
time does the highway appears)
Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


I ...because we define it ourselves
I However we cannot predict the detailed motion of tha ant (e.g. at what
time does the highway appears)
I The microscopic description is not always able to predict the macroscopic
behavior
Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


I ...because we define it ourselves
I However we cannot predict the detailed motion of tha ant (e.g. at what
time does the highway appears)
I The microscopic description is not always able to predict the macroscopic
behavior
I The only solution: observe the system
Impact on the scientific methodolgy

I We know perfectly well the fundamental law governing the system


I ...because we define it ourselves
I However we cannot predict the detailed motion of tha ant (e.g. at what
time does the highway appears)
I The microscopic description is not always able to predict the macroscopic
behavior
I The only solution: observe the system
I The only information we get on the trajectory is global and relects the
symmetry of the rule.
t=0 t=31 t=43

t=75 t=248 t=292

t=357 t=358 t=359

t=360 t=511 t=571


For other rules, on can be faster than the observation
For other rules, on can be faster than the observation

(a) (b) (c)


I Instead of n × n × T computations (direct observation), one can get the results in
n × n × log(T ) computations
End of module
Complex systems

Coming next
Lattice-gas models
6. Lattice-gas models
Lattice Gas model

j y

i x
Lattice gas Automata (LGA)

I LGA: Lattice Gas automata


I It is a CA that models a gas or a fluid through the dynamics of discrete
particles moving on a lattice.
I Fully discrete Molecular Dynamics
I Idealized particles at a mésoscopic scale: the microscopic details are
simplified
I One can show the equivalence of LGA models with the real phenomena
I Diffusion processes, chemical reactions advection phenomena can also be
represented as a LGA
Description

I The particles have a finite number of possible velocities, vi


I They are such that in a time step ∆t of the CA, particles
jumps to a neighboring lattice points, thus traveling a distance
∆x.
I The choice of the vi ’s is strongly related to the choice of the
lattice since r + ∆tvi must belong to the lattice
Description

I The state of each cell r is given by occupation numbers


ni (r, t)
I ni (r, t) = 1 means that a particle enters site r at time t with
velocity vi .
I ni = 0 means the absence of such a particle
Exclusion principle

I ni ∈ {0, 1} is Boolean number: there is at most 1 particle per


site and per direction at a given time.
I A finite number of bits is sufficient to fully describe the state
of the system.
Example: HPP model collision rules
(a)

I HPP: Hardy, Pomeau, de Pazzis, 1971:


kinetic theory of point particles on the
(b)
D2Q4 lattice
I FHP: Frisch, Hasslacher and Pomeau,
1986: first LGA reproducing a
(almost) correct hydrodynamic
behavior (Navier-Stokes eq.) (c)

time t time t+1

Exact mass and momentum conservation: that is what really matters for a
FHP model
p=1/2

p=1/2

Stochastic rule with Conservation of mass and momentum.


Flow past an obstacle (FHP)
End of module
Lattice-gas models

Coming next
Microdynamics of LGA
7. Microdynamics of LGA
Microdynamics of LGA
It consists of two steps. We define nin out
i = ni and ni to better specify them
I Collision step: The quantities nin
i “collide” locally. Particles are deviated and new
values nout
i are computed at each lattice site, according to a pre-defined collision
operator Ωi (n)
I Propagation step: The quantitiy nout
i (r) is sent to the neighboring site along lattice
direction vi .

Collision Propagation
Microdynamics of LGA

In formula, we get
I collision: n
out in in
i (r, t) = ni (r, t) + Ωi (n (r, t)
in
I propagation: n (r + vi ∆t, t + ∆t) = n
out
i i (r, t)
where ∆t carry the time units and vi has the unit of a velocity.
Particle with velocity ni travels in direction vi and will thus reach
lattice site r + vi , still with velocity vi .
Microdynamics of LGA

The above formula reflects how the LGA microdynamics is


implemented in a computer. But mathematically, one ca combine
the collision and propagation steps into:

ni (r + vi ∆t, t + ∆t) = ni (r, t) + Ωi (n(r, t)


where ni ≡ nin
i
Note: if Ωi = 0, we obtain a free particle motion or streaming
HPP model
(a)

(b)

(c)
HPP model: Computer Implementation
Admitted velocities

v1 = (1, 0), v2 = (0, 1), v3 = (−1, 0) v4 = (0, −1)


Microdynamics:

nout
i = ni − ni ni+2 (1 − ni+1 )(1 − ni+3 ) + ni+1 ni+3 (1 − ni )(1 − ni+2 )
and
ni (r) = nout
i (r − vi )
Mass conservation
The incoming mass is
X
ρin (r, t) = nin
i (r, t)
i

the outgoing mass is


X
ρout (r, t) = nout
i (r, t)
i

It is easy to check that the HPP collision rule is such that


ρin (r, t) = ρout (r, t)
Momentum conservation

Similarly, momentum is the defined as


X
j(r, t) ≡ ρ(r, t)u(r, t) = vi ni (r, t)
i

and it is easy to show that HPP conserves it during collision


Demos and discussion

I Pressure/density wave: anisotropy


I Reversibility: exact calculation
I Spurious invariants: momentum along each line and column,
checkerboard invariant
More demos and discussion

I Sound wave propagation for FHP


I Snow transport by wind
I Diffusion, DLA, hour-glass,...
End of module
Microdynamics of LGA

End of Week 4
Thank you for your attention!

You might also like