Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology...

17
Genetic Algorithms Vida Movahedi November 2006

Transcript of Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology...

Page 1: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Genetic Algorithms

Vida Movahedi

November 2006

Page 2: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Contents

• What are Genetic Algorithms?• From Biology …• Evolution• … To Genetic Algorithms• Demo

Page 3: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

What are Genetic Algorithms?• A method of solving Optimization Problems

– Exponentially large set of solutions– Easy to compute cost or value

• Search algorithm (looking for the optimum)• Very similar to random search?!• Population- based

– We start with a set of possible solutions (initial population) and evolve it to get to the optimum

– Also called Evolutionary Algorithms• Based on evolution in biology

Page 4: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

From Biology …

• Charles Darwin (1859)• Natural selection , “survival of the fittest”• Improvement of species

Can we use the same idea to get an optimal solution?

Page 5: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Evolution

To implement optimization as evolution, We need• Mapping features to genes, showing each

individual with a chromosome• An initial population• Have a function to measure fitness

same as what we want to optimize• Implement and apply Reproduction • Replace offspring in old generation• Have an exit condition for looping over

generations

Page 6: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Initial Population

• Representation of possible solutions as chromosomes– Binary– Real – etc.

• Random initial population• If not random stuck in local optima

Page 7: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Recombination (crossover)

• Random crossover points • Inheriting genes from one parent

Page 8: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Mutation

• Random Mutation Point• Changing gene value to a random value

Page 9: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

… to Genetic AlgorithmsBEGIN /* genetic algorithm*/

Generate initial population ;Compute fitness of each individual ;

LOOP

Select individuals from old generations for mating ; Create offspring by applying recombination and/or mutation to the selected individuals ; Compute fitness of the new individuals ; Kill old individuals ,insert offspring in new generation ;

IF Population has converged THEN exit loop; END LOOP

END

Page 10: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Simple Example

Page 11: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.
Page 12: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.
Page 13: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.
Page 14: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Example

• http://www.rennard.org/alife/english/gavgb.html

Page 15: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.
Page 16: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

References

• [1] Hue, Xavier (1997), “Genetic Algorithms for Optimisation: Background and Applications”, http://www.epcc.ed.ac.uk/overview/publications/training_material/tech_watch/97_tw/techwatch-ga/

• [2] Whitely, Darell (1995), “A Genetic Algorithm Tutorial”, http://samizdat.mines.edu/ga_tutorial/

Page 17: Genetic Algorithms Vida Movahedi November 2006. Contents What are Genetic Algorithms? From Biology … Evolution … To Genetic Algorithms Demo.

Questions?