50
GENETIC ALGORITHMS Speaker: Pei-Ni Tsai

Genetic Algorithms

  • Upload
    nanji

  • View
    24

  • Download
    1

Embed Size (px)

DESCRIPTION

Speaker: Pei-Ni Tsai. Genetic Algorithms. Outline. Introduction Fitness Function GA Parameters GA Operators Example Shortest Path Routing Problem. Introduction. Biological background Darwin On the Origin of Species Natural selection Reproduction Recombination (Crossover) - PowerPoint PPT Presentation

Citation preview

Genetic Algorithm

Genetic AlgorithmsSpeaker: Pei-Ni Tsai1OutlineIntroductionFitness FunctionGA ParametersGA OperatorsExampleShortest Path Routing Problem

22IntroductionBiological backgroundDarwinOn the Origin of SpeciesNatural selectionReproduction Recombination(Crossover) Mutation The fittest survivesHistoryJohnHolland

33Introduction (Cont.)PopulationA set of solutionsRepresented by chromosomesSolutions from one population are taken and used to form a new population.New solutions are selected according to their fitness.This is repeated until some condition (for example number of populations or improvement of the best solution) is satisfied.

44Introduction (Cont.)

SelectionCrossoverMutation55Fitness FunctionInterprets the chromosome in terms of physical representation and evaluates its fitness based on traits of being desired in the solution.

66GA Parameters

Crossover probability How often will be crossover performed If there is no crossover, offspring is exact copy of parents. If there is a crossover, offspring is made from parts of parents' chromosome .Mutation probabilityHow often will be parts of chromosome mutated Population size77GA OperatorsEncodingSelectionCrossoverMutation88EncodingThe chromosome should in some way contain information about solution which it represents.Binary EncodingPermutation EncodingValue Encoding99Encoding (Cont.)Binary EncodingInbinary encodingevery chromosome is a string ofbits,0or1. Chromosome A 101100101100101011100101 Chromosome B 111111100000110000011111 1010Encoding (Cont.)Permutation EncodingInpermutation encoding, every chromosome is a string of numbers, which represents number in asequence.

Permutation encoding is only useful for ordering problems.Chromosome A 1 5 3 2 6 4 7 9 8 Chromosome B 8 5 6 7 2 3 1 4 91111Encoding (Cont.)Value EncodingInvalue encoding, every chromosome is a string of some values. Values can be anything connected to problem, form numbers, real numbers or chars to some complicated objects.

Chromosome A 1.2324 5.3243 0.4556 2.3293 2.4545 Chromosome B ABDJEIFJDHDIERJFDLDFLFEGT Chromosome C (back), (back), (right), (forward), (left) 1212SelectionAccording to Darwin's evolution theory the best ones should survive and create new offspring.Roulette Wheel SelectionRank SelectionTournament SelectionElitism

1313Selection (Cont.)Roulette Wheel SelectionParents are selected according to their fitness.

1414Selection (Cont.)Rank SelectionThe previous selection will have problems when the fitnesses differs very much.Rank selection first ranks the population and then every chromosome receives fitness from this ranking.The worst will have fitness1, second worst2etc. and the best will have fitnessN(number of chromosomes in population). After this all the chromosomes have a chance to be selected. But this method can lead to slower convergence, because the best chromosomes do not differ so much from other ones. 1515Selection (Cont.)Rank Selection

Situation before ranking (graph of fitnesses) Situation after ranking (graph of order numbers)1616Selection (Cont.)Tournament Selection(

ElitismFirst copies the best chromosome (or a few best chromosomes) to new population.

1717CrossoverBinary EncodingSingle point crossover Two point crossover Uniform crossover Arithmetic crossover Permutation EncodingSingle point crossoverValue EncodingAll crossovers from binary encodingcan be used 1818Crossover (Cont.)Binary EncodingSingle point crossover

1919Crossover (Cont.)Binary Encoding (Cont.)Two point crossover

2020Crossover (Cont.)Binary Encoding (Cont.)Uniform crossover (mask)

2121Crossover (Cont.)Binary EncodingArithmetic crossoversome arithmetic operation is performed to make a new offspring

11001011 + 11011111 = 11001001 (AND)

2222Crossover (Cont.)Permutation EncodingSingle point crossoverOne crossover point is selected, till this point the permutation is copied from the first parent, then the second parent is scanned and if the number is not yet in the offspring it is added. (1 2 3 4 56 7 8 9) + (4 5 3 6 89 7 2 1) = (1 2 3 4 56 8 9 7)

There are more ways how to produce the rest after crossover point

2323Crossover (Cont.)Value EncodingAll crossovers from binary encodingcan be usedSingle point crossover Two point crossover Uniform crossover Arithmetic crossover 2424MutationBinary EncodingBit inversionPermutation EncodingOrder changingValue EncodingAddinga small number (for real value encoding)2525Mutation (Cont.)Binary EncodingBit inversionSelected bits are inverted

2626Mutation (Cont.)Permutation EncodingOrder changingTwo numbers are selected and exchanged (123 4 5 689 7) => (183 4 5 629 7)2727Mutation (Cont.)Value EncodingAddinga small number (for real value encoding)To selected values is added (or subtracted) a small number

2828ExampleShortest Path Routing ProblemGenetic RepresentationPopulation InitializationFitness FunctionSelectionCrossoverMutationRepair FunctionSimulation

2929Example (Cont.)Genetic Representation

Fig. 1. Example of routing path and its encoding scheme.3030Example (Cont.)Population InitializationRandom initializationFitness Function

: the fitness value of the th chromosome: the length of the th chromosome : the gene (node) of the th locus in the th chromosome: the link cost between nodes

3131Example (Cont.)SelectionPairwise tournament selection without replacementTwo chromosomes are picked and the one that is fitter is selected.The same chromosome should not be picked twice as a parent.

3232Example (Cont.)Crossover

Pseudocode of the crossover.3333Example (Cont.)Crossover

Example of the crossover procedure.3434Example (Cont.)Mutation

Pseudocode of the mutation.3535Example (Cont.)Mutation

Example of the mutation procedure3636Example (Cont.)Repair Function

Pseudocode of the repair function.3737Example (Cont.)Repair Function

3838Example (Cont.)Repair Function (Cont.)

3939Example (Cont.)SimulationPerformed with MATLAB 5.3 on Pentium III processor (850-MHz clock)The mutation probability is set to 0.05 (a typical mutation option)Each experiment is terminated when all the chromosomes have converged to the same solution4040Example (Cont.)Result of the Munemotos algorithm (total path costs: 187).(b) Result of the Inagakis algorithm (total path costs: 234).Simulation Results for a Fixed Network With 20 NodesComparison results for the paths found by each algorithm.

4141Example (Cont.)

Simulation Results for a Fixed Network With 20 NodesComparison results for the paths found by each algorithm.(c) Result of the proposed algorithm (total path costs: 142).(d) Example network with optimal path in bold line (optimal path costs: 142).4242Example (Cont.)Simulation Results for a Fixed Network With 20 Nodes

4343Example (Cont.)Simulation Results for Random Network Topologies

4444Example (Cont.)

Simulation Results for Random Network Topologies4545Example (Cont.)

Simulation Results for Random Network Topologies4646Example (Cont.)

Simulation Results for Random Network Topologies4747Example (Cont.)

Simulation Results for Random Network Topologies4848Reference20051-28200529-56 Introduction to Genetic Algorithms: http://obitko.com/tutorials/genetic-algorithms/ Chang Wook Ahn and R.S. Ramakrishna, A Genetic Algorithm for Shortest Path Routing Problem and the Sizing of Populations, IEEE Transactions on Evolutionary Computation, Vol. 6, Dec. 2002.

4949 Q & A5050