The genetic algorithm reflects the process of natural selection where the fittest individuals are selected for reproduction in order to produce offspring of the next generation.
3. Introduction to Genetic Algorithm
Genetic algorithm reflects the process of natural selection where the fittest individuals
are selected for reproduction in order to produce offspring of the next generation.
Used: In real-life applications such as
• data centers
• electronic circuit design
• code-breaking
• image processing and
• artificial creativity.
4. Five phases a genetic algorithm.
1. Initial population
2. Fitness function
3. Selection
4. Crossover
5. Mutation
6. Working Principle
Fitness Function: This is the function that determines the fitness of an individual.
Selection: Two pairs of individuals (parents) are selected based on their fitness scores…
8. Working Principle
Mutation: In certain new offspring formed, some of their genes can be subjected to a mutation with a
low random probability.
Termination: The algorithm terminates if the population has converged.
9. Numerical Example
Maximize the function f(x)=x^2 .
Step1: encoding
Step2: population size
Step3: initial population
0
31 1 1 1 1 1
0 0 0 0 0
n = 4
13, 24, 8, 19
10. Numerical Example
Step4: Select parental chromosomes
String
No.
Initial
population
X
Value
F(x) = x^2 Probability
Count
F(x)/total
Expected
Count
Actual
value
1 01101 13 169 0.14 0.58 1
2 11000 24 576 0.49 1.97 2
3 01000 8 64 0.06 0.22 0
4 10011 19 361 0.31 1.23 1
Total = 1170
Average = 292.5
T. P = 1 T. Ec = 4
11. Numerical Example
Step : 5 Crossover and mutation
Cross point New Children
Parental Combination 1
String 2 1 1 0 0 0 1 1 0 0 1
String 1 0 1 1 0 1 0 1 1 0 0
Cross point New Children
Parental Combination 2
String 2 1 1 0 0 0 1 1 0 1 1
String 1 1 0 0 1 1 1 0 0 0 0
12. Numerical Example
Step:5 Evaluating new spring
Thus, inherently the new population is better than the previous one leading to a
better solution.
String no Offspring X value F(x) value
1 01100 12 144
2 11001 25 625
3 11011 27 729
4 10000 10 256