A genetic algorithm is an optimisation heuristic inspired from the mechanism of Darwin’s natural evolution. It leverages the process of natural selection to select individuals that are fittest to survive to the next generation.
Let’s introduce some definitions:
- Population: group of individuals.
- Generation: a reset of the population.
- Individuals (= chromosomes): one possible solution to the problem
- Design parameters (= genes): the parameters to optimise. Each individual is defined by a list of its design parameters.
- Objective function (= fitness function): the function to minimise.
- Design space: set of all the possible design parameters values.
- Objective space: set of all the objective function value.
- Parents: individuals belonging to an older generation.
- Offspring: individual belonging to a younger generation.
- Crossover: it consists in combining the genes of two parents to create an offspring
- Mutation: it consists in altering a few genes of a parent to create an offspring.
The genetic algorithm is one of the most famous evolutionary algorithm.
A Python implementation of a simple genetic algorithm can be found here. The objective is to find the minimum of this objective function:
There are 2 design parameters (x and y) and one objective, Z(x, y).