Evolutionary Algorithm

3 downloads 0 Views 7MB Size Report
algorithms) to find gliders and glider guns, that can be used to implement ... chance that the gliders are emitted by a gun). .... New used pattern : big gun. C. C. C.
On discovering gliders and glider guns with evolutionary algorithms to find computationally universal CAs Emmanuel Sapin, Jean-Jacques Chabrier, Olivier Bailleux, Larry Bull, Pierre Collet and Andy Adamatzky University of the West of England, Artificial Intelligence Group and Unconventional Computing Group 1

Introduction and Definitions Our goal: Find other universal 2 states 2D cellular automata than the Game of Life

Our rationale: Use stochastic search algorithms (evolutionary algorithms) to find gliders and glider guns, that can be used to implement logic gates. 2 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Introduction and Definitions Life is computationally universal

The Game of Life: -gliders, glider guns and eaters -An AND gate simulated by Life on the next slide

3 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Introduction and Definitions Simulation of an AND Gate : Output stream (0101)

Glider gun

C1 Input stream A (1101)

C2

C2

Eater Collisions Input stream B (0111) 4 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Finding universal CAs Set of automata

y

No 2

Evolutionary Algorithm No 1

Subset of automata accepting gliders

Evolutionary Algorithm No

Generalization to 3 state automata

Subset of automata accepting guns

…..

Subset of automata simulating an AND Gate

Universality Universality of of an a automaton automaton Generalization to Highlife 5 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Evolutionary Algorithm n°1

-The algorithm tries to maximize the number of gliders and the number of periodic patterns that appear after the evolution of a random configuration of cells.

6 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Results : This algorithm provided several automata accepting gliders Gliders with cardinal direction:

Gliders with diagonal direction:

Gliders with special angle:

7

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Finding logic-universal CAs Set of automata

y

n°2

Evolutionary Algorithm No 1

Subset of automata accepting gliders

Evolutionary

Algorithm n°

generalisation to 3 state automata

Subset of automata accepting guns

…..

Subset of automata simulating an AND Gate

Universality Universality of of an a automaton automaton Generalization to Highlife 8 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Evolutionary Algorithm n°2 -This evolutionary algorithm searches for guns emitting a specific glider.

-The fitness function tries to maximize the number of emitted gliders while minimizing the total number of cells (so as to maximize the chance that the gliders are emitted by a gun).

9 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Results - With this algorithm, for 50 different gliders we found 26 guns and over 25000 various guns were found for the following glider: Generation 0 Generation 1 Generation 2

- Among the found guns, one looks for guns with a long period (so that the streams are usable for logic gates emulation). 10 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Periods of the found guns Number of guns

10000

Three other guns of period 62, 74 and 243 are not shown on the graphic.

2703

2557 1679 942

911

812

1000

838

133 79

100

45

42

50

43

38

28

28

25 17 11

10

3

0

0

1

0

21 22

23 24

25

0

0

0

1

0

0

0

0

0

1

0

0

1

0

0

0

31 32

33

34

35

36

37

38 39

40

41 42 43

44

45 11

0

0

1

46 47

48

1

6

7

8

9

10

11 12

13

14

15 16

17

18

19 20

26

27 28

29

30

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Distribution of the number of guns emitting n gliders during a period 100000

11040 10000 3348

Number of guns

859 1000

64

100 28

21 10

2 0

0

1

1 1

2

3

4

5

6

7

8

9

10

11

12

13

14

12 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Discovered Guns Emitting one glider After a Period

Emitting four gliders

Emitting eight gliders

After a Period

After a Period

Emitting two gliders Emitting twelve gliders

After a Period

Emitting six gliders Emitting three gliders

After a Period

After a Period

After a Period

13 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Synthesis

- It is possible to discover new automata supporting gliders, periodic patterns, and glider guns with evolutionary algorithms .

14 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Finding logic-universal CAs Set of automata

y

n°2

Evolutionary Algorithm No 1

Subset of automata accepting gliders

Evolutionary

Algorithm n°

generalisation to 3 state automata

Subset of automata accepting guns

…..

Subset of automata simulating an AND Gate

Universality Universality of of an a automaton automaton Generalization to Highlife 15 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Universality of an automaton accepting gliders and glider guns

Among all the found automata, we chose the one showed below (that we called R):

Glider Glider gun

16 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

In order to show the universality of R, we chose to simulate the Game of Life with R.

The first step is to simulate a cell of Life: Sn+1= N2 . N1 . (Sn + N0). -> AND Gate and Not Gate

Once a cell is created, one needs to tile a surface with interconnected Life cells. 17 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

R automaton Glider

:

Eater found by evolutionary algortihm:

-Glider gun :

Glider gun:

Glider gun:

18 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Duplication and redirection Glider guns can be used to duplicate or redirect a glider stream (note that streams are complemented by the duplication and redirection operators): Stream Duplication

Redirection

19 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Creation of a NOT gate using duplication and redirection C

Used scheme:

C

C C

C

C

C

C

New used pattern : big gun

20 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Stream a: 10 Glider gun

NOT Gate :

Stream way

Not(a)

a

Not(a)

Not(a)

Eater

a Not(a) Not(a)

Glider gun 21 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Glider gun

Stream Not(a)

a

Not(a)

a

Not(a)

Not(a)

Eater

Not(a)

Glider gun

Stream not(a): 01

22

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Simulation of a Life cell : The first eight input streams are the streams of the eight adjacent cells numbered from C C C1 to C8. 7

8

C6

C5 C4 C3 C2

C1 Sn

Output

Sn+1

This simulation uses 33412 cells and produces the stream Sn+1 after 21600 generations. 23 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Once a cell is created, one needs to tile a surface with interconnected Life cells.

24 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Interconnexion of simulation of cells Problem: interconnect the nine cells

Simulation of cell 1

Simulation of cell 2

S C1

Simulation of cell 4

S C4 C6 S

Simulation of cell 6

C2 S Simulation of cell S

Simulation of cell 3

S C3 C5 Simulation of cell 5 S C8

S C7 S Simulation of cell 7

Simulation of cell 8

It is straightforward for a cell to send its state to its cardinal neighbors C2, C4, C5, C7. Sending its state to neighbors C1, C3, C6, C8 is however 25 more tricky, since they are situated diagonally. Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

All cells being identical, the inputs of a cell must physically correspond to the outputs of its neighbours. Therefore, the way a cell receives the state of its neighbours can be induced from the way it sends its own state to its neighbours. 1 2 3

4

6

C1 C2 C3 C4 C5 C6 C7 C8

Simulation of a cell of S the Game of Life

7

5

8

26 : Stream Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group Duplication

1

4

6

2

C1 C2 C3 C4 C5 C6 C7 C8

Simulation of a cell of S the Game of Life

7

3

5

8 : Stream Duplication

27

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

C7

1

2 S

S

C2

C1 C2 C3 C4 C5 C6 C7 C8 S

S

4

C2 S

Simulation of a cell of S the Game of Life

C7

5

S

S

6

3

7

C7

8 : Stream Duplication

28

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

1

2 C2

3

C2

C2 C1

C2

C3 C2 C1 C4 C6 C7 C5 C8 S

C4

4

C3 C2

Simulation of a cell of S the Game of Life

C5

5

C7

C8

C6 C7

6

C7

C7

7

C7

8

: Stream Duplication

29

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

of Life

of Life

C

C

C5

C C2

C

C2

C2

C3 C2 C1 C4

C4

C

C3

C2

C2

C1 C1

Simulation of a cell of S the Game of Life

C5

C

C4 C1

of Life

C6 C7

C5

C3

C3 C2

Simulation of a cell of S the Game of Life

Simulation of a cell of the Game of Life

C5

C8

S C7

C7

C8

C8

C6 C6

C6 C4

C7 C

C

C7

C7

C7 C

C5

C

C5

C8 C5

C4

30

Simulation

Simulation Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and UnconventionalSimulation Computing Group

Conclusion - Life was shown to be computational universal by Conway et al. in 1982 and by Rendell in 2002. - R can implement a tilling of interconnected Life cells (= R can implement Life) - R is therefore also universal - A set of two genetic algorithms has allowed to find another computational universal CA than Life. Question: How many 2D two states CAs are universal ? 31 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 1: Definitions Turing Machine : A MODEL OF COMPUTATION that uses an underlying FINITESTATE AUTOMATON but also has a infinite tape to use as memory. Turing machines are capable of UNIVERSAL COMPUTATION.

Universal Computer: A computer that is capable of UNIVERSAL COMPUTATION, which means that given a description of any other computer or PROGRAM and some data, it can perfectly emulate this second computer or program. Strictly speaking, home PCs amd Macintoshes are not universal computers because they have only a finite amount of memory. 32 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 2: Evolutionary Algorithm

33 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 3: Evolutionary Algorithm n°1 Fitness Function:

Initialisation:

Number of gliders × Number of periodic patterns that appear during the evolution of a random configuration of cells Transition rule are initialised at random Mutating the value of one neighborhood

Genetic operators: Single point crossover with a locus situated on the middle Evolution Engine:

(mu + lambda) Evolution Strategy

34

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Initialisatio n des 50 règles

Conservation des 10 meilleures règles

Évaluation des règles par la fonction de fitness

Création de 40 règles par croisement et mutation

Constitution d’une nouvelle population de 50 règles avec les règles conservées et celles créées par croisement et mutation

35

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Fitness :

4 0

Chaque forme est isolée

200

On génère une soupe primordiale :

Évolution pendant 150 générations

Puis testée

= Glisseur = Forme périodique

Fitness = glisseurs  formes 36 périodiques

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 4: Generalization to 3 state automata Von Neumann neighboorhood :

Representation of an automaton:

012000 02000 0000 000 00 0

This space contains 320 automata about 3.48 * 109

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

This algorithm found the number of 5944 gliders. Most common gliders: Diagonal glider:

Slowest glider:

Dynamic glider gun:

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 5: Evolutionary Algorithm n°2 Fitness Function:

Initialisation:

Number of gliders / the total number of cells that appear during the evolution of a random configuration of cells Transition rule are initialised at random Mutating the value of one neighborhood not used by the given glider

Genetic operators:

Evolution Engine:

Single point crossover with a locus situated on the middle (mu + lambda) Evolution Strategy

39

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Détermination des contextes critiques d’un motif

Neighborhoods used by a glider

Exemple : le glisseur de R0 sur une demi période

Ensemble des contextes encadrés = ensemble des contextes utilisés 40 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 6: Recherche d ’un effaceur

Formes périodiques apparaissant le plus souvent dans l’évolution de R0 :

Chaque forme est testée dans plusieurs positions :



Aucun effaceur détecté  Modification de R0 en conservant le lance-glisseurs  Introduction des notions d’espace vital et de contexte critique41 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Détermination des contextes critiques d’un motif Exemple : le glisseur de R0 sur une demi période

Ensemble des contextes encadrés = ensemble des contextes utilisés 42 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Contextes utilisé par le canon de R0:

81 contextes utilisés  221 automates acceptent le canon  Recherche d’un automate acceptant un effaceur 43 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Opérateur de l ’algorithme évolutionnaire: Forme-position-règle

Individu :

50 individus engendrés :

Initialisati on :

- forme et position aléatoires, - règle initialisée à R0.

Croisemen t:

Pas de croisement Mutation de :- la forme, - l’abscisse,

Mutation :

- l’ordonnée,

critique.

- la valeur d’un contexte non 44

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Le nombre de glisseurs “stoppé” par le motif Exemple : Motif :

Position :

Deuxième glisseur Résultat de l’évolution par R’ après 11 générations :

Après 16 générations :

Premier glisseur

Le premier glisseur « percute » le motif  Ils sont tous deux détruits  la valeur de la fonction 45 d’évaluation est 1 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Algorithme évolutionnaire recherchant un effaceur Initialisation des 50 individus

Les 25 meilleurs sont conservés

Evaluation des individus par la fonction d’évaluation

25 individus sont créés par mutation

Constitution d ’une nouvelle population de 50 individus avec ceux conservés et ceux créés par mutation 46 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Distribution de la fonction d’évaluation des individus dans la population initiale : 60% 50%

40% 30% 20% 10% 0%

Fonction d’évaluation après l’évolution de l’algorithme évolutionnaire :2 5 1

2

3

4

5

6

8

1

Maximum local :

4 3

7

11

14

17

10

13

16 15 14

Extremum :

47 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 7: Highlife Transition rule:

The Gosper gun does not work with the transition rule of Highlife Highlife can not be shown universel by Conway demonstration of universality of the Game of Life 48 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Generalisation of the demonstration to Highlife We show that an automaton that simulates these four patterns D is universel: D Point 0,0

Point 0,0

Duplication:

A1 A1

After some generations

A2

Point 0,0

D

A0 A1

D

A0

D

A1

D A2

Point 0,0

Point 0,0

A0

A2

D After some generations

A0

: Nand Gate

D A1&A2 A3

A3

D A0

D A1

Temporization:

Point 0,0

D

A2

D

Point 0,0

After some generations

A0

D A2

A1

D A0

D A1

A0

D After some generations

Point 0,0

A1

: Redirection 49

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Generalisation of the demonstration to Highlife We show that Highlife simulates these four patterns and is universal thanks to this gun :

50 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 8: How many guns can be found by this algorithm? Suppose each gun has the same probability to be found.Let N be the total number of guns findable by this algorithm. The probability of a gun found by the algorithm to be new would be: 1− 15363/N The number of new guns among the last 1000 different found guns is 755. So the total number of guns findable by the algorithm could be estimated by N = 15363*1000/245 about 62706. 51

Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 9: Glider gun for various gliders

52 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 10: an And Gate found by evolutionary algorithm Gun Eater Stream A 0

1

1

0

Stream B

1

1

0

0

1

Stream A&B

53 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group

Annexe 1

54 Emmanuel Sapin, University of the West of England, Artificial Intelligence Group and Unconventional Computing Group