feat(algorithms): add GeneticAlgorithm — single-objective generational GA

Canonical generational GA with elitism: each generation runs binary
tournament selection (using `tournament_select_single_objective`) on
the current population, applies the variation operator pair-wise to
produce offspring, evaluates them, then replaces the population while
preserving the top `elitism` members from the previous generation
(elitism prevents fitness regression on a single seed).

Single-objective only. Generic over decision type — pair with
`SimulatedBinaryCrossover + PolynomialMutation` for real-valued,
single-point crossover + bit-flip for binary, etc.

Tests: convergence on Sphere1D, deterministic reruns, panic on
multi-objective, panic on `population_size < 2`, panic on
`elitism > population_size`.
This commit is contained in:
2026-05-05 09:51:11 -06:00
parent 35fbf622f2
commit f77e163ac4
3 changed files with 285 additions and 4 deletions
+2
View File
@@ -1,6 +1,7 @@
//! Built-in reference optimizers.
pub mod differential_evolution;
pub mod genetic_algorithm;
pub mod hill_climber;
pub mod moead;
pub mod nsga2;
@@ -12,6 +13,7 @@ pub mod simulated_annealing;
pub mod spea2;
pub use differential_evolution::*;
pub use genetic_algorithm::*;
pub use hill_climber::*;
pub use moead::*;
pub use nsga2::*;