Genetic Algorithms by KVK
Genetic Algorithms by KVK
1
Description
3
Description
4
Description
• GAs work with a coding of the parameter set and not on the
parameter themselves.
• GAs search from a population of points and not from a single point
and move parallel.
• GAs are probabilistic transition rules and not deterministic rules and
uses random stochastic nature.
5
2.
Components
of GA
2
Components of a GA
• Population generation
• Encoding technique (gene, chromosome)
7
Components of a GA
Initial Generation
Encoding
Fitness
Next
Selection
Generation
Mutation Crossover
8
Population generation
9
Let us consider an example in which we need to find the optimum
solution of F(X1,X2) .
10
Encoding
11
Initial population
• 9 13
X1 X2
1001 1101
10011101
1 Complete Population
12
Initial Generation
Combinations of possible numbers taken randomly
1 1 0 1 1 0 1 0
0 1 1 1 1 0 1 1
1 1 1 0 1 0 1 0
0 0 0 1 1 0 1 0
0 0 1 1 0 0 0 1
1 1 0 1 1 0 0 0
1 0 1 0 1 0 1 1
1 1 1 0 0 0 1 0
1 0 1 0 0 0 1 0
0 1 1 1 1 0 1 1
13
3. Fitness
function and
Selection
3
Fitness function
15
Fitness function
10011101
In this way, the fitness values of all the populations are calculated .
16
Selection
The selection function choses parent for the next generation based on
their scaled values from the fitness scaling function.
There are several methods for Selection.
17
Selection
18
Selection
Tournament Selection
In K-Way tournament selection, we select K individuals from the
population at random and select the best out of these to become a
parent. The same process is repeated for selecting the next parent.
Tournament Selection is also extremely popular in literature as it can
even work with negative fitness values.
19
Selection
Before Selection After Selection
1 1 0 1 1 0 1 0 1 1 1 0 1 0 1 0
0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 1
1 1 1 0 1 0 1 0 0 0 1 1 0 0 0 1
0 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1
0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 1
1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0
1 0 1 0 1 0 1 1 0 0 1 1 0 0 0 1
1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 1
1 0 1 0 0 0 1 0 1 1 0 1 1 0 0 0
0 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0
We can see that some of the strings are repeated which have greater fitness values.
20
4. Crossover
& Mutation
4
Crossover
Crossover Operators
• In this section we will discuss some of the most popularly used
crossover operators. It is to be noted that these crossover operators
are very generic and the GA Designer might choose to implement a
problem-specific crossover operator as well.
22
Crossover
23
Crossover
24
Crossover
Uniform Crossover
• In a uniform crossover, we don’t divide the chromosome into
segments, rather we treat each gene separately. In this, we essentially
flip a coin for each chromosome to decide whether or not it’ll be
included in the off-spring. We can also bias the coin to one parent, to
have more genetic material in the child from that parent.
25
Crossover
Before Crossover
1 1 1 0 1 0 1 0
0 0 1 1 0 0 0 1
After Crossover
1 1 1 1 0 0 0 1
0 0 1 0 1 0 1 0
26
Mutation
27
Mutation
Swap Mutation
• In swap mutation, we select two positions on the chromosome at
random, and interchange the values. This is common in permutation
based encodings.
28
Mutation
0 0 1 1 0 0 0 1
0 0 0 1 0 0 0 1
29
5. Survivors
&
Termination
5
Survivor Selection
• The Survivor Selection Policy determines which individuals are to be
kicked out and which are to be kept in the next generation. It is
crucial as it should ensure that the fitter individuals are not kicked out
of the population, while at the same time diversity should be
maintained in the population.
• Age Based Selection: in Age-Based Selection, we don’t have a notion
of a fitness. It is based on the premise that each individual is allowed
in the population for a finite generation where it is allowed to
reproduce, after that, it is kicked out of the population no matter how
good its fitness is.
• Fitness Based Selection: In this fitness based selection, the children
tend to replace the least fit individuals in the population.
31
Termination Condition
32
Application
Domain Application Types
Control gas pipeline, pole balancing, missile evasion, pursuit
33
Genetic Programming