The basic flow of a genetic algorithm
The main stages of the basic genetic algorithm flow are shown in the following flowchart:
Figure 2.1: The basic flow of a genetic algorithm
These stages are described in detail in the following sections.
Creating the initial population
The initial population is a set of valid candidate solutions (individuals) that are chosen randomly. Since genetic algorithms use a chromosome to represent each individual, the initial population is a set of chromosomes. These chromosomes should conform to the chromosome format that we chose for the problem at hand – for example, binary strings of a certain length.
Calculating the fitness
The value of the fitness function is calculated for each individual. This is done once for the initial population, and then for every new generation after applying the genetic operators of selection, crossover, and mutation. As the fitness of each individual is independent of the...