Genetic Algorithm-Contd
Genetic Algorithm-Contd
Genetic Algorithm
• The GA starts with a set of solutions or populations.
• Each individual in the population set represents a solution to the problem.
• Some solutions may be very good, while others are very bad.
• The goodness of the solution varies from individual to individual within the population.
• To measure the goodness of the solution, we use a function called the fitness function,
which must be made according to the program logic.
• Initially the population set contains all randomly generated solutions that are initially
generated. This is called the first generation of the population.
• Then the various genetic operators are applied over the population.
• The genetic operators help in the generation of a new population set from the old
population set.
• The new population set is formed by the genetic reproduction of the parents to form the
children.
• Various genetic operators are applied that help generate the new population set. These
specialized operators help in better optimization of the solution.
Genetic Algorithm
• In this manner, we generate higher-order generations from the lower order.
• The fitness of any solution or individual may be measured by the fitness function. A
higher value of the fitness function means better solutions.
• The fitness of the population is measured by the average fitness of all the individuals that
make up the population.
• It is observed that the fitness keeps increasing as we move forward with the algorithm.
• The higher-order generations are more fit when compared with the lower-order
generations.
• This is true for all best fitness individuals in the population
• n, average fitness in the population as well as the worst fitness in the population. The GA
results in improvisation as the generation proceeds.
• This improvisation is very rapid in the first few generations.
• After that, however, the algorithm more or less converges to some point to give the most
optimal solution to the problem
Genetic Operators
1) Selection
• The first operator applied is selection.
• Selection forms pairs of individuals that will later cross-breed to generate
individuals.
• Selection is an important step, because it decides the parents that are
responsible for the individuals being generated.
• Thus a number of strategies for the selection process have been developed.
• All try to cross-breed good solutions in the hope of generating good individuals in
the resulting populations.
• Selection is done on the basis of the individual’s reproductive capability, or fitness
value.
• An individual having a higher fitness has a high reproductive capability and thus is
likely to be selected numerous times.
Genetic Operators
2)Crossover
• It is the genetic operator that results in the mixing of two parents to
generate individuals of the new population.
• Crossover is done by taking some bits from the first parent and other bits
from the other parent.
• One of the commonly used crossovers is the single-point crossover, in
which we randomly select a point in the chromosome. The bits to the left
of this point are taken from the first parent and the bits to the right are
taken from the other parent.
• This generates new individuals in the new population.
• Crossover is motivated by the intrinsic hope to form offspring that takes
the best characteristics from the two parents.
Genetic Operators
3) Mutation
• Crossover results in the mixing of characteristics between two individuals. Many
characteristics may be completely absent in the solution pool, even if many of
those missing characteristics may have been desirable for good solutions.
• This absence may be due to the fact that these characteristics were never
generated, or that these characteristics somehow got deleted.
• The term characteristic here refers to the bits in the genotype representation.
• These characteristics need to be introduced into the population.
• Mutation is the process by which we try to introduce random characteristics into
the population.
• We do this done by flipping bits.
• A random bit in the individual is selected and is simply swapped during mutation.
• Thus if it represented 1, it now represents 0, and vice versa.
• This mutation is the characteristic that we have artificially introduced into the
system
Other Operators
Eliticism
• Eliticism selects some predefined proportion of individuals with highest
fitness from one generation and passes it straight to the next generation.
• This operator saves these high-fitness individuals from being destroyed by
crossover or mutation and makes them available in the next generation.
• This operator also ensures that the best populations will be carried
forward, which in turn ensures that the globally best individual will be
selected as the final solution.
• Without this operator, the generated individuals may be of fitness lower
than the fitness of the best fit individual of the preceding population.
• This would result in lowering the best fitness value across the two
generations.
Other Operators
Insert and Delete
• The insert operator allows the insertion of new individuals in the
population pool.
• This makes the entire algorithm flexible to accepting new individuals.
• Based on the solution, at any point, we can generate new individuals with
high fitness.
• These individuals may be added to the pool by using the insert operator.
• Similarly, the delete operator allows deletion of some individuals from the
population set.
• We may wish to delete certain individuals that have a low fitness value.
• This operator may be used in such circumstances
Other Operators -Hard and Soft Mutation