1 / 62

Cellular Automata

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. Cellular Automata. A CA is a spatial lattice of N cells, each of which is one of k states at time t .

Olivia
Download Presentation

Cellular Automata

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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.

  2. 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 ofnatural discrete or continuous dynamical systems

  3. SIMPLE EXAMPLE Suppose 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.

  4. SIMPLE EXAMPLE continued Now 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 represent the states. In these cases; white, green and red seem the right Choices.

  5. A fairly dense forest with a couple of trees on fire -- maybe from lightning strikes

  6. SIMPLE EXAMPLE continued Next 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.

  7. 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

  8. Step 0

  9. Step 1

  10. Step 2

  11. Step 3

  12. Step 4 … and so on

  13. 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

  14. Modelling HIV infection

  15. See HIV CA demo – 4 states: Healthy, Infected1, Infected2, Dead 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

  16. Some additional things about CAs A simple 1D CA to illustrate these points: States 0 and 1: Wraparound 2D array of 30 cells Rules: 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 new state for time t+1 is worked out in parallel based on the situation at t. Start: 101001010001101000101010010001 T=1 : 110000000001110000010100000001 T=2 : 110000000001110000001000000001

  17. 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 : 101001000001101000101010010001 T=2 : 101001000001101000101010010001 T=3 : 111001000001101000101010010001 T=4 : 111001000001101000101010000001 T=5 : etc ... Clearly if there are n cells, then n timesteps in an asynchronous CA corresponds to the 1 timestep of a synchronous CA.

  18. Rules for a cell’s state transitions are usually defined in terms of the cell’s neighbourhood. E.g. this is the Moore neighbourhood: The common approach in 2D is to treat the CA surface as a Toroid This just means wraparound in the way indicated by the blue and green neighbourhoods illustrated Boundary conditions But what about cells on the edge?

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

  20. 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 Classes of cellular automata (Wolfram)

  21. 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.

  22. 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.

  23. Is it alive? • http://www.bitstorm.org/gameoflife/ • Compare it to the definitions…

  24. Glider

  25. Langton’s Loops • 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.

  26. Langton’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

  27. Langton’s Loops

  28. There remains debate and interest about the `essentials of life’ issue with CAs, but their main BIC value is as modelling techniques. We’ve seen HIV – here are some more examples. 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

  29. 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

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

  31. 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.

  32. 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

  33. 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)

  34. Rules in detail: 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)

  35. Breeding Rule: Before

  36. Breeding Rule: After

  37. 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

  38. 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

  39. Shark Random Death: Before I Sure Hope that the random number chosen is >.031

  40. Shark Random Death: After YES IT IS!!! I LIVE 

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

  42. Generation: 0 BM

  43. Generation: 100 BM

  44. Generation: 500

  45. Generation: 1,000

  46. Generation: 2,000

  47. Generation: 4,000

  48. Generation: 8,000

  49. Generation: 10,500

  50. 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’

More Related