Genetic Algorithm

A SEMINAR REPORT ON GENETIC ALGORITHM

Prepared by: Nidhi Shah

Genetic Algorithm
A genetic algorithm (GA) is a search technique used in computing to find exact or approximate solutions to optimization and search 1 MT-15

Genetic algorithms are a particular class of evolutionary algorithms (EA) that use techniques inspired by evolutionary biology such as inheritance. selection. GA is stochastic. repeat SELECT parents. The GA can be represented in form of a diagram Parent selection Parents Initialization Recombination /Cross over Population Mutation Termination Children Survivor selection Algorithm: begin INITIALIZE population with random candidate solutions.Genetic Algorithm problems. Genetic algorithms are categorized as global search heuristics. RECOMBINE pairs of parents. EVALUATE each candidate. and crossover. mutation. GA has a number of features: Genetic algorithm is a population-based search method GA uses recombination to mix information of candidate solutions into a new one. 2 MT-15 .

SELECT individuals for the next generation until TERMINATION-CONDITION is satisfied end Flow Chart Begi n Initialize population Evaluate Candidate T =0 Optimum Solution? Y N Selection T=T+1 Stop Crossover Mutation COMPONENTS OF GENETIC ALGORITHMS The most important components in a GA consist of:       Representation (definition of individuals) Evaluation function (or fitness function) Population Parent selection mechanism Variation operators (crossover and mutation) Survivor selection mechanism (replacement) 3 MT-15 . EVALUATE children.Genetic Algorithm MUTATE the resulting children.

Variation Operators The role of variation operators is to create new individuals from old ones. phenotype and individual are used to denotes points of the space of possible solutions. Crossover is a process yielding recombination of bit strings via an exchange of segments between pairs of chromosomes. the population size is constant. the individuals within the GA. and individual can be used for points in the genotye space. Population The role of the population is to hold possible solutions. In general. A binary variation operator is called recombination or crossover. not changing during the evolutional search. are called genotypes. Variation operators form the implementation of the elementary steps with the search space. mutation is supposed to cause a random unbiased change. the child or offspring of it.. Elements of a chromosome are called genes. A population is a multiset of genotypes. This space is called phenotype space. In almost all GA applications. It is applied to one genotype and delivers a modified mutant. The representation step specifies the mapping from the phenotypes onto a set of genotypes. their encoding. Mutation Operator A unary variation operator is called mutation.Genetic Algorithm Representation Objects forming possible solution within original problem context are called phenotypes. Chromosome. Mutation has a theoretical role: it can guarantee that the space is connected. Crossover Operator The crossover operator is the most important in GA. Candidate solution. 4 MT-15 . A value of a gene is called an allele.

we randomly generate two numbers 2 and 4 as the crossover positions: Parent1: 7 3 7 6 1 3 Parent2: 1 7 4 5 2 2 Then we get two children: Child 1 : 7 3| 4 5| 1 3 Child 2 : 1 7| 7 6| 2 2 Uniform Crossover The procedure of uniform crossover : each gene of the first parent has a 0. Example: With the two parents selected above. There are many kinds of crossover One-point Crossover The procedure of one-point crossover is to randomly generate a number (less than or equal to the chromosome length) as the crossover position. 5 MT-15 .Genetic Algorithm Similarly to mutation. keep the bits before the number unchanged and swap the bits after the crossover position between the two parents. Then. and the way these parts are combined. This crossover method can preserve the first and the last parts of a chromosome and just swap the middle part. depends on random drawings. we can produce an offspring which combines both of those features. we randomly generate a number 2 as the crossover position: Parent1: 7 3 7 6 1 3 Parent2: 1 7 4 5 2 2 Then we get two children: Child 1 : 7 3| 4 5 2 2 Child 2 : 1 7| 7 6 1 3 Two-point Cross Over The procedure of two-point crossover is similar to that of one-point crossover except that we must select two positions and only the bits between the two positions are swapped. crossover is a stochastic operator: the choice of what parts of each parent are combined. Example: With the two parents selected above. The principle behind crossover is simple: combining two individuals with different but desirable features.5 probability of swapping with the corresponding gene of the second parent.

0. for example. 0. vice versa.1.Genetic Algorithm Example: For each position. 0. If we apply fitness-based selection on the population given in example 3.9. Rank-based selection 6 MT-15 . original method for parent selection is Roulette Wheel selection or fitness-based selection.4. we select the second chromosome 7 3 7 6 1 3 as our first parent and 1 7 4 5 2 2 as our second parent. we randomly generate a number between 0 and 1.5. 0. Parent1: 7 *3 *7 6 *1 3 Parent2: 1 *7 *4 5 *2 2 Then we get two children: Child 1 : 7 7* 4* 6 2* 3 Child 2 : 1 3* 7* 5 1* 2 Parent Selection Mechanism The role of parent selection is to distinguish among individuals based on their quality to allow the better individuals to become parents of the next generation. but positive chance. otherwise the whole search could become too greedy and get stuck in a local optimum. Fitness-based selection The standard. Parent selection is probabilistic. high quality individuals get a higher chance to become parents than those with low quality. 0. then the fittest chromosome is twice as likely to be selected as a parent than the least fit.1.6. then child1 gets the gene from parent1. The effect of this depends on the range of fitness values in the current population.7. Example: if fitness range from 5 to 10. low quality individuals are often given a small. and child2 gets the gene from parent2. If the number generated for a given position is less than 0. In this kind of parent selection. each chromosome has a chance of selection that is directly proportional to its fitness. Nevertheless. 0. Otherwise. The chance of each parent being selected is in some way related to its fitness. Thus.2.

As opposed to parent selection which is stochastic. for a given period of time. the maximally allowed CPU times elapses 2. the population diversity drops under a given threshold. the fitter of the two individuals is selected to be a parent. Note: Premature convergence is the well-known effect of loosing population diversity too quickly and getting trapped in a local optimum. thus a choice has to be made on which individuals will be allowed in the next generation. the fitness improvement remains under a threshold value. Termination Condition Notice that GA is stochastic and mostly there are no guarantees to reach an optimum. This decision is based on their fitness values. A random number r is then chosen between 0 and 1. The two are then returned to the original population and can be selected again. 7 MT-15 . Survivor Selection Mechanism The role of survivor selection is to distinguish among individuals based on their quality. ranking the unified multiset of parents and offspring and selecting the top segment (fitness biased). If r < k (where k is a parameter. the population size is (almost always) constant. for instance. otherwise the less fit individual is selected. selection probabilities are based on a chromosome’s relative rank or position in the population. The total number of fitness evaluations reaches a given limit 3. survivor selection is often deterministic. or selection only from the offspring (age-biased). favoring those with higher quality.75). for example 0. In GA. rather than absolute fitness.Genetic Algorithm In the rank-based selection method. Tournament-based selection Two individuals are chosen at random from the population. 4. Commonly used conditions for terminations are the following: 1.