nelson intro ga

22
1 Introduction to Genetic Algorithms and Evolutionary Computation Andrew L. Nelson Visiting Research Faculty University of South Florida

Upload: sugumar-sar-durai

Post on 20-Oct-2015

19 views

Category:

Documents


0 download

DESCRIPTION

nelson

TRANSCRIPT

Page 1: Nelson Intro Ga

1

Introduction to Genetic Algorithms and Evolutionary

Computation

Andrew L. Nelson

Visiting Research FacultyUniversity of South Florida

Page 2: Nelson Intro Ga

2/9/2004 Genetic Algorithms 2

Overview

• Outline to the left

• Current topic in red

• Introduction

• Algorithm Formulation

• Example

• Case Study

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 3: Nelson Intro Ga

2/9/2004 Genetic Algorithms 3

References• Holland, J. J., Adaptation in Natural and

Artificial Systems, University of Michigan Press, Ann Arbor Michigan, 1975.

• D.B. Fogel, Evolutionary Computation, Toward a New Philosophy of Machine Intelligence, 2nd Ed., IEEE Press, Piscataway, NJ, 2000.

• M. Mitchell, An Introduction to Genetic Algorithms, The MIT Press, Cambridge, Massachusetts, 1998.

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 4: Nelson Intro Ga

2/9/2004 Genetic Algorithms 4

Introduction• Genetic Algorithms

• Base on Natural Evolution• Stochastic Optimization• Stochastic Numerical Techniques

• Evolutionary Computation• Artificial Life• Machine Learning

• Artificial Evolution

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 5: Nelson Intro Ga

2/9/2004 Genetic Algorithms 5

Introduction• Population of candidate solutions

• Evaluate the quality of each solution

• Survival (and reproduction) of the fittest

• Crossover and Mutation

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 6: Nelson Intro Ga

2/9/2004 Genetic Algorithms 6

Sample Application Domain• Finding the best path

between two points in "Grid World"

• Creatures in world:• Occupy a single cell• Can move to

neighboring cells

• Goal: Travel from the gray cell to the green cell in the shortest number of steps

Finish

Start

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 7: Nelson Intro Ga

2/9/2004 Genetic Algorithms 7

Algorithm Formulation

• Components of a Genetic Algorithm: • Genome • Fitness metric• Stochastic modification• Cycles of generations

• Many variations

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 8: Nelson Intro Ga

2/9/2004 Genetic Algorithms 8

Genome

• The genome is used represent candidate solutions

• Fixed length Bitstrings• Holland• Traditional • Convergence theorems exist

• Real-valued genomes• Artificial evolution• Difficult to prove convergence

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 9: Nelson Intro Ga

2/9/2004 Genetic Algorithms 9

Genome• Example:

Representation of a path through a square maze:

• Representation: N=00, E=10, S=11,W=01

00 10 10 00 10 11 10 10 00 00 10 00 10 10 00 01 00 10 00 10

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 10: Nelson Intro Ga

2/9/2004 Genetic Algorithms 10

Population

• Population, P is made up of individuals pn where N is the population size

Nnpn ..1: P

00 10 10 00 10 11 10 10 00 00 10 00 10 10 00 01 00 10 00 10

10 10 00 10 11 10 00 00 01 00 00 10 00 01 00 01 00 10 10 10

00 00 10 10 00 10 10 11 10 11 10 00 10 00 00 00 01 00 10 00

p1 =

p2 =

p2 =

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 11: Nelson Intro Ga

2/9/2004 Genetic Algorithms 11

Fitness Function• F(p) called Objective

Function

• Example: Shortest legal path to goal

• F(pn) = (steps)

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 12: Nelson Intro Ga

2/9/2004 Genetic Algorithms 12

Selection

• Selection Methods of selection of the parents of the next generation of candidate solutions• Diverse methods

• Probabilistic:• Chance of be selected is proportional

to fitness

• Greedy:• the fittest solutions are selected

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 13: Nelson Intro Ga

2/9/2004 Genetic Algorithms 13

Propagation

• The next generation is generated from the fittest members of the current population

• Genetic operators:• Crossover (recombination)• Mutation

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 14: Nelson Intro Ga

2/9/2004 Genetic Algorithms 14

Propagation: Crossover

• Example: 1 point crossover

• Two parents generate 1 offspring

10 10 00 10 11 10 00 00 01 00 00 10 00 01 00 01 00 10 10 10

00 00 10 10 00 10 10 11 10 11 10 00 10 00 00 00 01 00 10 00 p2 =

p2 =

00 00 10 10 00 10 10 11 10 11 10 00 00 01 00 01 00 10 10 10 p1+2 =

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 15: Nelson Intro Ga

2/9/2004 Genetic Algorithms 15

Propagation: Mutation• Example: Bitstring point mutation• Replace randomly selected bits with their

complements• One parent generates one offspring

p1 = 00 11 01 10 10 00 00 01 00 10 00 10 11 10 00 00 10 00 10 10

p1’ = 00 11 00 10 10 00 10 01 00 10 00 10 11 10 00 00 11 00 10 10

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 16: Nelson Intro Ga

2/9/2004 Genetic Algorithms 16

Worked Example• World size:

• 4X4

• Population size: • N = 4

• Genome: • 16 bits

• Fitness: • F(p) = (8-Steps before reaching goal) –

(squares from goal)

• Propagation: Greedy, Elitist

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 17: Nelson Intro Ga

2/9/2004 Genetic Algorithms 17

Ex: Initial Population

• Initial Population P(0): 4 random 16-bit strings

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 18: Nelson Intro Ga

2/9/2004 Genetic Algorithms 18

Ex: Fitness Calculation• Fitness

calculations:

• F(p1) = (8-8) – 4 = -4

• F(p2) = -5

• F(p3) = -6

• F(p4) = -4

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 19: Nelson Intro Ga

2/9/2004 Genetic Algorithms 19

Ex: Selection and Propagation• Select p1 and p4 as parents of the next

generation, P(1)• Produce offspring using crossover and

mutation

10 10 11 01 00 11 10 0100 01 10 01 11 00 00 00

10 10 11 01 00 11 10 01 10 00 11 10 01 10 10 01

00 01 10 01 00 11 10 01

00 01 10 01 00 10 10 00

10 10 11 10 01 10 10 01

10 10 11 00 11 10 10 01

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 20: Nelson Intro Ga

2/9/2004 Genetic Algorithms 20

Ex: Book Keeping...

• The next generation is...• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 21: Nelson Intro Ga

2/9/2004 Genetic Algorithms 21

Ex: Repeat for next Generation

• Repeat:

• F(p1) = -4

• F(p2) = -4

• F(p3) = 0

• F(p4) = -4

• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers

Page 22: Nelson Intro Ga

2/9/2004 Genetic Algorithms 22

• Evolution of neural networks for autonomous robot control using competitive relative fitness evaluation

Case Study• References• Introduction• Sample

Application• Formulation

• Genome• Population• Fitness

Function• Selection • Propagation

• Worked Example

• Case Study: Evolving Neural Controllers