Genetic Algorithm
Genetic Algorithm
Genetic Algorithm
2. Fitness Assignment
Fitness function is used to determine how fit an individual is? It means the
ability of an individual to compete with other individuals. In every iteration,
individuals are evaluated based on their fitness function. The fitness
function provides a fitness score to each individual. This score further
determines the probability of being selected for reproduction. The high the
fitness score, the more chances of getting selected for reproduction.
3. Selection
The selection phase involves the selection of individuals for the reproduction
of offspring. All the selected individuals are then arranged in a pair of two to
increase reproduction. Then these individuals transfer their genes to the
next generation.
There are three types of Selection methods available, which are:
• Roulette wheel selection
• Tournament selection
• Rank-based selection
4. Reproduction
After the selection process, the creation of a child occurs in the reproduction
step. In this step, the genetic algorithm uses two variation operators that are
applied to the parent population. The two operators involved in the
reproduction phase are given below:
• Crossover: The crossover plays a most significant role in the
reproduction phase of the genetic algorithm. In this process, a crossover
point is selected at random within the genes. Then the crossover operator
swaps genetic information of two parents from the current generation to
produce a new individual representing the offspring.
5. Termination
After the reproduction phase, a stopping criterion is applied as a base for
termination. The algorithm terminates after the threshold fitness solution is
reached. It will identify the final solution as the best solution in the
population.
General Workflow of a Simple Genetic Algorithm
Answer
Step 1-
• Encoding technique- Binary encoding
• Selection operator- Roulette Wheel Selection
• Crossover operator- Single point crossover
Step 2-
Population size (n) = 4
Step 3-
Initial population (x value) = 13, 24, 8, 19
Step 4-
We see that if the Roulette wheel is spun four times, we’ll get 24 twice and
13 and 19 once. So possible parental combinations are (24,13) and (24,19).
Step 5-
Step 6-
We can see that the maximum f(x) value has increased from 576 to 729.
Step 7-
Now we’ll take these four offsprings as parents and repeat the process until
our termination condition is not satisfied.