Agent-Based Simulation: Cellular Automata
Agent-Based Simulation: Cellular Automata
Agent-Based Simulation
Cellular Automata
1 / 35
Agent-Based Simulation
Outline
2 / 35
Outline
3 / 35
4 / 35
5 / 35
6 / 35
6 / 35
survival: 2 or 3 birth: 2 or 3 colors: only rst state gives birth, others decay in color until they die
7 / 35
Assume an innite, 2-dimensional grid Assuming 2-state cells, we have for each cell 29 = 512 possible patterns Since we can only represent a nite grid, the cells on the borders are subject to periodic boundary conditions
cell coordinates are mod(N ) (wrap around both vertically and horizontally)
8 / 35
Properties of CA
Parallelism: individual cell updates are performed independently of each other all of the updates being done at once Locality: when a cell is updated, its new value is based solely on the values of its neighbors (and on the cells history in n-order CA) Homogeneity: each cell is updated according to the same rules CA are good models for physical, biological and sociological phenomena: each person/cell/small region of space updates itself independently (parallelism), based on its immediate surroundings (locality) and on some generally shared laws of change (homogeneity)
9 / 35
Properties of CA
Parallelism: individual cell updates are performed independently of each other all of the updates being done at once Locality: when a cell is updated, its new value is based solely on the values of its neighbors (and on the cells history in n-order CA) Homogeneity: each cell is updated according to the same rules CA are good models for physical, biological and sociological phenomena: each person/cell/small region of space updates itself independently (parallelism), based on its immediate surroundings (locality) and on some generally shared laws of change (homogeneity)
9 / 35
Outline
10 / 35
Due to John Horton Conway, british mathematician This is interesting for two reasons. . .
11 / 35
12 / 35
Conway simplied von Neumanns method into the GoL The GoL has the power of a universal Turing machine, i.e., anything that can be computed algorithmically can be computed within Conways GoL
13 / 35
Conway simplied von Neumanns method into the GoL The GoL has the power of a universal Turing machine, i.e., anything that can be computed algorithmically can be computed within Conways GoL
13 / 35
takes 5206 generations to generate at least 25 gliders and stabilise as many oscillators
14 / 35
Even simpler CA
The simplest CA are one-dimensional, with two states per cell Neghborhood = two adjacent cells on either side 23 = 8 possibile patterns for a neighborhood 28 = 256 possible rules (256 possible CA) Each possible CA is identied in Wolfram notation as the decimal number which, in binary, gives the rule table
current pattern new state of middle cell 111 0 110 0 101 0 100 1 011 1 010 1 001 1 000 0
15 / 35
Rule 30 (00011110)
Seed = one cell on
Generates apparent randomness, passes many random tests. . . . . . but there exist an innite number of input patterns that result in repeating patterns (e.g., 00001000111000, discovered by Matthew Cook)
Federico Pecora Agent-Based Simulation Part 2 16 / 35
Generations
Very simple structure, but difcult to obtain desired behaviors Of the 256 simple" CA, Rule 110 is the only one known to be Turing complete
Generations
Federico Pecora Agent-Based Simulation Part 2
17 / 35
This has been used to suggest that many of the properties of many natural systems (e.g., patterns on some seashells) are undecidable
Federico Pecora Agent-Based Simulation Part 2 18 / 35
Outline
19 / 35
Reversible CA
A CA is reversible if its update function is bijective
the current conguration is obtainable by exactly one previous conguration
an irreversible CA is one for which there exist patterns for which there are no previous states these patterns are called Garden of Eden patterns
20 / 35
Reversible CA
Any one-dimensional CA can be proved to be either reversible or irreversible For n-dimensional CA (n 2), reversability is undecidable i.e., there exist n-dimensional rules for which the complexity of
describing its inverse vastly exceeds the complexity of the rule itself i.e., the only way of proving it is to simulate!
21 / 35
Reversible CA
Wait a minute. . . doesnt the opposite rule give the inverse CA?
111 0 111 1 110 0 110 1 101 0 101 1 100 1 100 0 011 1 011 0 010 1 010 0 001 1 001 0 000 0 000 1
Rule 30
Rule 225
22 / 35
Reversible CA
Wait a minute. . . doesnt the opposite rule give the inverse CA?
22 / 35
Rule 30
111 0
110 0
101 0
100 1
011 1
010 1
001 1
000 0
Rule 30R
1 111 1 0 111 0 1 110 1 0 110 0 1 101 1 0 101 0 1 100 0 0 100 1 1 011 0 0 011 1 1 010 0 0 010 1 1 001 0 0 001 1 1 000 1 0 000 0
(t 1) t (t + 1) (t 1) t (t + 1)
23 / 35
Rule 30
111 0
110 0
101 0
100 1
011 1
010 1
001 1
000 0
Rule 30R
1 111 1 0 111 0 1 110 1 0 110 0 1 101 1 0 101 0 1 100 0 0 100 1 1 011 0 0 011 1 1 010 0 0 010 1 1 001 0 0 001 1 1 000 1 0 000 0
(t 1) t (t + 1) (t 1) t (t + 1)
23 / 35
Rule 30R
24 / 35
Totalistic CA
The state of each cell is represented by a number State at time t depends only on the sum of the values of the cells in its neighborhood at time t 1
outer totalistic CA: neighborhood does not contain the cell itself totalistic CA: neighborhood does contains the cell itself
25 / 35
Outline
26 / 35
CA-based encryption
Low speed of encryption and/or decryption causes big problems for practical implementations CA are inherently parallel
easy to implement on distributed processing platforms
27 / 35
Clear text
Stream cipher: a symmetric key cipher where plain text is combined with PRNG bitstream Wolframs Rule 30 does not repeat for any short period and has no obvious structure The central column of Rule 30 has been subject to many randomness tests, and has passed every one so far Cryptotext: combination (e.g., XOR) of clear stream with a column from Rule 30
XOR
Rule 30 column
It is undecidable if a 2D CA is invertible it can be very difcult to invert a 2D CA Use the message to encrypt as initial conguration for a reversible CA A Cryptotext: conguration of A at generation n (n xed or depending on size of message) Keys: A is public key, A 1 is private key
it seems possible to obtain such difcult to invert CA by combining several simply invertible CA
29 / 35
Reversible CA can be employed to simulate gasses Homogeneity: every molecule follows one rule Locality: each molecule affects its neighbors only, not others far away from it Reversibility: all information the motion of molecules is backward traceable In gasses, heat entails the motion of molecules As in CA, the randomness (entropy) of the system increases . . . gasses look like reversible CA!
30 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
31 / 35
32 / 35
CA simulation of epidemics
Cells have 3 states: susceptible, infected, immune A susceptible cell with neighboring infected cell
becomes infected with probability
SIR Epidemic model
p
becomes immune with probability
33 / 35
CA simulation of epidemics
Cells have 3 states: susceptible, infected, immune A susceptible cell with neighboring infected cell
becomes infected with probability
SIR Epidemic model
p
becomes immune with probability
33 / 35
CA simulation of trafc ow
Dynamics of vehicles represented in coarse-grained way Space and time are discretized One dimensional toroid grid Emergence of stop-and-go behavior from injection of simple non-determinism
slowdown probability slow-to-start rules
Nagel-Schreckenberg model
34 / 35
Cellular Automata
Thank you!
35 / 35
References
35 / 35