You are on page 1of 57

Cellular Automata &

Its Applications
Introduction to Automata

 Automata is the plural of automation


 Simple computing device
 Properties
 Finite set of states
 Transitions from state to state
 Sense the environment.
 Possibly change the environment.
 Go to a new state,

2
Automation Examples

Coke machine
Inputs:
 coins, bills, return
 button, choice buttons
State:
 money entered so far,…
Outputs:
 coke, sprite,
 returned coins
3
Cellular Automata

4
What is Cellular
Automata ??
 A CA is an array of identically programmed
automata or cells, which interact in one another
in neighborhood and have definite state.

 Computer simulations which emulate the laws of


nature.
 Discrete time/space logical universes.
 Complexity from simple rule set: reductionist
approach.
 Deterministic local physical model.
 Rough estimation of nature: no precision.
 This model does not reflect ‘closed sphere’ life:
can achieve same end results given rules and5
Cellular Automata
 Automata are arranged
geometrically
 All automata are identical
 All automata change state
simultaneously

6
Communication

 Inputsare states of neighbors and self


 Output is the state (indicated by color)

Rule

7
Cellular Automata
 Cellular
automata can be used to
model complex systems using simple
rules.

 Key features
divide problem space into cells
each cell can be in one of several finite
states
cells are affected by neighbors according
to rules
all cells are affected simultaneously in a
generation 8
One-Dimensional (1-D) CA
 Each cell has at most two neighbors
 All cells identical
 Cell can be initialized to different
states
 Example: 1D CA operating through
time under “Rule 90” Time T = 1
Time T = 2

9
“Rule 90” = One of 28 Elementary
1D CA

90 =( 01011010)_base 2 = 0*27+1*26+0*25+1*24+1*23+0*22+1*21+0*20

10
Rule 90

11
2-Dimensional CA
 Each cell can have two or more
neighbors.

12
Neighborhood of 2-D CA

Vonn Nuemann Moore


Neighborhood Neighborhood

13
Famous 2D CA Example:
The Game of Life
 Objective: To make a CA 'game' as
unpredictable as possible using the simplest
possible CA rule.
 2D grid of squares on a (possibly infinite) plane.
 Each square can be alive (black) or dead (white).
 Dead cells can come alive, and alive cells can die,
depending on their neighbors.
 Each cell has 8 alive or dead neighbors (pasted
edges assumed), 4 adjacent orthogonally and 4
adjacent diagonally.
 So Game of Life assumes Moore Neighborhoods.

14
The “Rules of Life”
 Ifan alive (black) cell has fewer than 2 alive
neighbors, it dies (turns white) – loneliness.

 If an alive cell has more than 3 alive


neighbors, it dies – overcrowding.

 If an alive cell has either 2 or 3 alive


neighbors, it goes on living (stays black) –
happiness.

 Ifa dead cell has exactly 3 alive neighbors, it


comes alive reproduction. Otherwise it stays
dead. 15
How the Game of Life
Proceeds
 The game proceeds in generations,
one generation per time step T

 In
the initial generation at T=1, a finite
number of cells are alive

 Ineach successive generation, some


cells come alive and some die
according to the “Rules of Life.”

16
Example

17
This is the Glider pattern. It is shown here moving on
the board as it evolves. This picture is adequate for
usage in Conway's Game of Life article, because it
follows the same graphic standard used in the pictures
there. T)

18
Applications

 Biological Systems
 Iterative Arrays – parallel computer
hardware
 Artificial Societies
 Art & Design
 Computer Graphics
 Image Processing
 Games

19
Simulation Goals using CA
 Avoid extremes: patterns that grow too
quickly (unlimited) or patterns that die
quickly

 Desirable behaviors:
 No initial patterns where unlimited growth is
obvious through simple proof
 Should discover initial patterns for which this occurs
 Simple initial patterns should grow and change
before ending by:
 fading away completely
 stabilizing the configuration
 oscillating between 2 or more stable configurations
 Behavior of population should be relatively
20
unpredictable
Cellular Automata
Formalism
 An important component of a Cellular Automaton is
its interconnection graph, G.
 This graph is, typically, an n-dimensional grid.
 But it can be other grid,.
 Or slightly irregular
 Or irregular

 Each cell of the CA can be in one of several possible


states. The state set, Q, of a Cellular Automaton is the
set of all possible states that a cell can be in.

 The pair (G, Q) is usually referred to as a Cell Space


of the CA.

21
Cellular Automata
Formalism
 A configuration, x, of a CA is a mapping from the
graph to the state set, which assigns a state from the
state set Q to each node in the graph T , i.e.

x: T Q
x(i) = q, where I € T and q € Q

 A configuration of a CA describes the overall state of


the Cellular Automaton on a global scale Cellular
Automata Formalism

22
Cellular Automata
Formalism
 The computation of CAs, though, is a local
process. The next state of each cell depends
on its current state, and the states of its
closest neighbors only.

 Thus,
we need to define the concept of a cell
neighborhood.

A neighborhood of a cell in a cellular


automaton, is the collection of cells situated
at a “distance” r or less from the cell in
question. Cellular Automata Formalism
23
Cellular Automata
Formalism
 Each cell of a CA is a simple Finite State Machine

 The local dynamics (transition function) of a cell,


denoted ∂, is a function, which receives as inputs the
state of a cell and its “neighbors”, and computes the
next state of the cell.

 For example, the local dynamics of a 1-D CA can be


defined as follows:
∂(xi-1, xi, xi+1) = xi’

 The local namics is often expressed as a table:


xi-1, xi, xi+1 000 001 010 011 100 101 110 111
∂(xi-1, xi, xi+1) 1 0 0 1 0 1 1
0 24
Cellular Automata
Formalism
 Formally, a Cellular Automaton is a
quadruple

M = (G, Q, N, d), where:

G - interconnection graph,
Q - set of states
N - neighborhood (e.g. von
Neumann, etc.)
d - local dynamics

25
Cellular Automata
Formalism: Global Dynamics
 The
local dynamics, d, of a CA describes the
computation occurring locally at each cell.

 The global computation of the CA as a


system is captured by the notion of global
dynamics. The global dynamics, T, of a CA is
a mapping from the set of configurations C
to itself, i.e.
T: C C

 Thus,the global dynamics describes how the


overall state of the CA changes from one
instance to the next, 26
Cellular Automata : Link To
Dynamical Systems
 Since the global computation is determined by the
computation of each individual cell, the global
dynamics, T, is defined in terms of the local
dynamics, d:
T(x)i := d(xi-1, xi, xi+1)

 Starting with some initial configuration, x, the Cellular


Automaton evolves in time by computing the
successive iterations of the global dynamics:
x, T(x), T 2(x)=T(T(x)), …, Tn (x), …

 Thus, we can view the evolution of a CA with time as


a computation of the forward orbit of a discrete
dynamical system. 27
Cellular Automata as
Dynamical Systems

Chaos Theory

Chaotic Behavior of
Dynamical Systems

28
Dynamical Systems
A Discrete Dynamical System is an iterated
function over some domain, i.e.
F: D D

Example 1: F(x) = x

29
Dynamical Systems
A Discrete Dynamical System is an iterated
function over some domain, i.e.
F: D D

Example 1: F(x) = x
x=0, F(0) = 0, F(F(0)) = F2(0) = 0, … ,
Fn(0) = 0 …

30
Dynamical Systems
A Discrete Dynamical System is an iterated
function over some domain, i.e.
F: D D

Example 1: F(x) = x
x=0, F(0) = 0, F(F(0)) = F2(0) = 0, … ,
Fn(0) = 0 …

x=3, F(3) = 3, F(F(3)) = F2(3) = 3, … , Fn(3)


=3…

31
Dynamical Systems
A Discrete Dynamical System is an iterated
function over some domain, i.e.
F: D D

Example 1: F(x) = x
x=0, F(0) = 0, F(F(0)) = F2(0) = 0, … ,
Fn(0) = 0 …

x=3, F(3) = 3, F(F(3)) = F2(3) = 3, … , Fn(3)


=3…

x=-5, F(-5) = -5, F(F(-5)) = F2(-5) = -5, … ,


Fn(-5) = -5 ... 32
Dynamical Systems

 Example 2: F(x) = -x

x=0, F(0) = 0, F(F(0)) = F2(0) = 0, …, Fn(0) =


0, ...

33
Dynamical Systems

 Example 2: F(x) = -x

x=0, F(0) = 0, F(F(0)) = F2(0) = 0, …, Fn(0) =


0, ...

x=3, F(3) = -3, F(F(3)) = F2(3) = 3, …, Fn(3)


= 3,
Fn+1(3) = -3, ...

34
Dynamical Systems
Boring life, push
 Example and pull regularity
2: F(x) = -x

x=0, F(0) = 0, F(F(0)) = F2(0) = 0, …, Fn(0) =


0, ...

x=3, F(3) = -3, F(F(3)) = F2(3) = 3, …, Fn(3) =


3,
Fn+1(3) = -3, ...

x=-5, F(-5) = 5, F(F(-5)) = F2(-5) = -5, …, Fn(-


5) = -5, Fn+1(-5) = 5,
35
Dynamical Systems
 A point, x, in the
domain of a dynamical Representati
system, F, is a fixed on of
abstract
point iff F(x) = x. state of a
system

 A point, x, in the
domain of a dynamical
system, F, is a periodic
point iff Fn(x) = x

 A point, x, in the
domain of a dynamical
system, F, is eventually
periodic if Fm+n(x)=Fm(x)
Life becomes more interesting
36
Dynamical Systems A point in the
state space ,
 Sometimes certain think about a
points in the domain ball in
mountain like
of some dynamical terrain
systems exhibit very
interesting properties:
 A point, x, in the
domain of F is called
an attractor iff there is A different
a neighborhood of x representation of
such that any point in state space
that neighborhood, (branching from a
under iteration of F, point now
tends to approach x possible).

 A point, x, in the
domain of F is called a
repeller iff there is a
neighborhood of x
such that any point in
that neighborhood,
under iteration of F, 37
Interesting Research
Questions
Our goals, when studying a dynamical system
are:
 To predict the long-term, asymptotic
behavior of the system given some initial
point, x,

 To identify interesting points in the domain


of the system, such as:
 attractors,
 repellers,
 periodic points,
 etc.
38
Dynamical Systems

 For some simple dynamical systems,


predicting the long-term, asymptotic
behavior is fairly simple (recall examples 1
and 2)

 For other systems, one cannot predict more


than just a few iterations into the future.
Such unpredictable systems are usually
called chaotic.
39
Chaotic Dynamics
A chaotic dynamical system has 3
distinguishing
characteristics:

 Topological Transitivity - this implies that the system


cannot be decomposed and studied piece-by-piece

 Sensitive Dependence on Initial Conditions - this


implies that numerical simulations are useless, since
small errors get magnified under iteration, and soon
the orbit we are computing looks nothing like the real
orbit of the system.

 The set of periodic points is dense in the domain of


the system - amidst unpredictability, there is an40
Cellular Automata as
Dynamical Systems

 As we saw earlier, the behavior of a Cellular


Automation in terms of iterating its global dynamics,
T, can be considered a dynamical system.

 Depending on the initial configuration and the choice


of local dynamics, d, the CA can exhibit any kind of
behavior typical for a dynamical system - fixed,
periodic, or even chaotic.

 Since CAs can accurately model numerous real-world


phenomena and systems, understanding the behavior
of Cellular Automata will lead to a better
understanding of the world around us!
41
Cellular Automata as BIST
pattern generators

42
BIST Pattern Generator

BIST : Built In Self Test

basic idea of built-in self-test


(BIST) is to generate test patterns
on-chip and also to compact the
test responses on-chip

43
Current Pattern
Generators - LFSR
 Linear Feedback Shift Register
 Chain of flip flops with feedback taps
 High auto-correlation
 Non-local feedback

44
Cellular Automata as Pattern
Generators
 Each CA cell is a flip flop with its input
based only on its local neighbors
 Regular/local design allows compact
layout
 Better pseudo-random patterns
without auto-correlation

45
Cellular Automata Cells
 Each CA cell consists of a Xc-1(t) Xc+1(t)
flip flop and an XOR gate Left
Neighbor
Right
Neighbor Xc(t)
to determine its next
state

 The XOR inputs can


potentially be from itself, Xc(t+1)
its left neighbor and/or its
right neighbor

 Which of these inputs is


present determines the
type of CA cell
46
Characterization of CA
Cells
 We characterize a CA cell by its truth table
 The binary number created becomes the
rule
 010110102 = 9010 100101102 = 15010
Xc-1(t) Xc(t) Xc+1(t)

27 26 25 24 23 22 21 20
111 110 101 100 011 010 001 000 Rule
#
Xc-1(t) Xc+1(t) 0 1 0 1 1 0 1 0 90

Xc-1(t) Xc(t) 1 0 0 1 0 1 1 0 150


Xc+1(t)

47
Characterization of CA

 We can also characterize a CA cell by


which neighbors it connects to.

 Xc-1(t) Xc+1(t) would be 101 since it


connects to the left and right neighbors
but not itself.

 We can do the same for an entire CA


using a matrix

48
Matrix Characterization of
CA
 Such a matrix is called a characteristic
matrix or CA matrix

 The CA matrix (T) is defined by:


1, if the next state of the ith
cell
T[ i, j ] = depends on the present
state of
the jth cell

0, otherwise
49
Example CA Matrix
4 Cell CA 1 1 1 0

1 1 0 0
T = 11 11 11 00
0 1 0 1
0 0 1 1

50
State Transitions Using
CA Matrix
 If the current state of the CA is
ft(x), ft+1(x) = T·ft(x):
 Addition operator is XOR
T ft(x) ft+1(x)
1 1 0 0 11 0
1 1 1 0 11 0
=
00
0 1 0 1 1
0
0 0 1 1 0 0

0(1) 1(1) 0(0) 1(0) = 1


Jeffrey Dwoskin - Cellular Automata as
4/19/2002 BIST pattern generators 51
Characteristic Polynomial
 We can find the characteristic polynomial
of a CA by constructing the matrix T + xI
and computing its determinant:

T T+xI
1 1 0 0 1+x 1 0 0
1 1 1 0 1 1+x 1 0
0 1 0 1 0 1 x 1
0 0 1 1 0 0 1 1+x

P(x) = det(T + xI) = 1 +x3 +x4

52
Group CA
 Ifthe CA characterized by T forms a cyclic
group, then:
Tm = I (identity matrix)

 Where m is the order/length of the cycle

 Such a CA where this holds is called a Group


CA

 We also find that for a Group CA:


det T = 1

53
Maximum Length Group
CA
A Group CA can be classified as
maximum-length by the presence of a
cycle of length 2n-1 with all non-zero
states

 Additionally,the characteristic polynomial


will be primitive – i.e. the polynomial has
no factors

54
Non-Maximum Length Group
CA
 Multiple cycles

 Non-primitive characteristic polynomial

 If the order (m) of the group CA is non-prime,


then the lengths of the cycles are the factors
of m

55
References
 http://en.wikipedia.org/wiki/Cellular_automata

 http://en.wikipedia.org/wiki/Conway%27s_Game_of_Lif
e

 http://www.cs.washington.edu/homes/ladner/ca/info/M
athday_presentation.pdf

 http://www.econ.iastate.edu/classes/econ308
/tesfatsion/CellularAutomataIntro.LT.pdf

56
Thank You !!!!

57