feat(algorithms): add NSGA-II

Standard (μ+λ) NSGA-II with binary tournament parent selection on
(rank, crowding distance) and elitist survival selection on the combined
parent + offspring population (spec §12.3):

1. Initialize population_size random decisions.
2. Each generation: select parents by binary tournament (rank ↑ then
   crowding ↓ then random), apply variation, evaluate offspring,
   combine, non_dominated_sort, fill the next population front-by-front
   trimming the partial last front by crowding distance descending.
3. Return final population, Pareto front, best (None for >1 objective),
   evaluation count, and generation count.

Internal Nsga2Entry { candidate, rank, crowding_distance } stays
private. Panics with clear messages on `population_size == 0` or
empty `vary` output. Tests cover population length, evaluation count,
non-empty front, and full determinism with the same seed (spec §18.4).
This commit is contained in:
2026-05-04 19:24:41 -06:00
parent bb3a01f90e
commit 33a927d86d
3 changed files with 274 additions and 1 deletions
+3 -1
View File
@@ -18,4 +18,6 @@ pub use crate::pareto::{
pub use crate::operators::{BitFlipMutation, GaussianMutation, RealBounds, SwapMutation};
pub use crate::algorithms::{Paes, PaesConfig, RandomSearch, RandomSearchConfig};
pub use crate::algorithms::{
Nsga2, Nsga2Config, Paes, PaesConfig, RandomSearch, RandomSearchConfig,
};