cellular automata biologically inspired computing various credits for these slides, which have in...

63
Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod Hunt, Marek Kopicki.

Upload: ashlynn-lloyd

Post on 19-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Cellular Automata

Biologically Inspired Computing

Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod Hunt, Marek Kopicki.

Page 2: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Cellular Automata

A 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. Hence, k and r are the parameters of the CA.

•CAs are often described as discrete dynamical systems with the capability to model various kinds of natural discrete or continuous dynamical systems

Page 3: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

SIMPLE EXAMPLESuppose we are interested in understanding how a forest fire spreads. We can do this with a CA as follows.

Start by defining a 2D grid of `cells’, e.g.:

This will be a spatial representation of our forest.

Page 4: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

SIMPLE EXAMPLE continuedNow we define a suitable set of states. In this case, it makes sense for a cell to be either empty, ok_tree, or fire_tree – meaning: empty: no tree here ok_tree: there is a tree here, and it’s healthy fire_tree: there is a tree here, and it’s on fire.

When we visualise the CA, we will use colours to representthe states. In these cases; white, green and red seem the rightChoices.

Page 5: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

A fairly dense forest with a couple of treeson fire -- maybe from lightning strikes

Page 6: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

SIMPLE EXAMPLE continuedNext we define the neighbourhood structure – when we run our CA, cells will change their state under the influence of their neighbours, so we have to define what counts as a “neighbour”. You’ll see example neighbourhoods in a later slide, but usually you just use a cell’s 8 immediately surrounding neighbours. Let’s do that in this case.

Next we decide what the neighbourhood will be like at the boundaries of the grid.

Page 7: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

CA Rules

Now, the main thing: how do we update the states at the next time step? We use sensible rules.

E.g. • If a tree is not on fire, and has n neighbours on

fire, it catches fire next step with probabilty n/8.• If a tree has been on fire for 3 steps, it dies

Page 8: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Step 0

Page 9: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Step 1

Page 10: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Step 2

Page 11: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Step 3

Page 12: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Step 4 … and so on

Page 13: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod
Page 14: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

CA Rules:

• A small number of sensible rules, for any given suitable application, usually leads to convincing behaviour.

• Every CA rule says: A cell in state X changes to a cell of state Y if certain

neighbourhood conditions are satisfied• What about the “tree on fire dies after three steps rule?”

This can be easily modelled with “pure” CA rules. How?• CAs are increasingly used to simulate a wide number of

complex systems, to see “what would happen if…”, and generally investigate the effects of various strategies

Page 15: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Modelling HIV infection

Page 16: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

demo coming soon

Rule 1 - If an H cell has at least one I1 neighbour, or if has at least 2 I2 neighbours, then it becomes I1. Otherwise, it stays healthy.

 Rule 2 – An I1 cell becomes I2 after 4 time steps (simulated weeks). (to

operate this the CA maintains a counter associated with each I1 cell). Rule 3 - An I2 cell becomes D. Rule 4 – A D cell becomes H, with probability ;

I1, with probability ; otherwise, it remains D

)1( Infecrepl pp Infecrepl pp

4 states: Healthy, Infected1, Infected2, Dead

Page 17: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Some additional things about CAsA simple 1D CA to illustrate these points:

States 0 and 1: Wraparound 1D array of 30 cellsRules: if both neighbours are 1, become 1; if both neighbours are 0, become 0; otherwise, stay the same.

Synchronous update: most CAs operate this way. Each cell’s newstate for time t+1 is worked out in parallel based on the situation at t.

Start: 101001010001101000101010010001

T=1 : 110000000001110000010100000001

T=2 : 110000000001110000001000000001

Page 18: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Some additional things about CAs

Asynchronous update: Sometimes applied in preference – it is arguably a more valid way to simulate some systems. Here, at each time step, one cell is chosen at random and updated.

Start: 101001010001101000101010010001

T=1 : 101001000001101000101010010001T=2 : 101001000001101000101010010001

Clearly if there are n cells, then n timesteps in an asynchronous CAcorresponds to the 1 timestep of a synchronous CA.

T=3 : 111001000001101000101010010001T=4 : 111001000001101000101010000001T=5 : etc ...

Page 19: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Boundary conditions

Rules for a cell’s state transitions are usually defined in terms ofthe cell’s neighbourhood. E.g. this is the Moore neighbourhood:

But what about cells on the edge?

The common approach in 2D is to treat the CA surface as a Toroid

This just means wraparound inthe way indicated by theblue and green neighbourhoods illustrated

Page 20: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Types of neighbourhood

Many more neighbourhood techniques exist - see http://cell-auto.com and follow the link to ‘neighbourhood survey’

Page 21: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

More about 1D 2-state CAs

Assuming Moore neighbourhood: there are 8 possible rules:

current pattern

111 110 101 100 011 010 001 000

new state for

center cell

0 0 0 1 1 1 1 0

This is “rule 30” – why?

Page 22: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Rule 30 produces patterns like this

Page 23: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod
Page 24: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

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) – probably equivalent to a regular grammar/finite state automaton

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 25: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

John Conway’s Game of Life

• 2D cellular automata system.

• Each cell has 8 neighbors - 4 adjacent orthogonally, 4 adjacent diagonally. This is called the Moore Neighborhood.

Page 26: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Simple rules, executed at each time step:

– A live cell with 2 or 3 live neighbors survives to the next round.

– A live cell with 4 or more neighbors dies of overpopulation.

– A live cell with 1 or 0 neighbors dies of isolation.

– An empty cell with exactly 3 neighbors becomes a live cell in the next round.

Page 27: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Is it alive?

• http://www.bitstorm.org/gameoflife/

• Compare it to the definitions…

Page 28: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Glider

Page 29: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

• CA are a main part of the research area “Artificial Life”. A common definition of “life” involves that the living organism(s) must be capable of self-reproduction. Langton’s “Loops” achieve that.

• Characteristics – 8 states, 2D Cellular automata– Needed CA grid of 100 cells – Self Reproduction into identical copy

• A simple set of rules produces self-reproducing “organism” – a deep connection between Life and Computation.

Langton’s Loops

Page 30: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Langton’s LoopLangton’s Loop

0 – Background cell state 3, 5, 6 – Phases of reproduction

1 – Core cell state 4 – Turning arm left by 90 degrees

2 – Sheath cell state state

7 – Arm extending forward cell state

Page 31: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Langton’s Loops

Page 32: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

There remains debate and interest about the `essentials of life’ issue with CAs, but their main BIC value is as modelling techniques.

Modelling Sharks and Fish:

Predator/Prey Relationships

Bill Madden, Nancy Ricca and Jonathan Rizzo

Graduate Students, Computer Science Department

Research Project using Department’s 20-CPU Cluster

We’ve seen HIV – here are some more examples.

Page 33: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

• This project modeled a predator/prey relationship• Begins with a randomly distributed population of

fish, sharks, and empty cells in a 1000x2000 cell grid (2 million cells)

• Initially,– 50% of the cells are occupied by fish

– 25% are occupied by sharks

– 25% are empty

Page 34: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Here’s the number 2 million• Fish: red; sharks: yellow; empty: black

Page 35: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Rules

A dozen or so rules describe life in each cell:• birth, longevity and death of a fish or shark• breeding of fish and sharks• over- and under-population• fish/shark interaction• Important: what happens in each cell is

determined only by rules that apply locally, yet which often yield long-term large-scale patterns.

Page 36: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Do a LOT of computation!

• Apply a dozen rules to each cell

• Do this for 2 million cells in the grid

• Do this for 20,000 generations

• Well over a trillion calculations per run!

• Do this as quickly as you can

Page 37: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Rules in detail: Initial Conditions

Initially cells contain fish, sharks or are empty• Empty cells = 0 (black pixel)

• Fish = 1 (red pixel)

• Sharks = –1 (yellow pixel)

Page 38: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Breeding Rule: Before

EMPTY

Page 39: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Breeding Rule: After

Page 40: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Rules in Detail: 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 41: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Rules in Detail: 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 42: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Results

• Next several screens show behavior over a span of 10,000+ generations

Page 43: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Spring 2005 BM 43

Generation: 0

Page 44: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Spring 2005 BM 44

Generation: 100

Page 45: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 500

Page 46: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 1,000

Page 47: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 2,000

Page 48: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 4,000

Page 49: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 8,000

Page 50: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Generation: 10,500

Page 51: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Long-term trends

• Borders tended to ‘harden’ along vertical, horizontal and diagonal lines

• Borders of empty cells form between like species

• Clumps of fish tend to coalesce and form convex shapes or ‘communities’

Page 52: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

What can be discovered by simulating very small populations

• Fish can live in stable isolated communities as small as 20-30

• A community of less than 200 sharks tends not to be viable

Page 53: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Forest Fire Model (FFM)

During each time step the system is updated according to the rules:

Forest Fire Model is a stochastic 3-state cellular automaton defined on a d-dimensional lattice with Ld sites.

Each site is occupied by a tree, a burning tree, or is empty.

1. empty site tree with the growth rate probability p 2. tree burning tree with the lightning rate probability f, if no nearest

neighbour is burning 3. tree burning tree with the probability 1-g, if at least one nearest neighbour

is burning, where g defines immunity. 4. burning tree empty site

Page 54: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

The application

Page 55: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Eventually

After some time forest reaches the steady state in which the mean number of growing trees equals the mean number of burning trees.

Page 56: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Modelling brain tumour growthKansal et al, 2000, Journal of Theoretical Biology

Incidence of primary malignant brain tumours is 8/100,000 p.a. 3D CA, modelling brain tumour growth

Shows that Macroscopic tumour behaviour can be predicted via microscopic parameters

Uses only 4 parameters

Makes predictions that match the biological reality

Page 57: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

MRI scan showing a tumour; the white areaRepresents blood leakagearound the tumour

Page 58: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Kansal et al use the Delaunay Tesselation as their lattice – on the rightwe see blackened cells representing the tumour, in a simplified 2D version

Page 59: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

States and Rules

Not easy to glean from the paper, but: cells are either healthy (empty lattice site) or tumour.

Tumour cells are either proliferative (they divide into additional tumour cells) or not. When a proliferative tumour cell wants to divide, it fills a healthy space with a new tumour cell if it can find one within delta_p of its position. If it can’t find one, it becomes non-proliferative.

Page 60: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

1.5M lattice sitesInitial tumour is 1000 proliferative cells at centre of lattice

Result seems realistic

Page 61: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Very good fit to real data;The lines are the CA model predictions of tumour radius andvolume against timeThe plotted points are measurements from real cases of untreated tumours

Page 62: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Read about various applications for yourself.

See the www site for the:

Influenza CA paper Tumour CA paper A Traffic Simulation CA paper Historic urban growth in the San Francisco bay area CA

Not examinable reading, but recommended

Page 63: Cellular Automata Biologically Inspired Computing Various credits for these slides, which have in part been adapted from slides by: Ajit Narayanan, Rod

Next week

‘revision’ lecture

• I’ll go quickly over the examinable material from my lectures (not Patricia’s)

• I’ll be here to answer (reasonable) questions about the exam