Module genevo::ga

source · []
Expand description

This module provides an algorithm::Algorithm which implements the genetic algorithm (GA).

The stages of the basic genetic algorithm are:

  1. Initialize: Generate random population of n genotypes (or chromosomes)
  2. Fitness: Evaluate the fitness of each genotype in the population
  3. 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 configured operator::CrossoverOp. 3.3. Mutation: With a mutation probability mutate new offspring at each locus (position in genotype) by means of the configured operator::MutationOp. 3.4. Accepting: Place new offspring in the new population.
  4. Replace: Use new generated population for a further run of the algorithm.
  5. Termination: If the end condition is satisfied, stop, and return the best solution in current population.
  6. 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.

Functions