Genetic Algorithm 1 Hany Ferdinando Dept of Electrical

  • Slides: 33
Download presentation
Genetic Algorithm (1) Hany Ferdinando Dept. of Electrical Engineering Petra Christian University Genetic Algorithm

Genetic Algorithm (1) Hany Ferdinando Dept. of Electrical Engineering Petra Christian University Genetic Algorithm (1) - Hany Ferdinando

Overview • • • Introduction GA and evolution theory What is GA? Why should

Overview • • • Introduction GA and evolution theory What is GA? Why should we use GA? GA terminology GA’s basic structure 2 Genetic Algorithm (1) - Hany Ferdinando

Introduction • As a consultant you have to go from Surabaya to Jakarta on

Introduction • As a consultant you have to go from Surabaya to Jakarta on Monday and back to Surabaya again on Wednesday in the same week: – Two-way ticket in the same week is 20% more expensive than two-way ticket for weekend (Wednesday to Monday) – One-way ticket is 75% from two-way ticket without discount Which one will you choose? 3 Genetic Algorithm (1) - Hany Ferdinando

Introduction Optimization problems become more and more complex. To solve this kind of problem,

Introduction Optimization problems become more and more complex. To solve this kind of problem, more complex algorithm is needed. Sometimes, conventional technique cannot solve them. What is Optimization? 4 Genetic Algorithm (1) - Hany Ferdinando

Introduction • Optimization helps people to make a decision from some alternatives • It

Introduction • Optimization helps people to make a decision from some alternatives • It should be the best choice among the good alternatives • It should consider advantages and disadvantage • It is easy for simple alternatives, but for complex one…? 5 Genetic Algorithm (1) - Hany Ferdinando

Introduction “Since 1960 s, there has been an increasing interest in imitating living being

Introduction “Since 1960 s, there has been an increasing interest in imitating living being to solve such kinds of hard optimization problems” [Gen, Cheng] • It is proofed that nature can solve optimization problem better than the other, but it is slow • We need general approach for all optimization problems 6 Genetic Algorithm (1) - Hany Ferdinando

Introduction Evolutionary computing was introduced in the 1960 s by I. Rechenberg in his

Introduction Evolutionary computing was introduced in the 1960 s by I. Rechenberg in his work "Evolution strategies" (Evolutionsstrategie in original). His idea was then developed by other researchers. Genetic Algorithms (GAs) were invented by John Holland developed by him and his students and colleagues. This lead to Holland's book "Adaption in Natural and Artificial Systems" published in 1975. Genetic algorithms are a part of evolutionary computing, which is a rapidly growing area of artificial intelligence. 7 Genetic Algorithm (1) - Hany Ferdinando

Warning!!! Genetic Algorithms are inspired by Darwin's theory of evolution. Simply said, problems are

Warning!!! Genetic Algorithms are inspired by Darwin's theory of evolution. Simply said, problems are solved by an evolutionary process resulting in a best (fittest) solution (survivor) - in other words, the solution is evolved. but… The theory of evolution is wrong!!! 8 Genetic Algorithm (1) - Hany Ferdinando

? Short story about the reason… 9 Genetic Algorithm (1) - Hany Ferdinando

? Short story about the reason… 9 Genetic Algorithm (1) - Hany Ferdinando

What is GA? • It start with an initial set of random solutions called

What is GA? • It start with an initial set of random solutions called population • Each individual in the population is called chromosomes, representing a solution to the problem • A chromosome is a string symbol, usually it is a binary bit string 10 Genetic Algorithm (1) - Hany Ferdinando

What is GA? • The chromosomes evolve through successive iterations, called generations • During

What is GA? • The chromosomes evolve through successive iterations, called generations • During each generation, the chromosomes are evaluated, using some measure of fitness • To create the next generation, new chromosomes, called offspring, are formed by either crossover or mutation 11 Genetic Algorithm (1) - Hany Ferdinando

What is GA? • A new generation is formed by – Selecting according to

What is GA? • A new generation is formed by – Selecting according to the fitness values – Rejecting others so as to keep the population size constant • After several generations, the algorithm converge to the best chromosome, which hopefully represents the optimum solution to the problem 12 Genetic Algorithm (1) - Hany Ferdinando

What is GA? begin t = 0; initialize P(t); evaluate P(t); while (not termination

What is GA? begin t = 0; initialize P(t); evaluate P(t); while (not termination condition) do recombine P(t) to yield C(t); evaluate C(t); select P(t+1) from P(t) and C(t); t = t + 1; end 13 Genetic Algorithm (1) - Hany Ferdinando

What’s new in the GA? • GA works with code of solution, not the

What’s new in the GA? • GA works with code of solution, not the solution itself • GA searches for group of solution, not single solution • GA uses the information directly from the problem or constraint • GA uses stochastic approaches 14 Genetic Algorithm (1) - Hany Ferdinando

Why the GA? • GA needs no mathematics background of the problem • GA

Why the GA? • GA needs no mathematics background of the problem • GA is effective for global search • GA is flexible for hybrid system: – GA with Fuzzy – GA with ANN – etc. 15 Genetic Algorithm (1) - Hany Ferdinando

GA Terminologies • • • Population = group of chromosome Chromosome = solution Genes

GA Terminologies • • • Population = group of chromosome Chromosome = solution Genes (bits) = part of solution Phenotype = decoded solution Genotype = encoded solution 16 Genetic Algorithm (1) - Hany Ferdinando

Structure of GA Init. Population Start Evaluation Selection Generate new population Crossover Mutation NO

Structure of GA Init. Population Start Evaluation Selection Generate new population Crossover Mutation NO Evaluation Genetic Algorithm (1) - Hany Ferdinando Stop ? YES End 17

Assignment… • Make a summary from the study material • List possible applications for

Assignment… • Make a summary from the study material • List possible applications for GA in daily life • Submit your assignment next week… 18 Genetic Algorithm (1) - Hany Ferdinando

Life must go on, see you…! 19 Genetic Algorithm (1) - Hany Ferdinando

Life must go on, see you…! 19 Genetic Algorithm (1) - Hany Ferdinando

Initial Population The initial population is randomly generated. Therefore there will be some number

Initial Population The initial population is randomly generated. Therefore there will be some number of random chromosome for the initial solution. The chromosome can be binary or real number. BACK 20 Genetic Algorithm (1) - Hany Ferdinando

Evaluation Purpose: to evaluate fitness value of each chromosome Procedure: each chromosome is encoded

Evaluation Purpose: to evaluate fitness value of each chromosome Procedure: each chromosome is encoded solution, therefore one needs to decode them into solution. For each solution there is fitness (objective) function to see if the solution is optimal or not BACK 21 Genetic Algorithm (1) - Hany Ferdinando

Selection Each chromosome is selected according to the fitness value. Chromosome with higher fitness

Selection Each chromosome is selected according to the fitness value. Chromosome with higher fitness value will survive. Methods: roulette wheel, top selection, etc. 22 Genetic Algorithm (1) - Hany Ferdinando

Selection: Roulette Wheel It’s based on the roulette wheel in the casino. E (5%)

Selection: Roulette Wheel It’s based on the roulette wheel in the casino. E (5%) D (20%) A (25%) B (15%) C (35%) Therefore, the chromosome with larger area has greater chance to be selected for the next generation 23 Genetic Algorithm (1) - Hany Ferdinando

Selection: Roulette Wheel (cont. ) • Calculate fitness for each chromosome (yk) • Sum

Selection: Roulette Wheel (cont. ) • Calculate fitness for each chromosome (yk) • Sum all the fitnesses (F) • Calculate the probability of each chromosome (pk) • Calculate cumulative probability of each chromosome (qk) • Generate random number [0, 1], the first chromosome which has qk > random is selected 24 Genetic Algorithm (1) - Hany Ferdinando

Example Chrom. 1 2 3 4 5 total Fitness 10 23 16 20 31

Example Chrom. 1 2 3 4 5 total Fitness 10 23 16 20 31 100 Prob. Cum Prob. . 1. 23. 16 . 1. 33. 49 . 2. 31 . 69 1 If the generated random number is 0. 13 then chromosome 2 is selected. If the random number is 0. 5 then chromosome 4 is selected 25 Genetic Algorithm (1) - Hany Ferdinando

Selection: Top • The next generation consists of the number of best chromosome from

Selection: Top • The next generation consists of the number of best chromosome from the previous step • One can be trapped in the super chromosome BACK 26 Genetic Algorithm (1) - Hany Ferdinando

Crossover Two chromosomes can produce two offspring by crossover. The idea is to combine

Crossover Two chromosomes can produce two offspring by crossover. The idea is to combine the genes between two chromosomes to form new individual. Crossover rate (pc) is ratio of new offspring relative to the population Crossover operation: one-cut point, multi-cut point, uniform, arithmatics 27 Genetic Algorithm (1) - Hany Ferdinando

Crossover example 1 0 0 1 1 1 0 0 0 1 1 0

Crossover example 1 0 0 1 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 Initial chromosomes Final chromosomes 28 Genetic Algorithm (1) - Hany Ferdinando

Crossover example 1 0 0 1 1 0 0 0 1 1 0 0

Crossover example 1 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 0 0 0 1 1 0 1 Initial chromosomes Final chromosomes 29 Genetic Algorithm (1) - Hany Ferdinando

Crossover Procedure: begin k = 0; while (not terminate) do rk = random[0, 1];

Crossover Procedure: begin k = 0; while (not terminate) do rk = random[0, 1]; if rk<Pc then select C(k) as one parent Xover; end k = k + 1; end // do crossover operation here… BACK 30 Genetic Algorithm (1) - Hany Ferdinando

Mutation Process in genes, random, uncontrolled Mutation rate (pm) is ratio of genes relative

Mutation Process in genes, random, uncontrolled Mutation rate (pm) is ratio of genes relative to total genes in population which mutate. 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 Initial chromosome Final chromosome 31 Genetic Algorithm (1) - Hany Ferdinando

Mutation Procedure: • Generate random number for each gene (bit) • Gene with random

Mutation Procedure: • Generate random number for each gene (bit) • Gene with random number less than pm is mutated BACK 32 Genetic Algorithm (1) - Hany Ferdinando

Stop Criterion • Stop at certain generation (limit the number of generation) • Stop

Stop Criterion • Stop at certain generation (limit the number of generation) • Stop if the best fitness value is constant for several generations • Stop if there is no better fitness value after several generations BACK 33 Genetic Algorithm (1) - Hany Ferdinando