This action might not be possible to undo. Are you sure you want to continue?
for the award of the degree Of Bachelor of Technology in Mechanical Stream – Industrial Engineering Department Of Mechanical Engineering College of Engineering, Thiruvananthapuram – 16 November, 2010 DEPARTMENT OF MECHANICAL ENGINEERING COLLEGE OF ENGINEERING THIRUVANANTHAPURAM – 1 6 CERTIFICATE This is to certify that the report entitled “GENETIC ALGORITHMS”, submitted by “Pravee n R S, S7 Industrial, Roll No. 27322” to the University of Kerala in partial fulfi llment of the requirements for the award of the Degree of Bachelor of Technology in Mechanical stream-Industrial Engineering is a bonafide record of the seminar presented by him. Sri. V S Unnikrishnan (Asst. Professor) Sri. M S Subramony (Senior Lecturer) Pro f. E Abdul Rasheed (Head of the Department) Dr. Regikumar V (Lecturer) Prof. Z A Samitha (Senior Staff Advisor) Acknowledgement I express my gratitude to my guides, Sri. V S Unnikrishnan (Asst. Professor, Dep artment of Mechanical Engineering), Sri. M S Subramony (Lecturer, Department of Mechanical Engineering) and Sri. Rejikumar V (Lecturer, Department of Mechanical Engineering) from College of Engineering, Trivandrum for their expert guidance and advice in presenting the seminar. I express my sincere thanks to Sri. K Sunilkumar (Lecturer & Staff Advisor, Depa rtment of Mechanical Engineering), Prof. Z A Samitha (Professor & Senior Staff A dvisor, Department of Mechanical Engineering), Prof. E Abdul Rasheed (Head of De partment, Department of Mechanical Engineering), Dr. J Letha (Principal, College of Engineering, Trivandrum) for giving me this opportunity and for their kind c ooperation during the course of this work. I would also wish to record my gratefulness to all my friends and classmates for their help and support in carrying out this work successfully. I also thank the Lord Almighty for the grace, strength and hope to make my endeavour a success. Praveen R S Abstract Genetic Algorithm is one among the different Bio-inspired computing algorithms. It applies the Principle of survival of the fittest to find better and better so lutions. The feasible solutions from the solution space are evaluated using a fi tness function and they are selected for reproduction on the basis of their fitn ess value. Reproduction involves cross over and mutation. The successive generat ions would have better average fitness value, compared to the previous generatio n. The iteration process is continued till the required convergence is attained. Genetic Algorithm usually exhibits a reduced chance of converging to local opti mum. It has got a wide variety of applications is Operations Research related pr oblems like Transportation problems, Travelling salesman problem, Scheduling, Sp anning tree problem, etc. Keywords: Fitness function, Selection, Cross over, Mutation Table of contents Section 1: Introduction 1 1.1 Evolutionary Algorithms 2 Section 2:
Genetic Algorithms 3 2.1 Genetic Algorithms Overview 3 2.2 Structure of a Single Population Genetic Algorithm 5 2.3 Genetic Algorithm Operators 6 2.3.(i) Selection 6 2.3.(ii) Recombination or Crossover 7 2.3.(iii) Mutation 7 Section 3: Encoding 8 3.1 Encoding Techniques 8 3.2 Genotypes and Phenotypes 9 3.3 Random Keys 9 Section 4: Selection 10 4.1 Fitness Function 10 4.2 Selection Techniques 10 4.2.(i) Fitness Proportional Selection 11 4.2.(ii) Ranked Selection 11 4.2.(iii) Stochastic Universal Sampling 11 4.2.(iv) Roulette Wheel Selection 12 4.2.(v) Truncation Selection 13 4.2.(vi) Tournament Selection 13 Section 5: Recombination or Crossover 14 5.1 Recombination Techniques 14 5.1.(i) One point Crossover 14 5.1.(ii) Two point Crossover 14 5.1.(iii) Uniform Crossover 15 5.1.(iv) Shuffle Crossover 15 5.1.(v) Partially Matched Crossover 16 5.1.(vi) Order Crossover 16 5.1.(vii) Cycle Crossover
17 5.2 Crossover Probability (pc) 18 Section 6: Mutation 19 6.1 Mutation Techniques 20 6.1.(i) Flip bit Mutation 20 6.1.(ii) Boundary Mutation 20 6.1.(iii) Uniform Mutation 20 6.2 Mutation Probability(pm) 21 Section 7: Convergence 22 7.1 Premature Convergence 22 7.2 Slow Finishing 23 Section 8: Solution of a Transportation problem using GA 24 8.1 Problem Statement 24 8.2 Encoding 24 8.3 Prüfer Number 25 8.4 GA Operators 25 Section 9: Conclusion 26 Section 10: References 29 List of Figures 1. The Placement of Genetic Algorithms in the hierarchy of Knowledge Based Infor mation Systems . 1 2. Structure of a simple Genetic Algorithm ..................................... ....................................................... 6 3. Stochastic Universal Sampling ............................................... .......................................................... 12 4. Chromosome Fitness on a Roulette Wheel ...................................... ................................................. 12 5. One point Crossover ......................................................... ................................................................ 14 6. Two point Crossover ......................................................... ................................................................ 14 7. Uniform Crossover ........................................................... ................................................................. 15 8. Flip Bit Mutation ........................................................... .................................................................... 20 9. Boundary Mutation ........................................................... ................................................................ 20 10. A Feasible Solution for the Transportation Problem .........................
............................................. 24 11. Spanning Tree Representation ............................................... ......................................................... 24 12. Prüfer Number ................................................................ ............................................................... 25 P a g e 1 1. Introduction Knowledge-based information systems or Evolutionary computing algorithms are des igned to mimic the performance of biological systems. Evolutionary computing alg orithms are used for search and optimization applications and also include fuzzy logic, which provides an approximate reasoning basis for representing uncertain and imprecise knowledge. The no free lunch theorem states that no search algori thm is better on all problems. All search methods show on average the same perfo rmance over all possible problem instances. The present trend is to combine thes e fields into a hybrid in order that the drawbacks of one may be offset by the m erits of another. Neural networks, fuzzy logic and evolutionary computing have s hown capability on many problems, but have not yet been able to solve the really complex problems that their biological counterparts can. Figure 1: The Placement of Genetic Algorithms in the hierarchy of Knowledge Base d Information Systems Knowledge Based Information Systems Approximate Reasoning Approaches Probabilist ic Models Multivalued & Fuzzy logic Search/ Optimisation Approaches Neural Netwo rks Evolutionary Algorithms Evolutionary Strategies Evolutionary Programming Gen etic Algorithms Genetic Programming P a g e 2 1.1.Evolutionary Algorithms Evolutionary algorithms can be used successfully in many applications requiring the optimization of a certain multi-dimensional function. The population of poss ible solutions evolves from one generation to the next, ultimately arriving at a satisfactory solution to the problem. These algorithms differ in the way a new population is generated from the present one, and in the way the members are rep resented within the algorithm. They are part of the derivative-free optimization and search methods that comprise, Genetic Algorithms Simulated annealing (SA) which is a stochastic hill-climbing algorithm based on the analogy with the physical process of annealing. Hill climbing, in essence, f inds an optimum by following the local gradient of the function (thus, they are also known as gradient methods). Random Search Algorithms - Random searches simply perform random walks of the pr oblem space, recording the best optimum values found. They do not use any knowle dge gained from previous results and are inefficient. Randomized Search Techniques - These algorithms use random choice to travel thro ugh the search space using the knowledge gained from previous results in the sea rch. Downhill simplex search Tabu search which is usually applied to combinatorial optimization problems Evolutionary algorithms exhibit an adaptive behavior that allows them to handle non-linear, high dimensional problems without requiring differentiability or exp licit knowledge of the problem structure. They also are very robust to time-vary ing behavior, even though they may exhibit low speed of convergence. P a g e 3 2. Genetic Algorithms 2.1. Genetic Algorithms Overview Genetic Algorithms (GAs) were invented by John Holland in the 1960s and were dev eloped with his students and colleagues at the University of Michigan in the 197 0s. Holland's original goal was to investigate the mechanisms of adaptation in n ature and to develop methods in which these mechanisms could be imported into co mputer systems. Genetic algorithms are search methods that employ processes found in natural bio logical evolution. These algorithms search or operate on a given population of p
otential solutions to find those that approach some specification or criteria. T o do this, the algorithm applies the principle of survival of the fittest to fin d better and better approximations. At each generation, a new set of approximati ons is created by the process of selecting individual potential solutions (indiv iduals) according to their level of fitness in the problem domain and breeding t hem together using operators borrowed from natural genetics. This process leads to the evolution of populations of individuals that are better suited to their e nvironment than the individuals that they were created from, just as in natural adaptation. The GA will generally include the three fundamental genetic operations of select ion, crossover and mutation. These operations are used to modify the chosen solu tions and select the most appropriate offspring to pass on to succeeding generat ions. They usually exhibit a reduced chance of converging to local minima. GAs s uffers from the problem of excessive complexity if used on problems that are too large. Genetic algorithms work on populations of individuals rather than single solutions, allowing for parallel processing to be performed when finding soluti ons to the more large and complex problems. P a g e 4 Standard genetic algorithms are implemented where the initial population of indi viduals is generated at random. At every evolutionary step, also known as genera tion, the individuals in the current population are decoded and evaluated accord ing to a fitness function set for a given problem. The expected number of times an individual is chosen is approximately proportional to its relative performanc e in the population. Crossover is performed between two selected individuals by exchanging part of their genomes to form new individuals. The mutation operator is introduced to prevent premature convergence. Every member of a population has a certain fitness value associated with it, whi ch represents the degree of correctness of that particular solution or the quali ty of solution it represents. The initial population of strings is randomly chos en. The GA using genetic operators, to finally arrive at a quality solution to t he given problem manipulates the strings. GAs converge rapidly to quality soluti ons. Although they do not guarantee convergence to the single best solution to t he problem, the processing leverage associated with GAs make them efficient sear ch techniques. The main advantage of a GA is that it is able to manipulate numer ous strings simultaneously by parallel processing, where each string represents a different solution to a given problem. Thus, the possibility of the GA getting caught in local minima is greatly reduced because the whole space of possible s olutions can be simultaneously searched. P a g e 5 2.2 Structure of a Single Population Genetic Algorithm A GA has the ability to create an initial population of feasible solutions (or n umber of individuals) and randomly initializing them at the beginning of a compu tation. This initial population is then compared against the specifications or c riteria and the individuals that are closest to the criteria, that is, those wit h the highest fitness factor, are then recombined in a way that guides their sea rch to only the most promising areas of the state or search space. Thus, the fir st generation is produced. Each feasible solution is encoded as a chromosome (string) also called a genotyp e and each chromosome is given a measure of fitness (fitness factor) via a fitne ss (evaluation or objective) function. The fitness of a chromosome determines it s ability to survive and produce offspring. A finite fixed population of chromos omes is maintained. A finite fixed population of chromosomes is maintained. If the optimization criteria are not met, then the creation of a new generation starts. Individuals are selected (parents) according to their fitness for the pr oduction of offspring. Parent chromosomes are combined to produce superior offsp ring chromosomes (crossover) at some crossover point (locus). All offspring will be mutated (altering some genes in a chromosome) with a certain probability. Th e fitness of the offspring is then computed. The offspring are inserted into the population replacing the parents, producing a new generation. This cycle is per formed until the optimization criteria are reached. In some cases, where the par
ent already has a high fitness factor, it is better not to allow this parent to be discarded when forming a new generation, but to be carried over. Mutation ens ures the entire state-space will be searched, (given enough time) and it is an e ffective way of leading the population out of a local minima trap. P a g e 6 2.3 Genetic Algorithm Operators A basic genetic algorithm comprises three genetic operators-Selection, Crossover and Mutation. Starting from an initial population of strings (representing poss ible solutions), the GA uses these operators to calculate successive generations . First, pairs of individuals of the current population are selected to mate wit h each other to form the offspring, which then form the next generation. 2.3. (i) Selection This operator selects the chromosome in the population for reproduction. The mor e fit the chromosome, the higher its probability of being selected for reproduct ion. Thus, selection is based on the survival-of-the-fittest strategy, but the k ey idea is to select the better individuals of the population. After selection o f the pairs of parent strings, the crossover operator is applied to each of thes e pairs. Provide Initial Population Does the average fitness suit the requiremen t? Selection Recombination Mutation Generate new population Best individuals Sta rt Yes No Solution Found Figure 2: Structure of a simple Genetic Algorithm P a g e 7 2.3. (ii) Recombination or Crossover The crossover operator involves the swapping of genetic material (bit-values) be tween the two parent strings. This operator randomly chooses a locus (a bit posi tion along the two chromosomes) and exchanges the sub-sequences before and after that locus between two chromosomes to create two offspring. 2.3. (iii) Mutation The two individuals (children) resulting from each crossover operation will now be subjected to the mutation operator in the final step to forming the new gener ation. This operator randomly flips or alters one or more bit values at randomly selected locations in a chromosome. The mutation operator enhances the ability of the GA to find a near optimal solu tion to a given problem by maintaining a sufficient level of genetic variety in the population, which is needed to make sure that the entire solution space is u sed in the search for the best solution. In a sense, it serves as an insurance p olicy; it helps prevent the loss of genetic material. P a g e 8 3. Encoding 3.1 Encoding Techniques For any GA a chromosome representation is required to describe each individual i n the population of interest. The representation scheme determines how the probl em is structured in the GA and also determines what genetic operators are used [ 1]. Each individual or chromosome is made up of a sequence of genes from a certa in alphabet. This alphabet could consist of binary digits (0 and 1), floating po int numbers, integers, symbols (i.e., A, B, C, D), matrices, etc. In Holland's o riginal design, the alphabet was limited to binary digits. Each element of the s tring represents a particular feature in the chromosome. The first thing that mu st be done in any new problem is to generate a code for this problem. How is one to decide on the correct encoding for one's problem? Lawrence Davis, a research er with much experience applying GAs to real-world problems, strongly advocates using whatever encoding is the most natural for your problem, and then devising a GA that can use that encoding . One appealing idea is to have the encoding itself adapt so that the GA can make better use of it. Choosing a fixed encoding ahead of time presents a paradox to the potential GA user: for any problem that is hard enough that one would want t o use a GA, one doesn't know enough about the problem ahead of time to come up w ith the best encoding for the GA. Thus, most research is currently done by guess ing at an appropriate encoding and then trying out a particular version of the G A on it. P a g e 9
3.2 Genotypes and Phenotypes The actual value of a solution refers to its phenotype whereas the encoded value refers to its genotype. Search happens in genotypic space, but selection occurs in phenotypic space. For example, using a binary coding scheme (5, 3) can be co ded as 101 011, in which 101 refers to 5 and 011 refers to 3. (5, 3) is the phen otype whereas 101 011 is the genotype of the solution. 3.3 Random Keys Random key is a special encoding scheme used in Travelling Salesman Problem to r epresent the nodes . In the random key method, we assign each gene a random n umber drawn uniformly from [0; 1). To decode the chromosome, we visit the nodes in ascending order of their genes. For example: Random key 0.42 0.06 0.38 0.48 0.81 Decodes as 3 1 2 4 5 Nodes that should be early in the tour tend to “evolve” genes closer to 0 and those that should come later tend to evolve genes closer to 1. Standard crossover tech niques will generate children that are guaranteed to be feasible. P a g e 10 4. Selection 4.1 Fitness Function The evaluation function, or objective function, provides a measure of performanc e with respect to a particular set of parameters . The fitness function trans forms that measure of performance into an allocation of reproductive opportuniti es. The evaluation of a string representing a set of parameters is independent o f the evaluation of any other string. The fitness of that string, however, is al ways defined with respect to other members of the current population. When individuals are modified to produce new individuals, they are said to be br eeding. Selection determines which individuals are chosen for breeding (recombin ation) and how many offspring each selected individual produces. The individual (chromosome or string) is first grade, known as its fitness, which indicates how good a solution it is. The period in which the individual is evaluated and assi gned a fitness value is known as fitness assessment. Good chromosomes (those wit h the highest fitness function) survive and have offspring, while those chromoso mes furthest removed or with the lowest fitness function are culled. Constraints on the chromosomes can be modeled by penalties in the fitness function or encod ed directly in the chromosomes' data structures. 4.2 Selection Techniques Once individuals have had their fitness assessed, they may be selected and bred to form the next generation in the evolution cycle, through repeated application of some selection function. This function usually selects one or two individual s from the old population, copies them, modifies them, and returns the modified copies for addition to the new population. Commonly used selection techniques ar e as follows. P a g e 11 4.2. (i) Fitness Proportional Selection This selection method normalizes all the fitnesses in the population. These norm alized fitnesses then become the probabilities that their respective individuals will be selected. Fitnesses may be transformed in some way prior to normalizati on. One of the problems with fitness-proportional selection is that it is based directly on the fitness. Assessed fitnesses are rarely an accurate measure of ho w “good” an individual really is. 4.2. (ii) Ranked Selection In this technique, individuals are first sorted according to their fitness value s, with the first individual being the worst and the last individual being the b est. Each individual is then selected with a probability based on some linear fu nction of its sorted rank. This is usually done by assigning to the individual a t rank i a probability of selection. ( ) where P is the size of the population P, and 1 < c < 2 is the selection bias : higher values of the selective pressure „c‟ cause the system to focus more on sele cting only the better individuals. The best individual in the population is thus selected with probability ; the worst individual is selected with the probabili
ty . 4.2. (iii) Stochastic Universal Sampling Stochastic universal sampling provides zero bias and minimum spread. The individ uals are mapped to contiguous segments of a line, such that each individual's se gment is equal in size to its fitness exactly as in roulette-wheel selection. He re equally spaced pointers are placed over the line as many as there are individ uals to be selected. Consider n the number of individuals to be selected, then t he distance between the pointers is 1/n and the position of the first pointer is given by a randomly generated number in the range [0, 1/n]. P a g e 12 Consider an example. A, B, C, D, E and F are six different solutions arranged in their decreasing order of fitness, and their lengths are proportional to their fitness values. The initial point (here its „p‟) is fixed at random and another poin t „q‟ is fixed such that it is at a distance of 1/n from p. „r‟ is fixed such that rq = pq. The solutions which fall at those points are selected. Here, A, B and D are selected. 4.2. (iv) Roulette Wheel Selection The simplest selection scheme is roulette-wheel selection, also called stochasti c sampling with replacement. Each slot on the wheel represents a chromosome from the parent generation; the width of each slot represents the relative fitness o f a given chromosome. Then the Roulette wheel is simulated. The largest fitness values tend to be the most likely resting-places for the marble, since they have larger slots. Consider an example. Figure 4: Chromosome Fitness on a Roulette Wheel Here, C, being the most fit individual, has the greater probability to be select ed. A 7% B 24% C 35% D 14% E 20% A C E D F B p q r Figure 3: Stochastic Universal Sampling P a g e 13 4.2. (v) Truncation Selection Compared to the previous selection methods modeling natural selection, truncatio n selection is an artificial selection method. Breeders for large populations/ma ss selection use it. In truncation selection, individuals are sorted according t o their fitness. The next generation is formed from breeding only the best indiv iduals in the population. One form of truncation selection, (m,l) selection, wor ks as follows. Let the population size l = km where k and m are positive integer s. The m best individuals in the population are “selected”. Each individual in this group is then used to produce k new individuals in the next generation. In a var iant form, (m + l) selection, m individuals are “selected” from the union of the pop ulation and the m parents which had created that population previously. 4.2. (vi) Tournament Selection This selection mechanism is popular because it is simple, fast, and has well-und erstood statistical properties. In tournament selection, a pool of n individuals is picked at random from the population. These are independent choices: an indi vidual may be chosen more than once. Then tournament selection selects the indiv idual with the highest fitness in this pool. Clearly, the larger the value n, th e more directed this method is at picking highly fit individuals. If n = 1, then the method selects individuals totally at random. Popular values for n include 2 and 7. Two is the standard number for genetic algorithm literature, and is not very selective. Seven is used widely in the genetic programming literature, and is relatively highly selective. P a g e 14 5. Recombination or Crossover After selection has been carried out recombination can occur. Crossovers are (so metimes) deterministic operators that capture the best features of two parents a nd pass it to a new offspring. The population is recombined according to the pro
bability of crossover pc. When a population has been entirely replaced by childr en, the new population is known as the next generation. The whole process of fin ding an optimal solution is known as evolving a solution. 5.1 Recombination Techniques 5.1. (i) One Point Crossover The traditional GA uses 1-point crossover, where the two mating chromosomes are each cut once at corresponding points and the selections after the cuts exchange d. The locus point is randomly chosen. Figure 5: One point Crossover 5.1. (ii) Two Point Crossover In two-point crossover chromosomes are regarded as loop formed by joining the en ds together. To exchange a segment from one loop with that from another loop req uires the selection of two randomly chosen crossover or cut points. Figure 6: Two point Crossover P a g e 15 5.1. (iii) Uniform Crossover This form of crossover is different from one-point crossover. Copying the corres ponding gene from one or the other parent, chosen according to a randomly genera ted crossover mask creates each gene in the offspring. Where there is a "1" in t he crossover mask, the gene is copied from the first parent and where there is a "0" in the mask, the gene is copied from the second parent as shown in figure 7 . The process is repeated with the parents exchanged to produce the second offsp ring. A new crossover mask is randomly generated for each pair of parents. Offsp ring therefore, contain a mixture of genes from each parent. The number of effec tive crossing points is not fixed, but will average L/2 where L is the chromosom e length. Figure 7: Uniform Crossover 5.1. (iv) Shuffle Crossover Shuffle crossover is related to uniform crossover. A single crossover position ( as in single point crossover) is selected. But before the variables are exchange d, they are randomly shuffled in both parents. After recombination, the variable s in the offspring are unshuffled. This removes positional bias as the variables are randomly reassigned each time crossover is performed. P a g e 16 5.1. (v) Partially Matched Crossover (PMX) Partially matched crossover (PMX) arose in an attempt to solve the blind Travell ing Salesman Problem (TSP). In the blind TSP, fitness is entirely based on the o rdering of the cities in a chromosome and as such, we need to maintain valid per mutations during reproduction. PMX begins by selecting two points -- two and fiv e, in this case -- for its operation. Parent chromosome 1: AB CDE FGH Parent chromosome 2: GF HBA CDE The PMX algorithm notes that the H allele in Chromosome 2 will replace the C allele in Chromosome 1 so it replaces C with H and H with C for both chromosomes The same process is accomplished for the other two alleles being swapped, that i s, B replaced D and D replaces B in both chromosomes A replaces E and E replaces A in both chromosomes And the end result is two offspring with these encodings: Offspring 1: ED HBA FGC Offspring 2: GF CDE HBA 5.1. (vi) Order Crossover (OX) Order crossover involves the removal of some alleles and the shifting of others. Given the crossover points and parent chromosomes as in the PMX example, OX wou ld remove the incoming alleles like so (a dash represents a blank allele): Offspring 1: - - HBA FG Offspring 2: GF CDE --P a g e 17
Then, beginning after the second crossover point, OX shifts alleles to the left (wrapping around the end of the chromosome if necessary), filling empty alleles and leaving an opening for the swapped-in section: Offspring 1: BA --- FGH Offspring 2: DE --- GFC To finish the process, OX exchanges the alleles within the crossover boundaries, finishing the two offspring. Offspring 1: BA CDE FGH Offspring 2: DE HBA GFC PMX preserves the absolute position of a city allele within chromosomes, whereas OX preserves the order of cities in the permutation. 5.1. (vii) Cycle Crossover (CX) This form of crossover works in an entirely different fashion, by swapping a spe cific set of cities between chromosomes. Parent 1: ABCDEFGH Parent 2: GFHBACDE In generating offspring, CX begins with the first cities of the two parent chrom osomes: Offspring 1: G------Offspring 2: A------A search of Parent 1 finds the just-introduced G allele in position 7. Another s wap occurs: Offspring 1: G-----D Offspring 2: A-----G P a g e 18 The search-and-swapping process continues until the allele first replaced in Par ent 1 -- the A – is found in a swap between chromosomes. CX then fills the remaini ng empty alleles from corresponding elements of the parents. The final offspring look like this: Offspring 1: GECBAFDH Offspring 2: ABHDECGE The inversion operator isn't a form of crossover; it reverses a sequence of alle les. Inversion preserves the nature of a permutation while reordering its elemen ts. Here are two examples of inversion applied to the test chromosomes: ABC DEFGH inverts to ABCHGFED 5.2 Crossover Probability (pc) Crossover probability (pc) says how often will be crossover performed. If there is no crossover, offspring is exact copy of parents. If there is a crossover, of fspring is made from the parts of parents‟ chromosome. If crossover probability is 100%, then all offspring is made by crossover. If it is 0%, whole generation is made from exact copies of chromosomes from old population. Crossover is made in the hope that new chromosomes will have good parts of old c hromosome and may be the new chromosomes will be better. However it is good to l eave some part of population survive to next generation. P a g e 19 6. Mutation After recombination offspring undergo mutation. Although it is generally held th at crossover is the main force leading to a thorough search of the problem space , mutations are probabilistic background operators that try to re-introduce need ed chromosome features (bit or allele) into populations whose features have been inadvertently lost. Mutation can assist by preventing a (small) population prem aturely converging onto a local minimum and remaining stuck on this minimum due to a recessive gene that has infected the whole population (genetic drift). It d oes this by providing a small element of random search in the vicinity of the po pulation when it has largely converged. Crossover alone cannot prevent the popul ation converging on a local minimum. Mutation generally finds better solutions t han a crossover-only regime although crossover gives much faster evolution than a mutation-only population. As the population converges on a solution, mutation becomes more productive and crossover less productive. Consequently, it is not a choice between crossover and mutation but, rather the balance among crossover,
mutation and selection that is important. Offspring variables are mutated by the addition of small random values (size of the mutation step), with low probabili ty. The probability of mutating a variable pm, is set to be inversely proportion al to the number of bits (variables) "n", in the chromosome (dimensions). The mo re dimensions one individual has the smaller the mutation probability is require d to be. A mutation rate m = 1/n produces almost optimal results for a broad class of tes t functions where the mutation rate is independent of the size of the population . Varying the mutation rate by increasing it at the beginning of a search and a decreasing it to 1/n at the end as the population converges, gives an insignific ant improvement in the search speed. P a g e 20 6.1 Mutation Techniques 6.1. (i) Flip bit Mutation This technique is generally used in binary coded chromosomes. The value of a par ticular bit chosen at random is flipped. (i.e. 0 is flipped to 1; or 1 is flippe d to 0). Figure 8:Flip Bit Mutation 6.1. (ii) Boundary Mutation This is a modification of the flip bit technique. Here, a bit position is select ed at random and it is changed to the upper or lower bound of the coding scheme used. Consider a coding scheme of characters from A to H. The „C‟ can be either changed to A or H. Figure 9: Boundary Mutation 6.1.(iii)Uniform Mutation This technique is similar to the uniform crossover. Here also, there is a mutati on mask, which determines which all bit positions should be flipped. Flipping is done where an „1‟ is in the mask and the bit is left as it is, where a „0‟ is in the ma sk. P a g e 21 6.2 Mutation Probability (pm) Mutation probability says how often will be parts of chromosomes mutated. If the re is no mutation, offspring is taken after crossover without any change. If mut ation is performed, part of chromosome is changed. If mutation probability is 10 0%, whole chromosome is changed. Mutation is made to prevent falling GA into local optimum, but it should not occ ur very often, because then GA will in fact change to random search. P a g e 22 7. Convergence With a correctly designed and implemented GA, the population will evolve over su ccessive generations so that the fitness of the best and the average individual in each generation increases towards the global optimum . Convergence is the progression towards increasing uniformity. A gene is said to have converged when 95% of the population share the same value. The population is said to have conv erged when all of the genes have converged. At the start of a run, the values for each gene for different members of the pop ulation are randomly distributed giving a wide spread of individual fitnesses. A s the run progresses some gene values begin to predominate. As the population co nverges the range of fitnesses in the population reduces. This reduced range oft en leads to premature convergence and slow finishing. 7.1 Premature Convergence A standard problem with GAs is where the genes from a small number of highly fit , but not optimal, chromosomes may tend to dominate the population causing it to converge on a local minimum rather than search for a global minimum. Once the p opulation has reduced its range of fitnesses due to this convergence, the abilit y of the GA to continue to search for better solutions is effectively prevented. Crossovers of chromosomes that are almost identical produce offspring chromosom es that are almost identical to their parents. The only saving grace is mutation that allows a slower, wider search of the search space to be made.
P a g e 23 The schema theorem states that we should allocate reproductive opportunities to individuals in proportion to their relative fitness. However, this allows premat ure convergence to occur; because the population is not infinite. In order to ma ke GAs work effectively on finite populations the selection process of parents m ust be modified. Ways of doing this are presented in the next section. The basic idea is to control the number of reproductive opportunities each individual get s, so that it is neither too large, nor too small. The effect is to compress the range of fitnesses and prevent any "super-fit" individuals from having the oppo rtunity to take control. 7.2 Slow Finishing After many generations, the population would have converged but can't yet find t he global maximum. The average fitness will be high and the range of fitness lev els quite small. This means that there is very little gradient in the fitness fu nction. Because of this slight slope, the population slowly edges towards the gl obal maximum rather than going to it quickly. P a g e 24 8 Solution of a Transportation Problem using Genetic Algorithm 8.1 Problem Statement There are three sources named S1, S2 and S3, whose supply quantities are 8, 19 a nd 17 respectively. There are four destinations D1, D2, D3 and D4 whose demands are 11, 3, a4 and 16 respectively. Transportation cost from every source to ever y destination is same. Solve the transportation problem to find the optimum allo cations. 8.2 Encoding Establish arbitrary feasible connections between the sources and destinations. Figure 10: A Feasible Solution for the Transportation Problem Develop the corresponding Spanning tree notation. Figure 11: Spanning Tree Representation The corresponding Spanning trees are coded into Prüfer number. P a g e 25 8.3 Prüfer number Prüfer number is an encoding technique used to encode spanning tree representation s . It is the sequence of numbers of nodes to which the least valued leaf nod es (dangling nodes) are connected. If there are „n‟ stations in a Transportation pro blem (including sources and destinations), the Prüfer number consists of n-2 digit s. The steps to find the Prüfer number for the above spanning tree are shown below . Figure 12: Prüfer Number 8.4 GA Operators The Prüfer number representations of all the feasible solutions need to be obtaine d first. They can be evaluated using the fitness function. The fitness for diffe rent feasible solutions can be obtained by calculating the allocations for links between different sources and destinations, from which the total cost can be ob tained. Here, the fitness should be evaluated in inverse scale. The solution wit h least cost must be allotted maximum fitness. Selection process can be followed by Fitness evaluation. It can be followed by Crossover and Mutation. P a g e 26 9 Conclusion The genetic algorithm (GA) is a search heuristic that mimics the process of natu ral evolution. This heuristic is routinely used to generate useful solutions to optimization and search problems . Genetic algorithms belong to the larger cl ass of evolutionary algorithms (EA), which generate solutions to optimization pr oblems using techniques inspired by natural evolution, such as inheritance, muta tion, selection, and crossover. In a genetic algorithm, a population of strings (called chromosomes or the genot ype of the genome), which encode candidate solutions (called individuals, creatu res, or phenotypes) to an optimization problem, evolves toward better solutions. Traditionally, solutions are represented in binary as strings of 0s and 1s, but other encodings are also possible. The evolution usually starts from a populati
on of randomly generated individuals and happens in generations. In each generat ion, the fitness of every individual in the population is evaluated, multiple in dividuals are stochastically selected from the current population (based on thei r fitness), and modified (recombined and possibly randomly mutated) to form a ne w population. The new population is then used in the next iteration of the algor ithm. Commonly, the algorithm terminates when either a maximum number of generat ions has been produced, or a satisfactory fitness level has been reached for the population. If the algorithm has terminated due to a maximum number of generati ons, a satisfactory solution may or may not have been reached. Initially many individual solutions are randomly generated to form an initial po pulation. The population size depends on the nature of the problem, but typicall y contains several hundreds or thousands of possible solutions. Traditionally, t he population is generated randomly, covering the entire range of possible solut ions (the search space). Occasionally, the solutions may be "seeded" in areas wh ere optimal solutions are likely to be found. P a g e 27 During each successive generation, a proportion of the existing population is se lected to breed a new generation. Individual solutions are selected through a fi tness-based process, where fitter solutions (as measured by a fitness function) are typically more likely to be selected. Certain selection methods rate the fit ness of each solution and preferentially select the best solutions. Other method s rate only a random sample of the population, as this process may be very timeconsuming. Most functions are stochastic and designed so that a small proportion of less fi t solutions are selected. This helps keep the diversity of the population large, preventing premature convergence on poor solutions. Popular and well-studied se lection methods include roulette wheel selection and tournament selection. The next step is to generate a second generation population of solutions from th ose selected through genetic operators: crossover (also called recombination), a nd/or mutation. For each new solution to be produced, a pair of "parent" solutions is selected f or breeding from the pool selected previously. By producing a "child" solution u sing the above methods of crossover and mutation, a new solution is created whic h typically shares many of the characteristics of its "parents". New parents are selected for each new child, and the process continues until a new population o f solutions of appropriate size is generated. Although reproduction methods that are based on the use of two parents are more "biology inspired", some research suggests more than two "parents" are better to be used to reproduce a good quali ty chromosome. These processes ultimately result in the next generation population of chromosom es that is different from the initial generation. Generally the average fitness will have increased by this procedure for the population, since only the best or ganisms from the first generation are selected for breeding, along with a small proportion of less fit solutions. P a g e 28 This generational process is repeated until a termination condition has been rea ched. Common terminating conditions are: A solution is found that satisfies minimum criteria Fixed number of generations reached Allocated budget (computation time/money) reached The highest ranking solution's fitness is reaching or has reached a plateau such that successive iterations no longer produce better results Manual inspection Combinations of the above Problems which appear to be particularly appropriate for solution by genetic alg orithms include timetabling and scheduling problems, and many scheduling softwar e packages are based on GAs. GAs have also been applied to engineering. Genetic algorithms are often applied as an approach to solve global optimization problem s. As a general rule of thumb genetic algorithms might be useful in problem domains
that have a complex fitness landscape as crossover is designed to move the popu lation away from local optima that a traditional hill climbing algorithm might g et stuck in. P a g e 29 References  Representations for Genetic and Evolutionary Algorithms, Franz Rothlauf, Springe r 2005  Davis, L. D., editor. 1991. Handbook of Genetic Algorithms. Van Nostrand Reinhol d  Lawrence V. Snyder, Mark S. Daskin, A Random-Key Genetic Algorithm for the Gener alized Traveling Salesman Problem, Department of Industrial Engineering and Mana gement Sciences, February 25, 2005  Genetic Algorithms-A tutorial, A A R Townsend, July 2003  Genetic Algorithms and Engineering Optimization. Mitsuo Gen and Runwei Cheng, Ne w York: John Wiley, 2000  G. A. Vignaux and Z. Michalewicz, A Genetic Algorithm for the Linear Transportat ion Problem, IEEE Transactions on systems, man, and cybernetics, vol. 21, no.2, March/April 1991, pg.no.445 - 452  http://en.wikipedia.org/wiki/Genetic_algorithm
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.