# CA Cellular Automata Introduction  Cellular Automata originally

Document Sample

```					Cellular Automata
Introduction

   Cellular Automata originally devised in the
late 1940s by Stan Ulam (a mathematician)
and John von Neumann.
   Originally devised as a method of
representing a stylized universe, with rules
(e.g. laws of thermodynamics) acting over
the entire universe.
   Have subsequently been used for a wide
variety of purposes in simulating systems
from chemistry and physics
   CAs have started to be used in
bioinformatics
Some Facts

    Cellular Automata but … one Automaton !!
    Cellular Automata can be defined in multiple
dimensions: one, two, three… or more

    Cellular Automata have applications in many
scientific domains:
1. Physics
2. Material Science
3. Biology
4. Epidemiology
5. etc
Cellular Automata
   CA is a dynamical system in which
space and time are discrete and the
space of Cellular automata is changed
with time
Cellular Automata

CA is a spatial lattice of N cells, each of which is
one of k states at time t.
•Each cell follows the same simple rule for updating
its state.
•The cell's state s at time t+1 depends on its own
state and the states of some number of neighbouring
cells at t.
• For one-dimensional CAs, the neighbourhood of a
cell consists of the cell itself and r neighbours on
either side.
Cellular Automata
   An automaton consists of a
grid/lattice of cells each of which
can be in a number of states
   The figure shows a 5x5
automaton where each cell can
be in a filled or empty state.

Cell
State = empty/off/0
State = filled/on/1
1-D Cellular Automata

It is a string of cells (one dimensional array of

cells). Each cell in one state of State Set and

change its state with time depend on the

neighbor cells.
1D Cellular Automata
T=0

0 0 1 0 1 0 1 0              1 0 0 1

T=1

1    0   1   1   1   1   0   0   0   1   1   0
Application
   1-D cellular Automata example is the Traffic

   Let us consider the cell with state 0 is empty

of car and cell with state 1 has a car
T=0

1   1   1       1       1       1

T=1

1        1   1   1       1       1
   The idea is to consider a set of adjacent

cells representing a street along which a car

can move.

   The car jumps to its nearest neighbor cell

unless this cell is already occupied by

another car.
Traffic System

The rule of motion can be expressed by

X (t+1) = Xin (t) (1-X(t)) + Xout(t) X(t)

X is the cell, Xin is the cell from which the car

come, Xout the destination cell.
Traffic Simulation

 Decelerate, if tailing distance to the
next car is less than strength of
pheromone suggests
 Accelerate, if there is no pheromone
or tailing distance is greater than
suggested by pheromone strength
Traffic Simulation

   Driving, changing lanes, stopping
State Set

Each cell of the cellular automata is a

finite automaton and then it has a

state, the set of all possible states is

called state set
State Transition Rules
   The states of an automaton change over time
in discrete timesteps
   The state of each cell is modified in parallel at
each timestep according to the state transition
rules
   These determine the new states of each of the
cells in the next timestep from the states of
that cells neighbours
For (int i=0 to CellCount)
{
Cell[i].State[t+1] =
STR(Cell[i].Neighbour.State[t]
}
Boundary conditions
there are two kinds of boundaries; periodic
and fixed value boundaries.

1. Periodic boundary is obtained by periodically
extending the array or lattice

2. Fixed value boundary is obtained by simply
prescribing a fixed value for the cells on the
boundary

0   0    1   0    1    0   1    0   1    0    0   1
Neighborhood size
The set of cells that neighbor a given cell X

in traffic example, the neighborhood size is 3 ( cell before and

cell after plus the cell X itself)

1     0    1
2-D Cellular Automata

   Is an array nxn of cells. Each cell has
a different state from state set.

1   0   1   0   1
1   1   0   1   1
1   0   1   1   0
0   1   1   1   0
0   1   0   0   1
2 D Cellular Automata

   The neighborhood size of 2D cellular
Automata is 2 types: Von Neuman and
Moore

R=1       Von Neuman        R=2
2 D Cellular Automata

   The neighborhood size of 2D cellular
Automata is 2 types: Von Neuman and
Moore

R=1          Moore          R=2
2-D Traffic System

   Using 2 D cellular Automata we can
where cars can move
Game of life

 Consider 2D cellular automata with
neighbors size 8 and states 0 and 1
 The transition rule is:
– If cell has 3 of its neighbors live, then it
live next time
– Live cell and has 2 neighbors live, it will
be live next time
– Otherwise, it will die next time step
Game of life
Game of life
Game of life
Game of life
Game of life
Is it alive?
Sequences
Loop Reproduction
Loop Death
Classes of cellular automata (Wolfram)

Class 1: after a finite number of time steps, the CA tends to
achieve a unique state from nearly all possible starting
conditions (limit points)
Class 2: the CA creates patterns that repeat periodically or
are stable (limit cycles)
Class 3: from nearly all starting conditions, the CA leads to
aperiodic-chaotic patterns, where the statistical properties of
these patterns are almost identical (after a sufficient period
of time) to the starting patterns (self-similar fractal curves) –
computes ‘irregular problems’
Class 4: after a finite number of steps, the CA usually dies,
but there are a few stable (periodic) patterns possible (e.g.
Game of Life) - Class 4 CA are believed to be capable of
universal computation
The 2 million cell
   Fish: red; sharks: yellow; empty: black
Initial Conditions

Initially cells contain fish, sharks or are
empty
   Empty cells = 0 (black pixel)
   Fish = 1 (red pixel)
   Sharks = –1 (yellow pixel)
Breeding Rule

Breeding rule: if the current cell is empty
 If there are >= 4 neighbors of one species,
and >= 3 of them are of breeding age,
• Fish breeding age >= 2,
• Shark breeding age >=3,
and there are <4 of the other species:
then create a species of that type
• +1= baby fish (age = 1 at birth)
• -1 = baby shark (age = |-1| at birth)
Breeding Rule: Before

EMPTY
Breeding Rule: After
Fish Rules

If the current cell contains a fish:
 Fish live for 10 generations

 If >=5 neighbors are sharks, fish dies
(shark food)
 If all 8 neighbors are fish, fish dies
(overpopulation)
 If a fish does not die, increment age
Shark Rules

If the current cell contains a shark:
 Sharks live for 20 generations

 If >=6 neighbors are sharks and fish
neighbors =0, the shark dies
(starvation)
 A shark has a 1/32 (.031) chance of
dying due to random causes
 If a shark does not die, increment age
Shark Random Death:
Before
I Sure Hope that the
random number
chosen is >.031
Shark Random Death:
After
YES IT IS!!!
I LIVE 
Generation: 0
Generation: 100
Generation: 500
Generation: 1,000
Generation: 2,000
Generation: 4,000
Generation: 8,000
Generation: 10,500
Application Guidelines

   To apply a cellular automaton to a problem:
– A representation of a cell must be determined
– Cell states must be defined
– A grid of cells must be constructed
– A set of rules must be created to modify states
– A neighbourhood should be defined
Reaction/Diffusion with
Cellular Automata
CA Methods in Games

SimCity 2000

The SIMS

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 12 posted: 3/17/2012 language: pages: 53
Description: machine learning lecture