Genetic Algorithm
Genetic Algorithm
Genetic Algorithm
Genetic Algorithms are the optimization techniques that
mimic the process of natural evolution.
Professor John Holland of the University of Michigan,
envisaged the concept of these algorithms
S.No String
1 1 0 1 1 1
2 0 0 1 1 0
3 0 1 0 0 1
4 1 1 0 1 0
5 0 1 1 1 0
Fitness Function
A fitness value can be assigned to evaluate the solutions
A fitness function value quantifies the optimality of a
solution.
The value is used to rank a particular solution against all
the other solutions
GAs are naturally suitable for solving maximization
problems.
Minimization problems are usually transformed into
maximization problems by some suitable transformation.
Fitness function
For maximization problems, the fitness function can be
considered to be the same as the objective function or F(x)
= f(x).
For minimization problems, the fitness function is an
equivalent maximization problem chosen such that the
optimum point remains unchanged.
A number of such transformations are possible. The
following fitness function is often used: F(x)= 1/(1+f(x)).
This transformation does not alter the location of the
minimum, but converts a minimization problem to an
equivalent maximization problem.
The fitness function value of a string is known as the
string’s fitness.
GA Operator
Reproduction
Crossover
Mutation
Reproduction
The process that determines which solutions are to be
preserved and allowed to reproduce and which ones
deserve to die out. (This is also called selection process)
The primary objective of the reproduction operator is to
emphasize the good solutions
Eliminate the bad solutions in a population while keeping
the population size constant by making multiple copies of
good solution.
Reproduction operator
The commonly-used reproduction operator is the
proportionate reproduction operator where a string is
selected for the mating pool with a probability proportional
to its fitness.
Thus, the i-th string in the population is selected with a
probability proportional to Fi.
Since the population size is usually kept fixed in a simple
GA, the sum of the probability of each string being
selected for the mating pool must be one.
Therefore, the probability for selecting the i-th string is
Fi
pi n
Fj
j 1
Roulette-Wheel
One way to implement this selection scheme is a roulette-
wheel with it’s circumference marked for each string
proportionate to the string’s fitness.
the circumference of the wheel is marked according to a
string’s fitness,
This roulette-wheel mechanism is expected to make
copies of the i-th string in the mating pool.
F
The average fitness of the population is calculated as i
F
n Fi
F
i 1 n
Reproduction operator
F
The probability of selecting a string pi can be calculated. pi n
Thereafter, the cumulative probability (Pi) of each string j 1
2 0 0 1 1 0 0.2
0.3
3 0 1 0 0 1
0.6
4 1 1 0 1 0
0.8
5 0 1 1 1 0 0.9
Crossover
In reproduction, good strings in a population are
probabilistically assigned a larger number of copies and
a mating pool is formed. No new strings are formed in
the reproduction phase.
In the crossover operator, new strings are created by
exchanging information among strings of the mating
pool.
In crossover operators, two strings are picked from the
mating pool at random and some portions of the strings
are exchanged between the strings.
A single point crossover operator is performed by
randomly choosing a crossing site along the string and
by exchanging all bits on the right side of the crossing
site
The two strings participating in the crossover operation are
known as parent strings and the resulting strings are known
as children strings.
If an appropriate site is chosen good substrings are formed
With random site, the children strings produced may or may
not have a combination of good substrings from parent
strings, depending on whether or not the crossing site falls in
the appropriate place.
if good strings are created by crossover, there will be more
copies of them in the next mating pool generated by the
reproduction operator.
But if good strings are not created by crossover, they
will not survive too long, because reproduction will
select against those strings in subsequent generations.
The effect of crossover may be detrimental or beneficial.
Thus, in order to preserve some of the good strings that
are already present in the mating pool, not all strings in
the mating pool are used in crossover.
When a crossover probability of pc is used, only 100pc
per cent strings in the population are used in the
crossover operation and 100(1−pc) per cent of the
population remains as they are in the current population.
Mutation
A crossover operator is mainly responsible for the search
of new strings, even though a mutation operator is also
used for this purpose sparingly.
The mutation operator changes 1 to 0 and vice versa with a
small mutation probability, pm.
The bit-wise mutation is performed by choosing a random
no between 0 and 1.
If random no is below pm then the bit is altered; otherwise
the bit is kept unchanged.
The need for mutation is to create a point in the
neighbourhood of the current point, thereby achieving a
local search around the current solution.
Before mutation
After mutation
1 0 1 0 1 0 1 1
0 1 1 0 1 1 1 0
0 1 1 1 0 1 0 1
Summary of GA Operators
The reproduction operator selects good strings.
Crossover operator recombines good substrings from
good strings together to hopefully create a better substring.
The mutation operator alters a string locally to hopefully
create a better string.
Even though none of these claims are guaranteed and/or
tested while creating a string.
If bad strings are created they will be eliminated by the
reproduction operator in the next generation
If good strings are created, they will be increasingly
emphasized.
Differences between GAs and
Traditional Methods
GAs work with a string-coding of variables
instead of the variables.
The most striking difference between GAs and
many traditional optimization methods is that
GAs work with a population of points instead of
a single point.
Because there are more than one string being
processed simultaneously, it is very likely that
the expected GA solution may be a global
solution
GA doesn’t require gradient information
x1 x2 l n
L 0 0 2 6
U 6 6
Random
S.No Substing -1 Substring-2 number
1 1 1 1 1
D
2 0 0 0 0 0.4
3 0 1 1 0 0.1
0.5
4 1 0 1 0
0.7
5 1 0 1 1 0.5
6 0 0 0 0 0.9
x1 x2 l n r
L 0 0 3 5 1
U 0.3 0.3