The document discusses genetic algorithms and their use for optimization problems. It defines genetic algorithms as search techniques based on natural selection, where populations of potential solutions undergo processes of selection, crossover and mutation to evolve toward better solutions. It provides examples of applications in fields like engineering, computer science, and image processing. It then explains key genetic algorithm concepts like populations, fitness functions, selection of parents, crossover and mutation operators, and termination conditions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
42 views
Lecture 6 Genetic Algorithms
The document discusses genetic algorithms and their use for optimization problems. It defines genetic algorithms as search techniques based on natural selection, where populations of potential solutions undergo processes of selection, crossover and mutation to evolve toward better solutions. It provides examples of applications in fields like engineering, computer science, and image processing. It then explains key genetic algorithm concepts like populations, fitness functions, selection of parents, crossover and mutation operators, and termination conditions.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16
Week 6
Genetic Algorithm By
Dr. Fazeel Abid
Assistant Professor
The University of Lahore, Pakistan
Genetic Algorithm - Introduction • Genetic Algorithm (GA) is search optimization technique based on the principles of Genetics and Natural Selection developed by John Holland. • Find optimal or near-optimal solutions to difficult problems • Algorithm based on Darwin’s Principle “Survival of the fittest” • Subset of a much larger branch of computation known as Evolutionary Computation. • Provide efficient & effective techniques for optimization in: Structural Engineering Problems Computer Science Image processing and Pattern Recognition Neural Networks Genetic Algorithm - Introduction • GAs, have a pool or a population of possible solutions to the given problem. • These solutions undergo Recombination Mutation Producing new children (Offspring) The process is repeated over various generations. • Each individual (or candidate solution) assigned a fitness value • The fitter individuals are given a higher chance to mate and yield more “fitter” individuals. (“Survival of the Fittest”) • In this way “evolving” of better individuals or solutions over generations, till reach a stopping criterion. Genetic Algorithms “Good-Enough” & “Fast-Enough” Large Set Problems Good Solution Fast If GPS Navigation system, takes a few Large set of problems, which are NP-Hard, minutes (or even a few hours) to compute GAs efficient to provide usable near- the “optimal” path from the source to optimal solutions in a short amount of destination. Delay in such applications is time. not acceptable and therefore a “good- Failure In Landscapes Problems enough” solution, which is delivered “fast” is required. Traditional methods starts from random point and moving in the direction of the gradient, reach the top of the hill. However, complex problem like landscapes, made of many peaks causes such methods to fail, as inherent tendency of getting stuck at the local optima. Genetic Algorithms – Basic Terminologies
• Population is a subset of all the possible
(encoded) solutions to the given problem. • Chromosomes is one such solution to the given problem. • Gene is one element of a chromosome. • Alleles Each gene for the blood type can have the values 0, 1, or 2. • Phenotype is a specific feature or characteristic of the child such as the color of the eye, blood group inherited from parents. Genetic Algorithms – Basic Terminologies • Genotype A set of alleles form a Gene-pair. • Encoding is a process of transforming from the phenotype to genotype . • Decoding is a process of transforming a solution from the genotype to the phenotype. • Fitness Function takes the solution as input and produces the suitability of the solution as the output. • Genetic Operators alter the genetic composition includes: Selection Crossover Mutation Genetic Algorithm - Structure • Start with an initial population (Random or heuristics) select parents from this population (Solutions) for mating. • Apply crossover and mutation operators on the parents to generate new off-springs. • These off-springs replace the existing individuals (Solutions) in the population and the process repeats. • In this way genetic algorithms actually try to mimic the human evolution to some extent. Genetic Algorithms – Population & Initialization
• Population is a subset of solutions in the current generation.
• Several factors considered when dealing with GA population are: The diversity of population should be maintained otherwise it might lead to premature convergence. The population size should not be kept very large as cause a GA to slow down, while smaller population might not be enough for a good mating pool. • There are two primary methods to initialize a population in a GA: Random Initialization Populate the initial population with completely random solutions. Heuristic initialization Populate the initial population using a heuristic for the problem. Genetic Algorithms - Fitness Function • A function which takes a candidate solution to the problem as input and produces as output how “fit” our how “good” the solution with respect to problem. • Calculation of fitness value is done repeatedly in a GA, so it should be sufficiently fast. • A slow computation of the fitness value can adversely affect GA and make it exceptionally slow. • In most cases the fitness function and the objective function are the same as the objective is to either maximize or minimize the given objective function. • However, for more complex problems with multiple objectives and constraints, an Algorithm Designer might choose to have a different fitness function. Genetic Algorithms - Parent Selection • Process of selecting parents which mate and recombine to create off-springs for the next generation. • Parent selection is very crucial to the convergence rate of the GA as good parents drive individuals to a better and fitter solutions. • Extremely fit solution taking over the entire population leads to the solutions being close to one another in the solution space causes a loss of diversity. • Taking up of the entire population by one extremely fit solution is known as premature convergence and is an undesirable condition in a GA. • Maintaining good diversity in the population is extremely crucial for the success of a GA. Genetic Algorithms - Crossover • The crossover operator is analogous to reproduction and biological crossover. • More than one parent is selected and one or more off-springs are produced using the genetic material of the parents. • Crossover is usually applied in a GA with a high probability pc . Crossover Operators • Crossover operators are very generic and the GA Designer might choose to implement a problem-specific crossover operator. One Point Crossover A random crossover point is selected and the tails of its two parents are swapped to get new off-springs. Multi Point Crossover A generalization of the one-point crossover wherein alternating segments are swapped to get new off-springs. Genetic Algorithms - Mutation • Maintain and introduce diversity in the genetic population and is usually applied with a low probability – pm. • If the probability is very high, the GA gets reduced to a random search. Mutation Operators GA designer might find a combination of these approaches or a problem-specific mutation operator more useful. Bit Flip Mutation Select one or more random bits and flip them. This is used for binary encoded GAs. Swap Mutation Select two positions on the chromosome at random, and interchange the values. Scramble Mutation From the entire chromosome, a subset of genes is chosen and their values are scrambled or shuffled randomly. Inversion Mutation Select a subset of genes like in scramble mutation, but instead of shuffling the subset, merely invert the entire string in the subset. Genetic Algorithms - Survivor Selection
• Determines which individuals to be kicked
out or kept in the next generation. • Should ensure that the fitter individuals are not kicked out of the population, while at the same time diversity should be maintained. • GAs employ Elitism means that the current fittest member of the population is always propagated to the next generation. • The following strategies are widely used for Survivor Selection: Age Based Selection Fitness Based Selection Genetic Algorithms - Termination Condition • The termination condition of a Genetic Algorithm is important in determining when a GA run will end. • Usually want a termination condition such that our solution is close to the optimal, at the end of the run. • Usually, keep one of the following termination conditions : When there has been no improvement in the population for X iterations. When reach an absolute number of generations. When the objective function value has reached a certain pre-defined value. Lets Recall GA Significant Elements Fitness Score/Function/Value • A Fitness Score is given to each individual which shows the ability of an individual to “compete”. The individual having optimal fitness score (or near optimal) are sought. Selection Operator: • The idea is to give preference to the individuals with good fitness scores and allow them to pass there genes to the successive generations. Crossover Operator • This represents mating between individuals. Two individuals are selected using selection operator and crossover sites are chosen randomly. Then the genes at these crossover sites are exchanged thus creating a completely new individual (offspring). Lets Recall GA Significant Elements • Mutation Operator: The key idea 1)Randomly initialize populations p is to insert random genes in offspring to maintain the diversity 2) Determine fitness of population in population to avoid the 3) Until convergence repeat: premature convergence. a) Select parents from population b) Crossover and generate new population c) Perform mutation on new population d) Calculate fitness for new • The whole algorithm can be population summarized as: