Download presentation
Presentation is loading. Please wait.
1
Speaker: Pei-Ni Tsai
2
Outline Introduction Fitness Function GA Parameters GA Operators Example Shortest Path Routing Problem 2
3
Introduction Biological background Darwin On the Origin of Species Natural selection Reproduction Recombination (Crossover) Mutation The fittest survives History John Holland 3
4
Introduction (Cont.) Population A set of solutions Represented by chromosomes Solutions 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. 4
5
Introduction (Cont.) Selection Crossover Mutation 5
6
Fitness Function Interprets the chromosome in terms of physical representation and evaluates its fitness based on traits of being desired in the solution. 6
7
GA 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 probability How often will be parts of chromosome mutated Population size 7
8
GA Operators Encoding Selection Crossover Mutation 8
9
Encoding The chromosome should in some way contain information about solution which it represents. Binary Encoding Permutation Encoding Value Encoding 9
10
Encoding (Cont.) Binary Encoding In binary encoding every chromosome is a string of bits, 0 or 1. Chromosome A 101100101100101011100101 Chromosome B 111111100000110000011111 10
11
Encoding (Cont.) Permutation Encoding In permutation encoding, every chromosome is a string of numbers, which represents number in a sequence. Permutation encoding is only useful for ordering problems. Chromosome A1 5 3 2 6 4 7 9 8 Chromosome B 8 5 6 7 2 3 1 4 9 11
12
Encoding (Cont.) Value Encoding In value 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 A1.2324 5.3243 0.4556 2.3293 2.4545 Chromosome BABDJEIFJDHDIERJFDLDFLFEGT Chromosome C(back), (back), (right), (forward), (left) 12
13
Selection According to Darwin's evolution theory the best ones should survive and create new offspring. Roulette Wheel Selection Rank Selection Tournament Selection (競賽挑選) Elitism (精英挑選) 13
14
Selection (Cont.) Roulette Wheel Selection Parents are selected according to their fitness. 14
15
Selection (Cont.) Rank Selection The 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 fitness 1, second worst 2 etc. and the best will have fitness N (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. 15
16
Selection (Cont.) Rank Selection Situation before ranking (graph of fitnesses) Situation after ranking (graph of order numbers) 16
17
Selection (Cont.) Tournament Selection 在每一代的演化過程中首先隨機地選取兩個或 更多的物種 ( 字串),具有最大適應函數值的物 種即被選中。 Elitism First copies the best chromosome (or a few best chromosomes) to new population. 17
18
Crossover Binary Encoding Single point crossover Two point crossover Uniform crossover Arithmetic crossover Permutation Encoding Single point crossover Value Encoding All crossovers from binary encoding can be used 18
19
Crossover (Cont.) Binary Encoding Single point crossover 19
20
Crossover (Cont.) Binary Encoding (Cont.) Two point crossover 20
21
Crossover (Cont.) Binary Encoding (Cont.) Uniform crossover 均一交配又稱為字罩 (mask) 交配,子代的產生係根據事先 隨機產生的字罩來決定,字罩是二進位元串其長度等於個 體的長度。 21
22
Crossover (Cont.) Binary Encoding Arithmetic crossover some arithmetic operation is performed to make a new offspring 11001011 + 11011111 = 11001001 (AND) 22
23
Crossover (Cont.) Permutation Encoding Single point crossover One 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 5 6 7 8 9) + (4 5 3 6 8 9 7 2 1) = (1 2 3 4 5 6 8 9 7) There are more ways how to produce the rest after crossover point 23
24
Crossover (Cont.) Value Encoding All crossovers from binary encoding can be used Single point crossover Two point crossover Uniform crossover Arithmetic crossover 24
25
Mutation Binary Encoding Bit inversion Permutation Encoding Order changing Value Encoding Adding a small number (for real value encoding) 25
26
Mutation (Cont.) Binary Encoding Bit inversion Selected bits are inverted 26
27
Mutation (Cont.) Permutation Encoding Order changing Two numbers are selected and exchanged (1 2 3 4 5 6 8 9 7) => (1 8 3 4 5 6 2 9 7) 27
28
Mutation (Cont.) Value Encoding Adding a small number (for real value encoding) To selected values is added (or subtracted) a small number 28
29
Example Shortest Path Routing Problem Genetic Representation Population Initialization Fitness Function Selection Crossover Mutation Repair Function Simulation 29
30
Example (Cont.) Genetic Representation Fig. 1. Example of routing path and its encoding scheme. 30
31
Example (Cont.) Population Initialization Random initialization Fitness 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 31
32
Example (Cont.) Selection Pairwise tournament selection without replacement Two chromosomes are picked and the one that is fitter is selected. The same chromosome should not be picked twice as a parent. 32
33
Example (Cont.) Crossover Pseudocode of the crossover. 33
34
Example (Cont.) Crossover Example of the crossover procedure. 34
35
Example (Cont.) Mutation Pseudocode of the mutation. 35
36
Example (Cont.) Mutation Example of the mutation procedure 36
37
Example (Cont.) Repair Function Pseudocode of the repair function. 37
38
Example (Cont.) Repair Function 38
39
Example (Cont.) Repair Function (Cont.) 39
40
Example (Cont.) Simulation Performed 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 solution 40
41
Example (Cont.) (a)Result of the Munemoto’s algorithm (total path costs: 187). (b) Result of the Inagaki’s algorithm (total path costs: 234). Simulation Results for a Fixed Network With 20 Nodes Comparison results for the paths found by each algorithm. 41
42
Example (Cont.) Simulation Results for a Fixed Network With 20 Nodes Comparison 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). 42
43
Example (Cont.) Simulation Results for a Fixed Network With 20 Nodes 43
44
Example (Cont.) Simulation Results for Random Network Topologies 44
45
Example (Cont.) Simulation Results for Random Network Topologies 45
46
Example (Cont.) Simulation Results for Random Network Topologies 46
47
Example (Cont.) Simulation Results for Random Network Topologies 47
48
Example (Cont.) Simulation Results for Random Network Topologies 48
49
Reference 林豐澤, 2005 。演化式計算上篇:演化式演算法 的三種理論模式。智慧科技與應用統計學報第三 卷第一期, 1-28 。 林豐澤, 2005 。演化式計算下篇:基因演算法以 及三種應用實例。智慧科技與應用統計學報第三 卷第一期, 29-56 。 Introduction to Genetic Algorithms: http://obitko.com/tutorials/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. 49
50
Q & A 50
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.