Planning & Search in Rust
Esc

Loading…

↑↓ move ↵ open Esc close
Colour theme
All algorithms

Genetic Algorithm

Also known as GA, Steady-state GA, Generational GA

optimization evolutionary-planning

A genetic algorithm (GA) searches over any kind of candidate solution, the genome, for one with low cost. It keeps a population, picks parents by a selection scheme that prefers cheap genomes (for example a tournament), combines two parents by crossover, changes the children at random by mutation, and may repair children that break constraints. A generational GA replaces the whole population each generation but copies the best few unchanged (elitism); a steady-state GA puts each new child in place of the worst individual. The operators carry the problem knowledge, so the same loop works for bit strings, real vectors, permutations, paths or plans. It is a heuristic: it gives the best solution found within the budget, with no optimality guarantee.

Pseudocode

algorithm GA(N, e, p-cross, p-mut, f)input: population size N, elites e, crossover and mutation rates, cost function foutput: the best genome found when the budget endsP ← N genomes from initialize(), each evaluated by frepeatP′ ← the e cheapest members of P              ▷ elitismwhile |P′| < N doa, b ← select(P, 2)if random() < p-cross thenc₁, c₂ ← crossover(a, b)elsec₁, c₂ ← a, bfor each c in ⟨c₁, c₂⟩ doif random() < p-mut thenmutate(c)repair(c)add (c, f(c)) to P′P ← P′until budget exhaustedreturn the cheapest genome evaluatedprocedure SteadyStateStep(P)a, b ← select(P, 2)for each c in breed(a, b) do                    ▷ crossover, mutation, repair as abovereplace the worst member of P by (c, f(c))    ▷ optionally only if cheaper

In the crates

  • evolutionary-planning

    Genetic algorithm, generational with elitism or steady state, over caller-supplied selection, crossover, mutation and repair operators.

    Ga

Lineage

Comes from

Nothing on this site.

Led to

Evolutionary Programmer builds on it

GA over SAS+ Plans specializes it

GA Path Planning specializes it

GLEAM Diffusion Model builds on it

Memetic Algorithm combines it