genetic algorithms what is a ga terms and definitions basic algorithm

13
Genetic Genetic Algorithms Algorithms What is a GA What is a GA Terms and definitions Terms and definitions Basic algorithm Basic algorithm

Upload: hortense-hoover

Post on 17-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

Genetic Genetic AlgorithmsAlgorithms

What is a GAWhat is a GA

Terms and definitionsTerms and definitions

Basic algorithmBasic algorithm

Page 2: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

2

What is a GAWhat is a GA Searches for good solutions among possible Searches for good solutions among possible

solutions. solutions.

Uses evolutionary mechanisms including natural Uses evolutionary mechanisms including natural selection, reproduction, mutationselection, reproduction, mutation

The best possible solution may be missedThe best possible solution may be missed

Useful in problems that are too big or too Useful in problems that are too big or too difficult to solve with conventional techniquesdifficult to solve with conventional techniques. .

Page 3: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

3

Terms and definitions (1)Terms and definitions (1)

A A solutionsolution is coded by ais coded by a string string , , also calledalso called chromosome chromosome.. The words The words string and chromosome are used string and chromosome are used interchangeablyinterchangeably

A strings A strings fitness fitness is a measure of is a measure of how good a solution it codes. Fitness how good a solution it codes. Fitness is calculated by a is calculated by a fitness functionfitness function..

Page 4: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

4

Terms and definitions (2)Terms and definitions (2)

Selection: Selection: The procedure to choose The procedure to choose parentsparents

Roulette wheel selectionRoulette wheel selection is a way of is a way of picking out a string from among a group of picking out a string from among a group of strings (a strings (a populationpopulation). ).

A wedge on a roulette wheel proportional A wedge on a roulette wheel proportional to the string's fitness. to the string's fitness.

A 'fit' string is more likely to be chosen A 'fit' string is more likely to be chosen than an 'unfit' string.than an 'unfit' string.

Page 5: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

5

Terms and definitions (3)Terms and definitions (3)

CrossoverCrossover is the procedure by which two is the procedure by which two chromosomes mate to create a new chromosomes mate to create a new offspring chromosome offspring chromosome

parent 1 is copied of up to a randomly parent 1 is copied of up to a randomly chosen point, and parent 2 is copied from chosen point, and parent 2 is copied from that point onwards.that point onwards.

Parent 1 Parent 1 1 0 01 0 0 | | 1 1 01 1 0

Parent 2 Parent 2 0 1 1 | 1 0 00 1 1 | 1 0 0

Offspring1 Offspring1 1 0 01 0 0 1 0 01 0 0

Offspring2 Offspring2 0 1 10 1 1 1 1 01 1 0

Page 6: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

6

Terms and definitions (4)Terms and definitions (4)

MutationMutation : : with a certain probability with a certain probability flip a bit in the offspringflip a bit in the offspring

Various ways to implement mutation, Various ways to implement mutation, optional.optional.

Page 7: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

7

Basic Genetic AlgorithmBasic Genetic Algorithm

1.1. Start:Start: Generate random population of Generate random population of nn chromosomes (suitable solutions for the chromosomes (suitable solutions for the problem) problem)

2.2. Fitness:Fitness: Evaluate the fitness Evaluate the fitness f(x) f(x) of each of each chromosome chromosome xx in the population in the population

3.3. New populationNew population: : Create a new Create a new population by repeating following steps population by repeating following steps until the new population is complete until the new population is complete

4.4. Test: Test: If the end condition is satisfied, stop, If the end condition is satisfied, stop, and return the best solution in current and return the best solution in current populationpopulation

Page 8: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

8

New populationNew population Selection:Selection: Select two parent chromosomes from a Select two parent chromosomes from a

population according to their fitness (the better population according to their fitness (the better fitness, the bigger chance to be selected) fitness, the bigger chance to be selected)

Crossover:Crossover: With a crossover probability cross With a crossover probability cross over the parents to form a new offspring (children). over the parents to form a new offspring (children). If no crossover was performed, offspring is an If no crossover was performed, offspring is an exact copy of parents. exact copy of parents.

Mutation:Mutation: With a mutation probability mutate new With a mutation probability mutate new offspring at each locus (position in chromosome). offspring at each locus (position in chromosome).

Page 9: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

9

Termination CriteriaTermination Criteria after a pre-specified number of after a pre-specified number of

generationsgenerations

when an individual solution reaches when an individual solution reaches a pre-specified level of fitnessa pre-specified level of fitness

when the variation of individuals when the variation of individuals from one generation to the next from one generation to the next reaches a pre-specified level of reaches a pre-specified level of stability, e.g. all become equalstability, e.g. all become equal

Page 10: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

10

Issues to AddressIssues to Address How to represent an individualHow to represent an individual How to choose How to choose

the fitness functionthe fitness function

the selection methodthe selection method

the crossover methodthe crossover method

the frequency of mutations the frequency of mutations

Page 11: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

11

More on SelectionMore on Selection Roulette Wheel SelectionRoulette Wheel Selection: proportional to : proportional to

the fitnessthe fitness Rank SelectionRank Selection: rank is assigned based on : rank is assigned based on

fitness, then choose proportional to the fitness, then choose proportional to the rankrank

Steady-State SelectionSteady-State Selection: sort and always : sort and always choose the bestchoose the best

ElitismElitism: copy the best individuals in the : copy the best individuals in the next generationnext generation

Tournament selectionTournament selection

Page 12: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

12

More on CrossoverMore on Crossover Random point of splitRandom point of split Fixed point of splitFixed point of split

Single point: split in twoSingle point: split in two Two points: split in threeTwo points: split in three Uniform: bits are chosen randomlyUniform: bits are chosen randomly Arithmetic crossover: the offspring is a result of Arithmetic crossover: the offspring is a result of

some arithmetic operationsome arithmetic operation

Two parentsTwo parents Three parentsThree parents

Page 13: Genetic Algorithms What is a GA Terms and definitions Basic algorithm

13

ApplicationsApplications

Optimization problemsOptimization problems

Search in a pool of candidate Search in a pool of candidate solutionssolutions

Tutorial:Tutorial:

http://http://cs.felk.cvut.cz/~xobitko/gacs.felk.cvut.cz/~xobitko/ga//