Top Banner
LECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: www2.cs.uh.edu/~ceick/ai/EC1.ppt
32

L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

Jan 02, 2016

Download

Documents

Avis Lewis
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

LECTURE 3

Notes are modified from EvoNet Flying Circus slides.

Found at: www2.cs.uh.edu/~ceick/ai/EC1.ppt

Page 2: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

OUTCOMES

At the end you should be able to discuss: Basics of evolutionary computation Representation At least two selection approaches What crossover is. What is the link between genetic programming

and genetic algorithms.

Page 3: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

THE STEPS

In order to build an evolutionary algorithm there are a number of steps that we have to perform:

1. Design a representation2. Decide how to initialize a population3. Design a way of mapping a genotype to a

phenotype4. Design a way of evaluating an individual

Page 4: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

FURTHER STEPS

5. Design suitable mutation operator(s)6. Design suitable recombination operator(s)7. Decide how to manage our population8. Decide how to select individuals to be

parents9. Decide how to select individuals to be

replaced10. Decide when to stop the algorithm

Page 5: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

DESIGNING A REPRESENTATION

Come up with a method of representing an individual solution.

Must be relevant to the problem that we are solving.

Bear in mind how the solutions will be evaluated and what the genetic operators might be.

Page 6: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: DISCRETE REPRESENTATION (BINARY ALPHABET)

CHROMOSOMECHROMOSOME

GENEGENE

Representation of an individual can be using discrete values (binary, integer, etc.). Following is an example of binary representation.

Page 7: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: DISCRETE REPRESENTATION (BINARY ALPHABET)

8 bits Genotype

Phenotype:• Integer

• Real Number

• Schedule

• ...

• Anything?

Page 8: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: DISCRETE REPRESENTATION (BINARY ALPHABET)

Phenotype could be integer numbers

Genotype:

1*21*27 7 + 0*2+ 0*26 6 + 1*2+ 1*25 5 + 0*2+ 0*24 4 + 0*2+ 0*23 3 + 0*2+ 0*22 2 + 1*2+ 1*21 1 + 1*2+ 1*200 ==

128 + 32 + 2 + 1 = 163128 + 32 + 2 + 1 = 163

= 163Phenotype:

Page 9: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: DISCRETE REPRESENTATION (BINARY ALPHABET)

Phenotype could be a Schedulee.g. 8 jobs, 2 time steps

Genotype:

=

12345678

21211122

JobTime Step

Phenotype

Page 10: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: REAL-VALUED REPRESENTATION

A very natural encoding if the solution we are looking for is a list of real-valued numbers, then encode it as a list of real-valued numbers!

Lots of applications, e.g. parameter optimisation

Personal example: Work on evolutionary algorithms and evoked potentials.

Page 11: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: ORDER BASED REPRESENTATION

Individuals are represented as permutations Used for ordering/sequencing problems Famous example: Travelling Salesman

Problem where every city gets a assigned a unique number from 1 to n. A solution could be (5, 4, 2, 1, 3).

Needs special operators to make sure the individuals stay valid permutations.

Page 12: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

Example: Tree-based representation

Individuals in the population are trees. Approach leads to Genetic Programming These functions and terminals can be anything:

Functions: sine, cosine, add, sub, and, If-Then-Else, Turn...

Terminals: X, Y, 0.456, true, false, , Sensor0… Example: calculating the area of a circle:

2* r

* *

r r

Page 13: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EVALUATING AN INDIVIDUAL

This is by far the most costly step for real applicationsdo not re-evaluate unmodified individuals

It might be a subroutine, a black-box simulator, or any external process(e.g. robot experiment)

Page 14: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

MUTATION OPERATORS

We might have one or more mutation operators for our representation. Some important points are:

At least one mutation operator should allow every part of the search space/pattern space to be reached

The size of mutation is important and should be controllable.

Mutation should produce valid chromosomes (i.e. valid possible solutions)

Page 15: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: MUTATION FOR DISCRETE REPRESENTATION

1 1 1 1 1 1 1 before

1 1 1 0 1 1 1 after

Mutation usually happens with a certain probability for each gene

mutated gene

Page 16: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: MUTATION FOR REAL VALUED REPRESENTATION

Adding some random noise

Often, a Gaussian/normal distribution N(0,) is used, where

• 0 is the mean value

• is the standard deviation

and

x’i = xi + N(0,i)

for each parameter

Page 17: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: MUTATION FOR ORDER BASED REPRESENTATION (SWAP)

7 83 41 2 6 5

7 83 46 2 1 5

Randomly select two different genes and swap them.

Page 18: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

Example: Mutation for tree based representation

*

2 *

r r

*

*

r r

Single point mutation selects one node and replaces it with a similar one.

Page 19: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

RECOMBINATION OPERATORS

We might have one or more recombination operators for our representation. Some important points are: The child should inherit something from each

parent. The recombination operator should be designed in

conjunction with the representation. Recombination should produce valid chromosomes

Page 20: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: RECOMBINATION FOR DISCRETE REPRESENTATION

Whole Population: . . .

Each chromosome is cut into n pieces which are recombined. (Example for n=1)

1 1 1 1 1 1 1 0 0 0 0 0 0 0 parentscut cut

1 1 1 0 0 0 0 0 0 0 1 1 1 1 offspring

Page 21: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: RECOMBINATION FOR ORDER BASED REPRESENTATION (ORDER1)

Choose an arbitrary part from the first parent and copy this to the first child

Copy the remaining genes that are not in the copied part to the first child:

• starting right from the cut point of the copied part

• using the order of genes from the second parent

• wrapping around at the end of the chromosome

Repeat this process with the parent roles reversed

Page 22: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: RECOMBINATION FOR ORDER BASED REPRESENTATION (ORDER1)

7 83 41 2 6 5 78 16 5234

81 2

7, 3, 4, 6, 5

4, 3, 6, 7, 5

order

7 85 41 2 3 6

Parent 1 Parent 2

Child 1

Page 23: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

SELECTION STRATEGY

We want to have some way to ensure that better individuals have a better chance of being parents than less good individuals.This will give us selection pressure which will drive the population forward.We have to be careful to give less good individuals at least some chance of being parents - they may include some useful genetic material.

Page 24: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: ROULETTE WHEEL

BestWorst

Better (fitter) individuals have:

more space more chances to be

selected

Page 25: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

EXAMPLE: TOURNAMENT SELECTION

Select k random individuals, without replacement

Take the best k is called the size of the tournament

Page 26: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

REPLACEMENT STRATEGY

The selection pressure is also affected by the way in which we decide which members of the population to kill in order to make way for our new individuals.

Page 27: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

ELITISM

Should fitness constantly improve? Re-introduce in the population previous best-so-far

(elitism) or Keep best-so-far in a safe place (preservation)

Page 28: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

RECOMBINATION VS MUTATION

Recombination modifications depend on the whole population decreasing effects with convergence exploitation operator

Mutation mandatory to escape local optima strong causality principle exploration operator

Page 29: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

STOPPING CRITERION

The optimum is reached!

Limit on CPU resources:

Maximum number of fitness

evaluations

Limit on the user’s patience:

After some generations without improvement

Page 30: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

PRACTICAL PERFORMANCE

Never draw any conclusion from a single run use statistical measures (averages, medians) from a sufficient number of independent runs

Page 31: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

ALGORITHM PERFORMANCE (2)

Remember the WYTIWYG principal:

“What you test is what you get” - don´t tune algorithm performance on toy data and expect it to work with real data.

Page 32: L ECTURE 3 Notes are modified from EvoNet Flying Circus slides. Found at: ceick/ai/EC1.ppt.

KEY ISSUES

What you say are the six key points you should leave this session with?

Please discuss it groups.