Introduction to Genetic algorithm

12
GENETIC ALGORITHM Submitted by: Heena Gupta 2013Ems02 Mtech(1 st sem)

description

Introduction to genectic algorithm (including the various method involved with example)

Transcript of Introduction to Genetic algorithm

Page 1: Introduction to Genetic algorithm

GENETIC ALGORITH

MSubmitted by:

Heena Gupta2013Ems02

Mtech(1st sem)

Page 2: Introduction to Genetic algorithm

• A class of probabilistic optimization algorithms• Inspired by the biological evolution process• Uses concepts of “Natural Selection” and “Genetic

Inheritance” (Darwin 1859)• Originally developed by Prof. John Holland (1975)• Particularly well suited for hard problems where little is

known about the underlying search space• Widely used in searching techniques involving “search for

solutions”

INTRODUCTION

Page 3: Introduction to Genetic algorithm

Selection This operator selects chromosomes in the population for reproduction. The fitter the chromosome,the more times it is likely to be selected to reproduce.

Crossover This operator randomly chooses a locus and exchanges the subsequences before and after that locusThe crossover operator roughly mimics biological recombination between two single−chromosome (haploid) organisms.

Mutation This operator randomly flips some of the bits in a chromosome.

A genetic algorithm maintains a population of candidate solutions for the problem at hand ,and makes it evolve by iteratively applying a set of stochastic operators

INTRODUCTION (cont)

Stochastic operators

Page 4: Introduction to Genetic algorithm

1.Start with a randomly generated population of n l−bit chromosomes 2.Calculate the fitness ƒ(x) of each chromosome x in the population.3.Repeat the following steps until n offspring have been created: a. Select a pair of parent chromosomes from the current population, the probability of selection being an increasing function of fitness b. With probability pc (the "crossover probability" or "crossover rate"), cross over the pair at a randomly chosen point (chosen with uniform probability) to form two offspring. c. Mutate the two offspring at each locus with probability pm and place the resulting chromosomes in the new population.4.Replace the current population with the new population.5.Go to step 2.

Each iteration of this process is called a generationThe entire set of generations is called a run.

algorithm

Page 5: Introduction to Genetic algorithm

Before a genetic algorithm can be put to work on any problem, a method is needed to encode potential solutions to that problem in a form so that a computer can process.

Common approaches are:Binary Encoding : every chromosome is a string of 0 or 1Permutation Encoding : every chromosome is a string of numbers that represent position in a sequenceTree Encoding : a tree structure represents the chromosomeValue Encoding : every chromosome is a sequence of some values (real numbers, characters or objects)

encoding

Page 6: Introduction to Genetic algorithm

Concept : From the population, the chromosomes are selected to be parents to crossover and produce offspring.

Concept : the chance of an individual's being selected is proportional to its fitness, greater or less than its competitors‘s fitness.

Implementation : Probability of selection of i th individual is:

Where fi :fitness of ith individual, N : number of individuals

Selection

Roulette-wheel

Page 7: Introduction to Genetic algorithm

Concept : Selects genes from parent chromosomes, combines them and creates a new offspring.Idea : New chromosome may be better than both of the parents if it takes the best characteristics from each of them

Consider the two parents selected for crossover.

Interchange the parents chromosomes after crossover points.

The offsprings produced are :

crossover

Single –point crossover

Page 8: Introduction to Genetic algorithm

Concept : Mutation alters one or more gene values in a chromosome from its initial state.

The mutation operator simply inverts the value of the chosengene i.e. 0 goes to 1 and 1 goes to 0.Consider the two original off springs selected for mutation.

The Mutated Off-spring produced are :

mutation

Flip bit

Page 9: Introduction to Genetic algorithm

suppose that l (string length) is 8, that ƒ(x) is equal to the numberof ones in bit string x, n(the population size)is 4, that pc = 0.7, and that pm = 0.001

The initial (randomly generated) population might look like this:

Step1: Select the parent by using Roulette wheel .Here n=4 so the wheel is rotated 4 times let parent B,C be selected in first two spins and B,D be selected in the next two

Step2: Once a pair of parents is selected, with probability pc they cross over to form two offspring. If they do not cross over, then the offspring are exact copies of each parent.

example

Page 10: Introduction to Genetic algorithm

Suppose, in the example above, that parents B and D cross over after the first bit position to form offspring E = 10110100 and F = 01101110, parents B and C do not cross over, instead forming offspring that are exact copies of B and C.Step3: Next, each offspring is subject to mutation at each locus with probability pm. For example, suppose offspring E is mutated at the sixth locus to form E' = 10110000, offspring F and C are not mutated at all, and offspring B is mutated at the firstlocus to form B' = 01101110. The new population will be the following:

In the new population, although the best string was lost, the average fitness rose from 12/4 to 14/4. Iterating this procedure will eventually result in a string with all ones.

Page 11: Introduction to Genetic algorithm

Solution Space is explored in multiple directionsNonlinear problems -Large Solution space, but GA are ideal.Works on complex landscape (discontinuous, noisy, changing with time) Dilemma of global optimum vs many local optima. GA strike perfect balanceGA can manipulate many parameters simultaneously .GA don't have specific knowledge of problem. All possible search pathways are considered in GA.

advantages

Page 12: Introduction to Genetic algorithm

Computationally expensive and time consumingIssues in representation of problemProper writing of fitness functionProper values of size of population, crossover and mutation ratePremature Convergence

disadvantages