cellular automata introduction cellular automata originally devised in the late 1940s by stan ulam...

53
Cellular Automata

Upload: jordan-neal

Post on 21-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Cellular Automata

Page 2: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 3: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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. Physics2. Material Science3. Biology4. Epidemiology5. etc

Page 4: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Cellular Automata

CA is a dynamical system in which

space and time are discrete and the

space of Cellular automata is changed

with time

Page 5: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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.

Page 6: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 7: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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.

Page 8: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

1D Cellular Automata

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

T=0

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

T=1

Page 9: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Application

1-D cellular Automata example is the Traffic

road (system)

Let us consider the cell with state 0 is empty

of car and cell with state 1 has a car

Page 10: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Traffic Road

1 1 1 1 1 1

T=0

1 1 1 1 1 1

T=1

Page 11: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Traffic road

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.

Page 12: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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.

Page 13: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 14: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Traffic Simulation

Driving, changing lanes, stopping

Page 15: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 16: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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]

}

Page 17: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Boundary conditionsthere 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

Page 18: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 19: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 20: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

2 D Cellular Automata

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

R=1 R=2Von Neuman

Page 21: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

2 D Cellular Automata

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

R=1 R=2Moore

Page 22: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

2-D Traffic System

Using 2 D cellular Automata we can construct road networks with crossing where cars can move

Page 23: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 24: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Game of life

Page 25: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Game of life

Page 26: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Game of life

Page 27: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Game of life

Page 28: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Game of life

Page 29: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Is it alive?

Page 30: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Sequences

Page 31: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Loop ReproductionLoop Reproduction

Page 32: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Loop DeathLoop Death

Page 33: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 34: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

The 2 million cell

Fish: red; sharks: yellow; empty: black

Page 35: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Initial Conditions

Initially cells contain fish, sharks or are empty

Empty cells = 0 (black pixel) Fish = 1 (red pixel) Sharks = –1 (yellow pixel)

Page 36: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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)

Page 37: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Breeding Rule: Before

EMPTY

Page 38: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Breeding Rule: After

Page 39: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 40: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 41: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Shark Random Death: Before

I Sure Hope that the random number chosen is >.031

Page 42: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Shark Random Death: After

YES IT IS!!! I LIVE

Page 43: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 0

Page 44: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 100

Page 45: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 500

Page 46: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 1,000

Page 47: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 2,000

Page 48: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 4,000

Page 49: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 8,000

Page 50: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Generation: 10,500

Page 51: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

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

Page 52: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

Reaction/Diffusion with Cellular Automata

Page 53: Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally

CA Methods in Games

SimCity 2000

The SIMS