genetic algorithms, part 2

96
Genetic Algorithms, Part 2

Upload: bell

Post on 23-Feb-2016

51 views

Category:

Documents


0 download

DESCRIPTION

Genetic Algorithms, Part 2. Evolving (and co-evolving) one -dimensional cellular automata to perform a computation. One-dimensional cellular automata. One-dimensional cellular automata. Rule:. One-dimensional cellular automata. Rule:. One-dimensional cellular automata. Rule:. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Genetic Algorithms, Part 2

Genetic Algorithms, Part 2

Page 2: Genetic Algorithms, Part 2

Evolving (and co-evolving) one-dimensional cellular automata to perform a computation

Page 3: Genetic Algorithms, Part 2

One-dimensional cellular automata

Page 4: Genetic Algorithms, Part 2

One-dimensional cellular automata

Rule:

Page 5: Genetic Algorithms, Part 2

One-dimensional cellular automata

Rule:

Page 6: Genetic Algorithms, Part 2

One-dimensional cellular automata

Rule:

Page 7: Genetic Algorithms, Part 2

One-dimensional cellular automata

Rule:

Page 8: Genetic Algorithms, Part 2

One-dimensional cellular automata

Rule:

Page 9: Genetic Algorithms, Part 2
Page 10: Genetic Algorithms, Part 2

Can the complex dynamics be harnessed by evolutionto perform collective information processing?

Page 11: Genetic Algorithms, Part 2

A task requiring collective computation in cellular automata

Page 12: Genetic Algorithms, Part 2

A task requiring collective computation in cellular automata

• Design a cellular automata to decide whether or not the initial pattern has a majority of “on”cells.

Page 13: Genetic Algorithms, Part 2

majority on

initial

Page 14: Genetic Algorithms, Part 2

majority on

initial

final

Page 15: Genetic Algorithms, Part 2

majority offmajority on

initial

final

Page 16: Genetic Algorithms, Part 2

majority offmajority on

initial

final

Page 17: Genetic Algorithms, Part 2

majority offmajority on

initial

final

How to design a cellular automatonthat will do this?

Page 18: Genetic Algorithms, Part 2

We used cellular automata with 6 neighbors for each cell:

Rule: ... ...

...

Page 19: Genetic Algorithms, Part 2

A candidate solution that does not work: Local majority voting

Page 20: Genetic Algorithms, Part 2

Evolving cellular automata with genetic algorithms

• Create a random population of candidate cellular automata rules

• The “fitness” of each cellular automaton is how well it performs the task. (Analogous to surviving in an environment.)

• The fittest cellular automata get to reproduce themselves, with mutations and crossovers.

• This process continues for many generations.

Page 21: Genetic Algorithms, Part 2

The “chromosome” of a cellular automaton is an encoding of its rule table:

Rule table: Chromosome

0

0

1

1

......

0

Page 22: Genetic Algorithms, Part 2

Create a random population of candidate cellular automata rules:

rule 1: 0010001100010010111100010100110111000...rule 2: 0001100110101011111111000011101001010...rule 3: 1111100010010101000000011100010010101... . . .

rule 100: 0010111010000001111100000101001011111...

Page 23: Genetic Algorithms, Part 2

Calculating the Fitness of a Rule

• For each rule, create the corresponding cellular automaton. Run that cellular automaton on many initial configurations.

• Fitness of rule = fraction of correct classifications

Page 24: Genetic Algorithms, Part 2

rule 1: 0010001100010010111100010100110111000...1

..

.

Create rule table

For each cellular automaton rule in the population:

Page 25: Genetic Algorithms, Part 2

Run corresponding cellularautomaton on many randominitial lattice configurations

..

.

incorrect correct

etc.

rule 1 rule table:

Fitness of rule = fraction of correct classifications

.. . .

. . .. . ..

. . .

.. . .

. . .. . ..

. . .

.

Page 26: Genetic Algorithms, Part 2

rule 1: 0010001100010010111100010100110111000... Fitness = 0.5rule 2: 0001100110101011111111000011101001010... Fitness = 0.2rule 3: 1111100010010101000000011100010010101... Fitness = 0.4

. . .

rule 100:0010111010000001111100000101001011111... Fitness = 0.0

Select fittest rules to reproducethemselves

rule 1: 0010001100010010111100010100110111000... Fitness = 0.5rule 3: 1111100010010101000000011100010010101... Fitness = 0.4

. . .

GA Population:

Page 27: Genetic Algorithms, Part 2

Parents:

0010001010010101000000011100010010101... 1111100 100010010111100010100110111000...

Children:

Create new generation via crossover and mutation:

mutate

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 28: Genetic Algorithms, Part 2

Parents:

0010000010010101000000011100010010101... 1111100 100010010111100010100110111000...

Children:

Create new generation via crossover and mutation:

mutate

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 29: Genetic Algorithms, Part 2

Parents:

0010000010010101000000011100010010101... 1111100 100010010111100010100110111000...

Children:

Create new generation via crossover and mutation:

mutate

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 30: Genetic Algorithms, Part 2

Parents:

0010000010010101000000011100010010101... 1111100 100010010111100010100010111000...

Children:

Create new generation via crossover and mutation:

mutate

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 31: Genetic Algorithms, Part 2

Parents:

0010000010010101000000011100010010101... 1111100 100010010111100010100010111000...

Children:

Create new generation via crossover and mutation:

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 32: Genetic Algorithms, Part 2

Parents:

0010000010010101000000011100010010101... 1111100 100010010111100010100010111000...

Children:

Create new generation via crossover and mutation:

Continue this process until new generation is complete.Then start over with the new generation.

Keep iterating for many generations.

rule 1: 0010001 100010010111100010100110111000... rule 3: 1111100 010010101000000011100010010101...

Page 33: Genetic Algorithms, Part 2

majority on

A cellular automaton evolved by the genetic algorithm

majority off

Page 34: Genetic Algorithms, Part 2

majority on

A cellular automaton evolved by the genetic algorithm

majority off

How does it perform the computation?

Page 35: Genetic Algorithms, Part 2

How do we describe information processing in complex systems?

Page 36: Genetic Algorithms, Part 2

“simple patterns”:black, white, checkerboard

Page 37: Genetic Algorithms, Part 2

Simple patternsfiltered out

Page 38: Genetic Algorithms, Part 2

“particles”

Page 39: Genetic Algorithms, Part 2

“particles”

Page 40: Genetic Algorithms, Part 2

“particles”laws of “particle physics”

Page 41: Genetic Algorithms, Part 2

• Level of particles can explain:

Page 42: Genetic Algorithms, Part 2

• Level of particles can explain: – Why one CA is fitter than another

Page 43: Genetic Algorithms, Part 2

• Level of particles can explain: – Why one CA is fitter than another– What mistakes are made

Page 44: Genetic Algorithms, Part 2

• Level of particles can explain: – Why one CA is fitter than another– What mistakes are made– How the GA produced the observed series of

innovations

Page 45: Genetic Algorithms, Part 2

• Level of particles can explain: – Why one CA is fitter than another– What mistakes are made– How the GA produced the observed series of

innovations

• Particles give an “information processing” description of the collective behavior

Page 46: Genetic Algorithms, Part 2

• Level of particles can explain: – Why one CA is fitter than another– What mistakes are made– How the GA produced the observed series of

innovations

• Particles give an “information processing” description of the collective behavior----> “Algorithmic” level

Page 47: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

Page 48: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 8

Page 49: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 8 generation 13

Page 50: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 17

Page 51: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 17 generation 18

Page 52: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 33

Page 53: Genetic Algorithms, Part 2

How the genetic algorithm evolved cellular automata

generation 33 generation 64

Page 54: Genetic Algorithms, Part 2

Cellular Automata

Traditional GA (with

crossover)

20%

Traditional GA (mutation only)

0%

Percentage of successful runs

Page 55: Genetic Algorithms, Part 2

Cellular Automata

Traditional GA (with

crossover)

20%

Traditional GA (mutation only)

0%

Percentage of successful runs

Problem: GA often gets stuck in local optima, with “too easy” training examples

Page 56: Genetic Algorithms, Part 2

Problem for learning algorithms:

How to select training examples appropriate to different stages of learning?

One solution: Co-evolve training examples, using inspiration from host-parasite coevolution in nature.

Page 57: Genetic Algorithms, Part 2

Host-parasite coevolution in nature

• Hosts evolve defenses against parasites

• Parasites find ways to overcome defenses

• Hosts evolve new defenses

• Continual “biological arms race”

Page 58: Genetic Algorithms, Part 2

Heliconius-egg mimicry in Passiflora

http://www.ucl.ac.uk/~ucbhdjm/courses/b242/Coevol/Coevol.html

Page 59: Genetic Algorithms, Part 2

• Darwin recognized the importance of coevolution in driving evolution

Page 60: Genetic Algorithms, Part 2

• Darwin recognized the importance of coevolution in driving evolution

• Coevolution was later hypothesized to be major factor in evolution of sexual reproduction

Page 61: Genetic Algorithms, Part 2

Coevolutionary Learning

Page 62: Genetic Algorithms, Part 2

Coevolutionary Learning

Candidate solutions and training examples coevolve.

Page 63: Genetic Algorithms, Part 2

Coevolutionary Learning

Candidate solutions and training examples coevolve.– Fitness of candidate solution (host): how

well it performs on training examples.

Page 64: Genetic Algorithms, Part 2

Coevolutionary Learning

Candidate solutions and training examples coevolve.– Fitness of candidate solution (host): how

well it performs on training examples.

– Fitness of training example (parasite): how well it defeats candidate solutions.

Page 65: Genetic Algorithms, Part 2

Sample Applications of Coevolutionary Learning

Page 66: Genetic Algorithms, Part 2

Sample Applications of Coevolutionary Learning

• Competitive:

– Coevolving minimal sorting networks (Hillis)

• Hosts: Candidate sorting networks• Parasites: Lists of items to sort

Page 67: Genetic Algorithms, Part 2

Sample Applications of Coevolutionary Learning

– Game playing strategies (e.g., Rosin & Belew; Fogel; Juillé & Pollack)

• Hosts: Candidate strategies for Nim, 3D Tic Tac Toe, backgammon, etc.

• Parasites: Another population of candidate strategies

Page 68: Genetic Algorithms, Part 2

– HIV drug design (e.g., Rosin)

• Hosts: Candidate protease inhibitors to match HIV protease enzymes

• Parasites: Evolving protease enzymes

Page 69: Genetic Algorithms, Part 2

– Robot behavior (e.g., Sims; Nolfi & Floreano)

• Hosts: Robot control programs

• Parasites: Competing robot control programs

Page 70: Genetic Algorithms, Part 2

• Cooperative:

– Cooperative coevolution of neural network weights and topologies (e.g., Potter & De Jong; Stanley, Moriarty, Miikkulainen)

Page 71: Genetic Algorithms, Part 2

Our Experiments

(Mitchell, Thomure, & Williams, 2006)

Spatial Non-spatial

Coevolution

Evolution

Page 72: Genetic Algorithms, Part 2

Problem domains used in experiments

1. Function induction: 2D function-induction task (Pagie & Hogeweg, 1997)

– Evolve function tree to approximate

44- 1

1 1

1 ),(f

yxyx

Page 73: Genetic Algorithms, Part 2

– Hosts are candidate trees

• Function set: {+, -, , %}

• Terminal set: {x, y, }+

*

y x y

Example of candidate tree

Page 74: Genetic Algorithms, Part 2

– Parasites are (x,y) pairs

Page 75: Genetic Algorithms, Part 2

• Fitness (h) = Average inverse error on sample of p

• Fitness (p): Error of h on problem p

• Success = Correct host (on complete set of problems) in population for 50 generations

75

Page 76: Genetic Algorithms, Part 2

2. Evolving cellular automata

• Problem is to design 1D CA that classifies initial configurations (ICs) as “majority 1s” or “majority 0s”.

Page 77: Genetic Algorithms, Part 2

Spatial Coevolution

Page 78: Genetic Algorithms, Part 2

Spatial Coevolution• 2D toroidal lattice with one host (h) and one

parasite (p) per site

Page 79: Genetic Algorithms, Part 2

Spatial Coevolution

hp

hp

hp

. ...

..

hphp

• 2D toroidal lattice with one host (h) and one parasite (p) per site

Page 80: Genetic Algorithms, Part 2

Spatial Coevolution

hp

hp

hp

. ...

..

hphp

correctly answered gneighborin 9 offraction )(fitness

ph

• 2D toroidal lattice with one host (h) and one parasite (p) per site

Page 81: Genetic Algorithms, Part 2

Spatial Coevolution

hp

hp

hp

. ...

..

hphp

correct not is )( if 0

correct is (p) if 0)(fitness

phh

p

correctly answered gneighborin 9 offraction )(fitness

ph

• 2D toroidal lattice with one host (h) and one parasite (p) per site

Page 82: Genetic Algorithms, Part 2

Spatial Coevolution

hp

hp

hp

. ...

..

hphp

Each h is replaced by mutated copy of winner of tournament among itself and 8 neighboring hosts.

correctly answered gneighborin 9 offraction )(fitness

ph

correct not is )( if 0

correct is (p) if 0)(fitness

phh

p

• 2D toroidal lattice with one host (h) and one parasite (p) per site

Page 83: Genetic Algorithms, Part 2

Spatial Coevolution

hp

hp

hp

. ...

..

hphp

Each h is replaced by mutated copy of winner of tournament among itself and 8 neighboring hosts.

correctly answered gneighborin 9 offraction )(fitness

ph

correct not is )( if 0

correct is (p) if 0)(fitness

phh

p

Each p is replaced by mutated copy of winner tournament among itself and 8 neighboring parasites.

• 2D toroidal lattice with one host (h) and one parasite (p) per site

Page 84: Genetic Algorithms, Part 2

Non-Spatial Coevolution

Page 85: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations

Page 86: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations

hosts

parasites

Page 87: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations

hosts

parasites

fitness(h) = fraction of 9 parasites p (randomly chosen from parasite population)answered correctly

Page 88: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations

hosts

parasites

fitness(h) = fraction of 9 parasites p (randomly chosen from parasite population)answered correctly population

host fromchosen randomly host for correct not is )( if 0

correct is (p) if 0)(fitness

hph

hp

Page 89: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations Each h is replaced by mutated copy

of winner of tournament among itself and 8 randomly chosen hosts.

populationhost fromchosen randomly host for

correct not is )( if 0correct is (p) if 0

)(fitness

hph

hp

hosts

parasites

fitness(h) = fraction of 9 parasites p (randomly chosen from parasite population)answered correctly

Page 90: Genetic Algorithms, Part 2

Non-Spatial Coevolution

• No spatial distribution of host and parasite populations Each h is replaced by mutated copy

of winner of tournament among itself and 8 randomly chosen hosts.

populationhost fromchosen randomly host for

correct not is )( if 0correct is (p) if 0

)(fitness

hph

hp

hosts

parasites

Each p is replaced by mutated copy of winner tournament among itself and 8 randomly chosen parasites.

fitness(h) = fraction of 9 parasites p (randomly chosen from parasite population)answered correctly

Page 91: Genetic Algorithms, Part 2

• Spatial Evolution:

– Same as spatial coevolution, except parasites don’t evolve.

– A new population of random parasites is generated at each generation.

Page 92: Genetic Algorithms, Part 2

• Non-Spatial Evolution:

– Same as non-spatial coevolution, except parasites don’t evolve.

– A new sample of 100 random parasites is generated at each generation.

– Fitness of a host is classification accuracy on these 100 randomly generated parasites

Page 93: Genetic Algorithms, Part 2

Results

Function Induction

Cellular Automata

Spatial Coev. 78% (39/50) 67% (20/30)

Non-Spatial Coev.

0% (0/50) 0% (0/20)

Spatial Evol. 14% (7/50) 0% (0/30)

Non-Spatial Evol.

6% (3/50) 0% (0/20)Percentage of successful runs

Page 94: Genetic Algorithms, Part 2

In short: Spatial coevolution significantly out-performs other methods on both problems

Page 95: Genetic Algorithms, Part 2

Analysis

Why was spatial coevolution successful?

See our papers…

Page 96: Genetic Algorithms, Part 2

Possible applications to real-world problems

– Drug design to foil evolving viruses/bacteria

– Coevolving software/hardware with test cases

– Evolving game-playing programs

– Coevolving computer security systems with possible threats