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
+4 -4
View File
@@ -22,8 +22,8 @@ pub use crate::operators::{
};
pub use crate::algorithms::{
DifferentialEvolution, DifferentialEvolutionConfig, HillClimber, HillClimberConfig,
Moead, MoeadConfig, Nsga2, Nsga2Config, Nsga3, Nsga3Config, Paes, PaesConfig,
RandomSearch, RandomSearchConfig, SimulatedAnnealing, SimulatedAnnealingConfig,
Spea2, Spea2Config,
DifferentialEvolution, DifferentialEvolutionConfig, GeneticAlgorithm,
GeneticAlgorithmConfig, HillClimber, HillClimberConfig, Moead, MoeadConfig, Nsga2,
Nsga2Config, Nsga3, Nsga3Config, Paes, PaesConfig, RandomSearch, RandomSearchConfig,
SimulatedAnnealing, SimulatedAnnealingConfig, Spea2, Spea2Config,
};