Download Classifying CA There’s more than rule 102.

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Multi-state modeling of biomolecules wikipedia , lookup

Transcript
Classifying CA
There’s more than rule 102.
Are We Making Progress?

We’ve nailed down some of rule 102.


What about other CA.



Understand/proved its’ behavior.
How many are there?
Have we made a dent by studying rule 102?
Can we do proofs for each of the remaining CA?


Or are there enough left that they haven’t all been studied.
Can you (yes, I mean you) still make original contributions?
How Many CA’s Are there?

Consider 1-d nearest neighbors.

That’s three neighbors
 (one to the left, one to the right, plus the cell itself).

Suppose have 2 states (0 and 1). Then







000 maps to 0 or 1
001 maps to 0 or 1
010 maps to 0 or 1
011 maps to 0 or 1
Etc.
That’s 23 neighborhood configurations, each mapping to 2
possible new states.
 E.g., 01001010 or 11110000 or 01110000 or...
3
That’s 2(2 ) = 28 = 256 possible different CA rules.
How Many CA (continued)

Suppose have 3 states (0, 1, and 2). Then







000 maps to 0 or 1 or 2
001 maps to 0 or 1 or 2
002 maps to 0 or 1 or 2
010 maps to 0 or 1 or 2
011 maps to 0 or 1 or 2
012 maps to 0 or 1 or 2
Etc.

That’s 33 neighborhood configurations, each mapping to 3 possible new
states.
 E.g., 010212101111222201110000202 or
210011122001012100022012110 or...

That’s 3(3 ) = 327 = 7,625,597,484,987 possible different CA rules.
 Wow!
3
Generalizing Number of CA’s

Consider N neighbors and k states.


When k=2 and N=3, we had 23 = kN neighborhood
configurations and each could go to k = 2 new
states.
In general, there are k possible cell values
and kN neighborhood configurations, so
(kN)
there are k
possible CA’s.
Example Number of CA Rules
N)
k
N
k(k
2
3
256
2
(nearest neighbors)
5
(next-nearest neighbors)
4,294,967,296
3
3
7,625,597,484,987
4
3
~1.34 X 10154
Wholly $h!t, That’s Big!

So computer simulations with two states and
nearest neighbors is ok.

But with 3 states (or next-nearest neighbors) we
can’t even use an “int”.



Max “int” variable in Java is 231 = 2,147,483,648.
Need “long” variable for 3 states.
For 4 states, can’t even use longs!

There is no C++ or Java primitive type that can handle this.
And That Ain’t Even Big

We haven’t even tried larger numbers of states
like, 5, 6, 7, ..., 200, ...

Or larger neighborhoods

Look at square lattice with 9 neighbors (including the cell).
Look at triangular lattices with 12 neighbors!

What about in 3 or 4 dimensions – how many neighbors?

Philosophical Implication

With all those CA it is no wonder that some of
them can model real world phenomena.

The total number of atoms in the universe is roughly on the
order of 1080 (probably less).

The total number of binary nearest-neighbor two-dimensional
CA is on the order of 10154.

In other words, there are more 2-d nearest-neighbor binary
rules than there are atoms in the universe.
Personal Implication

Wanna’ make your mark in science?

Even the simplest rules have not been thoroughly explored.

So you should find a cool one.
Prove cool things about it.
Or show that it models the way some phenomenon works in
the real world.






Rivers eroding landscapes.
Bumps forming at a ski resort.
Sugar morphing into lollipops.
Gators sipping pumpkin margaritas. (Well, hey, there are a
lot of rules out there! You never know.)
Classification Implication

Ugh! We are NOT going to do proofs for
every CA.

We need a way to classify the CA into
related types.
Then we can do proofs that relate to the classes.
 Perhaps we can decide which classes relate to
physical phenomena.

Classification: Additive CA

Rule 102 was “additive”.



I promised that Rule 102 would be similar in “flavor” to many
other CA.
It is similar to other additive CA.
What makes it additive?


Linear combinations of its neighbors (mod n).
In polynomial representation (see lecture part 4 for rule 102):
d ( x)  a1 x 1  a0  a1 x
where each ai is one of the possible states (e.g., 0 or 1 for
two states).
Other Additive CA

Consider 1-d binary nearest neighbor CA.

Rule 90 is linear additive.
d ( x)  1x 1  0  1x

Rule 60 is linear additive.
1
d ( x)  0 x  1  1x
1x shifts each polynomial term
to the right.
So 1+1x adds the cell plus the
cell to the left. (The left cell was
shifted right in the polynomial.)

Your next homework will include finding all additive 1-d
binary nearest-neighbor CA. 

The proofs we did about rule 102 will be similar for these
other additive CA.
 Not the same! Just similar.
 E.g., amenable to Linear algebra.
Additive Rules 60 and 90
Rule 60
Rule 90
Look familiar? Not all additive rules look
like this. Consider rule 0.
And More Additive CA


That was just nearest-neighbor CA.
For next-nearest, consider all CA of the form
d ( x)  a2 x 2  a1 x 1  a0  a1 x  a2 x 2

And in two-dimensions, there are even more.
 For
nearest 5 neighbor (Von Neumann neighborhood)
d ( x, y )  a1,0 x 1 y 0  a0,0 x 0 y 0  a1,0 x1 y 0 
a0, 1 x 0 y 1  a0,1 x 0 y1
Lots of Additive CA

With all these linear additive CA, the
behaviors can get complicated.


What we’ll later call “class III”.
So, let’s try something even “simpler” ;-).
Classification: Totalistic CA

Definition: Totalistic CA are CA whose
rules depend only on the sum of their
neighbors (possibly including itself).

Definition: Outer Totalistic CA are CA
whose rules depend on the sum of their
neighbors (not including itself) and also
(separately) the cell itself.
Note: This distinction is not always made.
What’s Special About Totalistic?

Sums (and averages) are very common.


CA that take averages may relate to valuable real-world applications.
Image processing for example.
 Frequently want to remove the average background to highlight the
differences.

Symmetry.


There are many ways to get symmetry.
But totalistic rules are radially symmetric.
 A 1 on the left side behaves no differently from a 1 on the right side.


Physics has lots of symmetry.
This smaller subset of CA exhibits all the basic behaviors
of the entire set of CA.


Interesting. Not obvious.
More on that later.
Totalistic Rule Numbers

Consider 1-d nearest-neighbor binary CA.

There are three neighbors (including itself).
So the total can be 0, 1, 2, or 3.
Each of these sums can map to a new state, 0 or 1.

So


Neighborhood Configuration
sum
new value
000
0
0 or 1
001, 010, 100
1
0 or 1
011, 101, 110
2
0 or 1
111
3
0 or 1
Totalistic Rule Numbers
(continued)
Neighborhood Configuration
sum
new value
000
0
1
001, 010, 100
1
0
011, 101, 110
2
1
111
3
1
And similar for other neighborhoods.
1101 = 13
So this is rule 13.
Number of Totalistic Rules

Let k = number of states, N = number of
neighbors.

The maximum summation is N(k-1).


So there are N(k-1)+1 possible summation
values .


Including itself.
e.g., 0, 1, 2, and 3 when N = 3 and k = 2.
So there are kN(k-1)+1 different totalistic rules.
Number of Possible Totalistic Rules
k
N
kN(k-1)+1
2
3
16
2
2
(nearest neighbors)
5
64
(next-nearest neighbors)
9
(two-dimensional square)
1024
3
3
2187
4
3
1,048,576
Well, that’s certainly manageable!
Totalistic Example

Triangular lattice, 3 neighbors, rule 17,
single seed after 46 generations.
See the symmetry?
Totalistic Example 2

Square lattice,
next-nearest
neighbors, rule 16,
random initial
state.
These shapes move up
the screen over time!
If two collide (one moving
up and another moving down)
they produce more movers!
Try it!
Symmetry is not so obvious because
initial state was random.
Totalistic Example 3

One-dimensional lattice, 3 state, rule 912.
Note complex structure even though starts from a single seed.
Totalistic: Your Turn

Use the CA Explorer to look at totalistic
CA.
Find an interesting example.
 Share with class.

 Might want to try that rule 16 on the next-nearest
neighborhood. Look for patterns. Way cool.
Probabilistic Rules

Just another potentially useful classification of
CA.

Definition: Probabilistic CA are regular CA
where the rules change according to
probabilities.

Example: The rule may randomly switch between rule 102
and rule 60.

Example: The rule may randomly invert a value from 1 to 0
and vice-versa.
Why Bother With Probabilities?

Again, many interesting phenomena have
random or apparently random components.







Voters “randomly” change their minds.
Birds in a flock randomly change directions.
Wildflowers grow at random locations.
Snow and rain falls randomly.
Cards are randomly shuffled.
Dice roll randomly.
May not require probabilistic CA to model these.

But may be most appropriate.
Majority Wins CA

To create probabilistic CA, can take any CA and modify.

Consider a two-dimensional CA with 3 states and nearestneighbors.
 Next state is the majority state of the neighbors (including
yourself).



Example
012
becomes
012
001
011
111
111
because there are more 1’s as neighbors than any other state.
Called “Majority Wins”.

Useful as a voting model – people decide what party to vote for. 0, 1,
or 2 (e.g., republican, democrat, or green).

Their vote is swayed depending on how many of their neighbors feel a
certain way.
Now let’s modify.
Majority Probably Wins

Instead of going with the majority, suppose that
the voter decides with a probability.




If 40% of neighbors are voting republican, then you are 40%
likely to also vote republican.
If 10% of neighbors are voting green, then you are 10% likely
to also vote green.
If 50% of neighbors are voting democrat, then you are 50%
likely to also vote democrat.
So look at neighbors, and make decision based
on percent of neighbors that vote a certain way.
Example of Majority Wins

Three parties – red, blue, and green. Assume people live on a grid and
converse only with their nearest neighbors (could easily generalize).
Time 0. Random initial distribution of the parties.
Time 20. Looks like the green party is winning ;-)
Example of Majority Probably Wins
Time 0. Random initial distribution
of parties.
Time 60. Clustering is apparent, as
before. But now there is significant
(and likely realistic) variability.
Statistical Mechanics of CA

These probabilistic CA are amenable to
probability/statistical analyses.


Particularly amenable to type of math used in
statistical mechanics.



Well other CA are too, but obviously applies to probabilistic CA.
As mentioned before, cool branch of physics that deals with
large numbers of atoms.
Ah, it’s that large number thing. Lots of 0’s and 1’s in this case.
More on “stat mech” later in semester.
Probabilistic: Your Turn

Use CA Explorer to look at “Majority Wins”
and “Majority Probably Wins”.
Compare results.
 Try different % of initial random distributions.
 Try different numbers of states (political parties).


For each, is there a unique end state?

Will one party always win?
Problem: Additive / Totalistic /
Probabilistic CA Too Diverse!

Can be stupidly simple (rule 0), or beautiful
crystal-like, or capable of any computation (stay
tuned), or nearly random...

Problem: Are classifying by style of the rule
(linear additive, sum of the neighbors...).

Solution: Need to classify according to CA
behavior.
Behavioral Classification:
Reversible

Definition: A CA is reversible if and only if there
exists exactly one previous configuration for
every current configuration.

In other words, could run it forwards or backwards.
In other words, bijective!

Is Rule 102 reversible?


Give me an example.
Gardens of Eden

If a CA is not reversible, then that means there is
some configuration for which there is no
predecessor or multiple predecessors.


i.e., couldn’t run it backwards (uniquely) from that point.
Definition: Configurations with no predecessors
are called Garden of Eden States.

For rule 102, give me a whole set of states that are Gardens
of Eden.
Who Cares About Reversible?

Most of physics is reversible at a
fundamental level.

So if want to model physics, these CA might be
useful.
How Do I Find A Reversible CA?

There are many, many reversible rules.

“Second-Order CA” are a common
approach to building one.
But you can find them many ways.
 Partition technique.
 Trial and error.
 Etc.

Second-Order CA

State at time t depends on


neighbors (and itself) at previous time step t-1.
AND also depends on itself at time t-2.
t-3
t-2
t-1
t
0
0
1
0
1
0
1
1
0
0
1
1
1
0
1
NEW
VALUE
Example in one dimension. Two dimensions is similar.
Second-Order CA Rule

Now choose any invertible (bijective) rule.

Because of the “reversible” neighborhood symmetry, the
entire CA must be reversible.
t-3
t-2
t-1
t
0
0
1
0
1
0
1
1
0
0
0
1
1
1
0
1
Note the “up-down” symmetry of the neighborhood.
Second-Order Rule Symmetry

Every reversible rule has to have a
symmetrical opposite.

Visually, if a rule exists, then its upside down
version must also exist.

If
0
001
1
is a rule, then
1
001
0
is a rule.

If
1
111
0
is a rule, then
0
111
1
is a rule.
Second-Order Rules Derived From
Wolfram Rules

Consider a one-dimensional nearest-neighbor binary
rule. (i.e., just take a standard Wolfram rule.)

But now, take the new state derived from the standard
Wolfram rule and alter it by XORing with the cell’s state
at time t-2.

Recall XOR...






0 and 0 is 0
0 and 1 is 1
1 and 0 is 1
1 and 1 is 0
You can check that this will always be invertible (bijective).
Usually specify with an “R”.

Rule 102R, rule 90R, etc.
Number of Reversible Rules

XORing gives every possible binary nearest-neighbor
reversible rule.

Why?

There are 4 previous states that map to a new state.
 Why 4? See the geometry shown in the slide titled “Second-Order CA”.







Effectively that is a neighborhood of size 4.
That gives 24 possible configurations mapping to a new state of 0 or 1.
But half of the possible mappings are not symmetrical and hence not
reversible. They must be ignored.
So really just 23 configurations mapping to a new state of 0 or 1.
N
k(k ) possible CA’s with k = 2 and N = 3.
That is 256 different rules.
The XOR gives 256 different reversible rules, so that must be all of
them.
Example: Rule 102R
Rule 102
Rule 102R
Reversible Patterns

Patterns in rule 102 are triangles that do not
have top-bottom symmetry.


Not reversible.
Patterns in rule 102R are triangles that do have
top-bottom symmetry.


Reversible.
But of course (slap forehead now).

If reversible, then has to look the same forward and backwards.
Example: Rule 90R
Rule 90
Rule 90R
Note that the reversible rule doesn’t necessarily look like the original rule.
Example: Rule 91R
Rule 91
Rule 91R
At first glance, rule 91R does not look reversible.
But locally, at each cell, there is an up-down symmetry
Reversible: Your Turn

Explore!
Use CA Explorer to look at reversible CA.
 When find something cool, show class.


Can you say anything about the cycle lengths?
 Upper bound?
 Lower bound?
Need Better Behavioral
Classification

Reversible is nice. Definitely is a related behavior.


And there are other such classifications.
Maybe you can discover a useful one!

But “reversible” is such as small subset of all CA.

Can we take all CA and divide them into classifications?


Yes! There are 4 such groups.


Regardless of number of neighbors, dimensions, states, etc.
We’ll do that soon.
But first, let’s write code for your own rules!

So you can experiment with your own new ideas...