Genetic Algorithms
Deliverables Genetic Algorithms- Basics Characteristics of GAs Switch Board Example Genetic Operators Schemata 6/12/2012 1:31 PM copyright @ gdeepak.com 2
Genetic Algorithms-Basics Search Algorithms based on mechanics of natural selection and natural genetics. Biological Systems are robust and unparallel in their features of selfrepair, self-guidance and reproduction. These features don t exist in artificial intelligent systems. 6/12/2012 1:31 PM copyright @ gdeepak.com 3
Broad Classification of search Methods Calculus based Random Enumerative 6/12/2012 1:31 PM copyright @ gdeepak.com 4
Calculus based-indirect and Direct Indirect method Finds out local extrema by solving non-linear set of equations resulting from setting the gradient of the objective function equal to zero. Direct Method seeks local optima by hopping on the function and moving in a direction related to the local gradient. Which simply looks like hill climbing. Both Methods seek the optima in neighborhood of the current point. Real life applications are full with discontinuities and multimodal noisy search spaces. It is very easy to miss actual optima in many cases even after many improvements by researchers in calculus based methods. 6/12/2012 1:31 PM copyright @ gdeepak.com 5
Enumerative Method In this method the search space is looked at one by one. It is very simple and attractive but the efficiency degrades very fast as the search space increases leading to exponential time complexities. It can not be called a robust scheme due to inherent limitations. 6/12/2012 1:31 PM copyright @ gdeepak.com 6
Random search Not same as randomized technique or algorithms, both should not be confused. Random search in large search spaces becomes comparable to enumerative search. It also can not be called as robust scheme. 6/12/2012 1:31 PM copyright @ gdeepak.com 7
Characteristics of GAs These work with coding of the parameter set, not the parameter themselves These search for a population of points, not a single point. These use payoff( objective function) information not derivatives or other knowledge These use probabilistic rules not deterministic rules 6/12/2012 1:31 PM copyright @ gdeepak.com 8
Switch board example A device with five input switches. For every setting of the switch there is a output signal. Input is a string s consisting of particular setting of the switches. One of the possible coding of the string can be 11110 where first four switches are on and fifth is off. In some problems it is not as obvious to generate the coding. In other methods we move from one point to another looking for peak. This point-to-point method is the weakness which may give false peaks in multimodal space. In contrast here we start from multiple points and climb many peaks in parallel by improving each of those points. In this we choose random start with initial population of 4 strings which can be generated using coin flips. 01101 11000 01000 10011 6/12/2012 1:31 PM copyright @ gdeepak.com 9
Switch board example GAs are blind. There reliability on the auxiliary information about the problem is limited unlike gradient technique which needs derivatives and greedy technique requires most of the tabular parameters. However refusal to use the auxiliary information can place an upper bound on the performance of the algorithm GAs use probabilistic transition rules to guide their search. These use random choice as a tool to guide a search toward regions of the search space with likely improvement. 6/12/2012 1:31 PM copyright @ gdeepak.com 10
Genetic Operators Reproduction Mutation Crossover 6/12/2012 1:32 PM copyright @ gdeepak.com 11
Reproduction Individual strings are copied according to their fitness function which can be a measure of profit, utility or goodness of the objective goal. No String Fitness % of Total 1 01101 169 14.4 2 11000 576 49.2 3 01000 64 5.5 4 10011 361 30.9 Total 1170 100 6/12/2012 1:32 PM copyright @ gdeepak.com 12
Roulette Wheel Slots as per fitness 4 31% 1 14% 3 6% 2 49% 6/12/2012 1:32 PM copyright @ gdeepak.com 13
Work of Roulette Wheel Spin this wheel four times to generate a new population from the given population. The chances of a particular string being reproduced are proportional to the relative fitness value. 6/12/2012 1:32 PM copyright @ gdeepak.com 14
Crossover Members of new population mate randomly. Each pair of strings undergoes crossing at a particular position k chosen at random from 1 to L-1 where L is string length. A1= 0 1 1 0 1 A2= 1 1 0 0 0 if k=4 the result of crossing is A1 = 0 1 1 0 0 A2 = 1 1 0 0 1 6/12/2012 1:32 PM copyright @ gdeepak.com 15
Mutation Mutating a certain position(s) A1= 0 1 1 0 1 Mutating this string at k=3 will give A1 = 0 1 0 0 1 6/12/2012 1:32 PM copyright @ gdeepak.com 16
Power of Genetic Operators These simple operators are very powerful in terms of what can be achieved. A) GAs reproduce high quality children according to their performance B) Crossing with other high performance population given high performance children C) Mutation is insurance policy against premature loss of important children 6/12/2012 1:32 PM copyright @ gdeepak.com 17
Example String number Initial Populat ion x value f(x) = x 2 f i f 1 0 1 1 0 1 13 169 0.14 0.58 1 2 1 1 0 0 0 24 576 0.49 1.97 2 3 0 1 0 0 0 8 64 0.06 0.22 0 4 1 0 0 1 1 19 361 0.31 1.23 1 Sum 1170 1.00 4.00 4 Average 293 0.25 1 1 Max 576 0.49 1.97 2 f i f Actual count of wheel 6/12/2012 1:32 PM copyright @ gdeepak.com 18
Example Mating Pool Mate Crossov er Site New Populat ion x value f x = x 2 0 1 1 0 1 2 4 0 1 1 0 0 12 144 1 1 0 0 0 1 4 1 1 0 0 1 25 625 1 1 0 0 0 4 2 1 1 0 1 1 27 729 1 0 0 1 1 3 2 1 0 0 0 0 16 256 Sum 1754 Average 439 Max 729 6/12/2012 1:32 PM copyright @ gdeepak.com 19
See the hidden benefits Maximum fitness, average fitness as well as total fitness of the population has increased. Looking deeply we see that best string of first generation 1 1 0 0 0 receives two copies because of its high performance, when it combines with next highest 1 0 0 1 1 and crossed over at location 2 it produces 1 1 0 1 1 which is very good improvement. 6/12/2012 1:32 PM copyright @ gdeepak.com 20
Guided Search After proper analysis in each problem we will see that a certain mix of the strings is likely to give the higher performance. In this example strings having 1 at Most significant positions seems to be among the best. What we look at is similarities among strings in population and then relationships between these similarities and high fitness. This type of approach is called similarity template or schemata. 6/12/2012 1:32 PM copyright @ gdeepak.com 21
Schema Schema can be implemented by adding one more symbol to our language {0,1,*} So schema {* 1 1 1 *} means { 01110, 01111, 11110,11111} Introducing * gives us powerful tools to reduce the number of possibilities in our new population and leads to many other performance improvements. 6/12/2012 1:32 PM copyright @ gdeepak.com 22
Schemata Terminology Total number of schemata for a sting of length 5 is 3 5 Define the length δ(h) of schema H as the distance between the first and last specific string position. δ( 10 1 ) = 4 δ( 10 ) = 1 Define order o(h) of a schema H as no of specific string positions o( 10 1 ) = 3 o( 10 ) = 2 6/12/2012 1:32 PM copyright @ gdeepak.com 23
Crossover effect in Schemata If cut is outside schema s specific letters then schema is transferred to its children. Otherwise schema can be destroyed. xi = 011 1000 H1 = *1* ***0 H2 = *** 10** 6/12/2012 1:32 PM copyright @ gdeepak.com 24
Few conclusions Very useful conclusion can be drawn from these that highly fit, Short defining length schemata (called building blocks) are propagated generation to generation by giving exponentially increasing samples to the observed best. There is also an implicit parallelism because multiple strings can be processed in parallel and no special overhead is attached. 6/12/2012 1:32 PM copyright @ gdeepak.com 25
More operators being used Inversion Segregation Translocation 6/12/2012 1:32 PM copyright @ gdeepak.com 26
Questions, Comments and Suggestions 6/12/2012 1:32 PM copyright @ gdeepak.com 27
Question 1 Six strings have the following fitness function values 5, 10, 15, 25, 50, 100. Under Roulette wheel selection, calculate the expected number of copies of each string in the mating pool if a constant population size n=6, is maintained. 6/12/2012 1:32 PM copyright @ gdeepak.com 28
Questions 2 Consider a binary string of length 11, and consider a schema 1*********1. Under crossover with uniform crossover site selection, calculate the lower limit on the probability of this schema surviving crossover. A) 1 B) 0.5 C) 0 D) 0.2 6/12/2012 1:32 PM copyright @ gdeepak.com 29
Question 3 The same solution to a problem may be arrived at in a different number of generations. A)True B)False 6/12/2012 1:32 PM copyright @ gdeepak.com 30