Evolutionary Algorithms K. Ganesh Research Scholar, Ph.D., Industrial Management Division, Humanities and Social Sciences Department, Indian Institute of Technology Madras, Chennai, TN, India.
Optimization Darwin’s Theory of evolution. Simulated annealing, Tabu Search Genetic Algorithms Search Space NP Problems
Optimization S = { S1,S2, ….. } f : S R Search Space Fitness Landscape Obj. fn. VariablesConstraints
Where to start ? Where to look for the solution? Suitable Solutions ……….Not the best solution but good Not possible to prove which is Real optimum NP Problems Story ????????
Continuous and Discrete variables Obj. Fn. Is Continuous Directional infr. To guide search Starting point? Graph colouring problem Scale is pregiven
Optimization Techniques Traditional Methods Linear Programming Dynamic Programming Non Linear Programming Heuristic Methods Genetic Algorithm Simulated Annealing Tabu search Ant Colony Optimization
Classes of Search Techniques
Advantages of Heuristic Method Better Solution ( Near optimal ) Reasonable Computation time No requirement of Complex derivatives & careful choice of initial values
Many optimization problems have an enormous search space. We shall examine the algorithms according to: Time Space Soundness Completeness Robustness For example…
1. Start at a random point and climb where you can 2. Save the best result, return to step 1 (we shell stop after a while…) Going in circles Local minimum Run the algorithm: Hill Climbing Very fast No memory needed Simple to program Exploits the best solution & Ignores exploration of search space
Random Search Explores the Search space and ignoring the exploitation of search space. Genetic Search Can make a remarkable balance between exploration and exploitation of search space
History 1960 – Introduced by I. Rechenberg 1975 – Popularized by John Holland book "Adaptation in Natural and Artificial Systems" published 1992 – John Koza’s work
“Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions you might not otherwise find in a lifetime.” - Salvatore Mangano Computer Design, May 1995 Genetic Algorithms: A Tutorial
Introduction to GA Evolution in a changing world! Defining GA! (Goldberg, 1989) Search algorithms based on the principle of natural selection and natural genetics Survival of the fittest A natural Perspective Biological Metaphorsis of GAs
In Nature… The strongest survives…
We shall look for several alternatives simultaneously. The searchers exchange information during the search, this Information is the basis for the decision regarding their next location I’m redundant here Good location I’ll stick around here GA -Evaluation of solutions
Directed search algorithms based on the mechanics of biological evolution To understand the adaptive processes of natural systems To design artificial systems software that retains the robustness of natural systems Provide efficient, effective techniques for optimization and machine learning applications Widely-used today in business, scientific and engineering circles
Components of a GA A problem to solve, and... Encoding technique (gene, chromosome) Initialization procedure (creation) Evaluation function (environment) Selection of parents (reproduction) Genetic operators (mutation, recombination) Parameter settings (practice and art)
Simple Genetic Algorithm { initialize population; evaluate population; while Termination Criteria Not Satisfied { select parents for reproduction; perform recombination and mutation; evaluate population; }
Generate randomly the popsize times of initial solution Get the input data for No of iterations, cross over probability, mutation probability Solution from Initialization process Start Select the chromosome by roulette wheel selection approach Evaluation process – calculate the objective function and find out the fitness value and Selection process Apply Arithmetic cross over Apply mutation Find out the off spring stop Take this off spring as initial chromosome Is no of iterations are over B B Flow chart for Genetic Algorithm YN
Outline of the Basic GA [Start] Generate random population of n chromosomes (suitable solutions for the problem) [Fitness] Evaluate the fitness f(x) of each chromosome x in the population [New population] Create a new population by repeating following steps until the new population is complete [Selection] Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) [Crossover] With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. [Mutation] With a mutation probability mutate new offspring at each locus (position in chromosome). [Accepting] Place new offspring in a new population [Replace] Use new generated population for a further run of algorithm [Test] If the end condition is satisfied, stop, and return the best solution in current population
Vertical lines represent solutions (points in search space). The red line is the best solution, Yellow lines are the other ones.
Example Problem Unconstrained Optimization problem max f(x1,x2) = X1 sin (4X1) + X2sin(20X2) -3.0 <=X1<= <=X2<=5.8
Representation Encode decision variables into binary strings Length of the strings depends on required precision Domain of Variable Xj is [aj,bj] Required precision is five places after the decimal point. Range of domain should be divided into atleast (bj-aj)*10 5 size ranges
The required bits denoted with mj for a variable is calculated : 2 mj-1 < (bj-aj)*10 5 < 2 mj Mapping from a binary string to real number for variable xj is: Xj = aj + decimal (substring j )* bj-aj 2 mj -1
The required bits for variables X1 and X2 are: ((12.1) – (-3.0)) * 10000) = < <= 2 18 so, m1 = 18 ((5.8) – (4.1)) * 10000) = < <= 2 15 so, m2 = 15 So, m = m1 + m2 = = 33
The total length of chromosome is 33 bits and it is represented as follows: | 33 bits | V j | 18 bits | | 15 bits |
The corresponding values for X1 and X2 : Binary Number Decimal No. X X X1 = * ((12.1 – (-3.0)) / ) = X2 = * ((5.8 – (4.1) / ) =
Initial Population – Randomly Generated V 1 = [ ] V 2 = [ ] V 3 = [ ] V 4 = [ ] V 5 = [ ] V 6 = [ ] V 7 = [ ] V 8 = [ ] V 9 = [ ] V 10 = [ ] Back
The corresponding decimal values are V 1 = [X1,X2] = [ , ] V 2 = [X1,X2] = [ , ] V 3 = [X1,X2] = [ , ] V 4 = [X1,X2] = [ , ] V 5 = [X1,X2] = [ , ] V 6 = [X1,X2] = [ , ] V 7 = [X1,X2] = [ , ] V 8 = [X1,X2] = [ , ] V 9 = [X1,X2] = [ , ] V 10 = [X1,X2] = [ , ]
Evaluation Step 1. Convert the chromosomes’s genotype to its phenotype. Binary strings into relative real values X k = (X k 1, X k 2 ), k = 1,2,….,pop_size. Step 2. Evaluate the Objective fn. f(X k ) Step 3.Convert the value of Obj. fn. Into fitness. For Maximization problem, the fitness equal to objective function eval(V k ) = f(X k ), k = 1,2,….., pop_size
The fitness function values of above chromosomes are eval (V 1 ) = f ( , ) = eval ( V 2 ) = f ( , ) = eval ( V 3 ) = f ( , ) = W eval ( V 4 ) = f ( , ) = S eval ( V 5 ) = f ( , ) = eval ( V 6 ) = f ( , ) = eval ( V 7 ) = f ( , ) = eval ( V 8 ) = f ( , ) = eval ( V 9 ) = f ( , ) = eval ( V 10 ) = f ( , ) =
Selection Roulette wheel approach Select a new population w.r.to prob. Distr. based on fitness values 1.Calculate fitness value eval (V k ) for each chromosome V k eval ( V k ) = f(X), k = 1,2,….pop_size 2.Calculate the total fitness for population pop_size F = ∑ eval ( V k ) k = j
3.Calculate selection probability P k for each chromosome V k : eval ( Vk ) P k = k = 1, 2, ….., pop_size F 4.Calculate cumulative probability q k for each chromosome V k : k q k = ∑ Pj, k = 1, 2, ….., pop_size j = 1 The selection process begins by spinning the roulette wheel pop_size times.
Selection 1.Generate a random number r from the range [0,1] 2.If r <= q 1, then select the first chromosome V 1 ; otherwise select the k th chromosome V k (2<=k<=pop_size) such that q k-1 < r < q k The total fitness F of the population is 10 F = ∑ eval ( V k ) = k = 1
The probability of a selection p k for each chromosome V k (k=1,…..,10) is as follows: P 1 = P 2 = P 3 = P 4 = P 5 = P 6 = P 7 = P 8 = P 9 = P 10 = The cumulative probabilities q k for each chromosome V k (k=1,…..,10) is as follows: q 1 = q 2 = q 3 = q 4 = q 5 = q 6 = q 7 = q 8 = q 9 = q 10 = Back Chromosomes Back Chromosomes
Spin the roulette wheel 10 times and each time select a single chromosome for a new population. Let us assume that a random sequence of 10 numbers from the range [0,1] is as follows The first number r1 = is greater than q 3 and smaller than q 4 meaning that the chromosome V 4 is selected for the new population
The new population after selection process V’ 1 = [ ] (V 4 ) V’ 2 = [ ] (V 4 ) V’ 3 = [ ] (V 8 ) V’ 4 = [ ] (V 9 ) V’ 5 = [ ] (V 4 ) V’ 6 = [ ] (V 7 ) V’ 7 = [ ] (V 2 ) V’ 8 = [ ] (V 4 ) V’ 9 = [ ] (V 1 ) V’ 10 = [ ] (V 1 ) Back
Crossover One cut point crossover Probability of Crossover Pc = 0.25 Generate Random Numbers: Choose random numbers less than Pc=0.25 The chromosomes V’ 5 and V’ 7 were selected for crossover.V’ 5 and V’ 7 Generate random number between [0,32] for choosing the position in chromosome
Chromosomes selected for crossover V’ 5 =[ ] (V 4 ) V’ 7 = [ ] (V 2 ) The random position from [0,32] is 17. So, cut from the 17 th gene Chromosomes after crossover V’ 5 = [ ] (V 4 ) V’ 7 = [ ] (V 2 )
V’’1= [ ] (V’5) V’’2= [ ] (V’7) V’’3= [ ] (V’8) V’’4= [ ] (V’9) V’’5= [ ] (V’4) V’’6= [ ] (V’7) V’’7= [ ] (V’2) V’’8= [ ] (V’4) V’’9= [ ] (V’1) V’’10= [ ] (V’2) The new population after crossover process
Mutation Flip bit mutation m=33, pop_size=10 Probability of mutation Pm=0.01 Generate sequence of random numbers r k (k= 1,….330) from the range [0 1] Bit_ pos Ch_nu m Bit_ no Rand_no
The Random position is 105, 4 th chromosome, Bit number = 6 Before Mutation V’’4= [ ] (V’9) After Mutation V’’’4= [ ] (V’9)
V’’’1= [ ] (V’1) V’’’2= [ ] (V2) V’’’3= [ ] (V3) V’’’4= [ ] (V4) V’’’5= [ ] (V’5) V’’’6= [ ] (V6) V’’’7= [ ] (V’7) V’’’8= [ ] (V8) V’’’9= [ ] (V9) V’’’10= [ ] (V’10) The new population after Mutation process
The corresponding decimal values (X1,X2) and fitness f( , ) = f( , ) = f( , ) = f( , ) = f( , ) = f( , ) = f( , ) = f( , ) = f( , ) = f( , ) =
Termination Run the test for 1000 generations Best chromosome in 419 th generation V*=( ) Eval(V*)= f( , ) = X1*= X2*= f(X1*,X2*) =