Expand description
This module provides an algorithm::Algorithm
which implements the genetic
algorithm (GA).
The stages of the basic genetic algorithm are:
- Initialize: Generate random population of n genotypes (or chromosomes)
- Fitness: Evaluate the fitness of each genotype in the population
- New Population: Create a new population by repeating following steps
until the new population is complete:
3.1. Selection: Select a tuple of parent genotypes from a population
according to their fitness and the selection strategy of the
configured
operator::SelectionOp
3.2. Crossover: With a crossover probability cross over the parents to form a new offspring (child) by means of the configuredoperator::CrossoverOp
. 3.3. Mutation: With a mutation probability mutate new offspring at each locus (position in genotype) by means of the configuredoperator::MutationOp
. 3.4. Accepting: Place new offspring in the new population. - Replace: Use new generated population for a further run of the algorithm.
- Termination: If the end condition is satisfied, stop, and return the best solution in current population.
- Loop: Go to step 2
Modules
Structs
A GeneticAlgorithm
declares the building blocks that make up the actual
algorithm for a specific optimization problem.
The State
struct holds the results of one pass of the genetic algorithm
loop, i.e. the processing of the evolution from one generation to the next
generation.
Enums
An error that can occur during execution of a GeneticAlgorithm
.