1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Shared multi-objective optimisation primitives.
//!
//! ## Description
//!
//! This module hosts the building blocks shared by all multi-objective engines
//! (NSGA-II, NSGA-III, MOEA/D, SPEA2, SMS-EMOA, IBEA): non-dominated sorting,
//! Pareto individual and front types, dominance predicates, quality indicators,
//! and the `ObjectiveFn<G>` type alias.
//!
//! Every multi-objective engine re-exports these symbols for backward
//! compatibility — existing user code continues to work via paths like
//! `genetic_algorithms::nsga2::pareto::ParetoIndividual`.
//!
//! ## Sub-modules
//!
//! - **`non_dominated_sort`** — Fast non-dominated sorting
//! ([`Deb et al. 2002`](crate::nsga2::Nsga2Ga)),
//! direction-aware sorting, and constrained-sort variant. Provides
//! `assign_ranks` and `non_dominated_sort_with_directions`.
//!
//! - **`pareto`** — [`ParetoIndividual<U>`](pareto::ParetoIndividual) wrapper
//! type (chromosome + objective vector + rank + crowding distance +
//! constraint violation), [`ParetoFront<U>`](pareto::ParetoFront) container,
//! and dominance predicates (`dominates_with_directions`).
//!
//! - **`indicators`** — Quality indicators for Pareto front evaluation:
//! - [`hypervolume`](indicators::hypervolume) — Dominated hypervolume
//! (S-metric, Lebesgue measure).
//! - [`generational_distance`](indicators::generational_distance) — GD,
//! convergence metric.
//! - [`inverted_generational_distance`](indicators::inverted_generational_distance)
//! — IGD, convergence + diversity metric.
//! - [`spread`](indicators::spread) — Spread (Δ), diversity metric.
//!
//! ## Key Types
//!
//! | Type | Description |
//! |------|-------------|
//! | [`ObjectiveDirection`] | Minimize or Maximize per objective. |
//! | [`ObjectiveFn<G>`] | Closure signature `fn(&[G]) -> f64` for one objective. |
//! | [`ParetoIndividual<U>`](pareto::ParetoIndividual) | Chromosome + objective vector + rank + crowd + violation. |
//! | [`ParetoFront<U>`](pareto::ParetoFront) | Ordered collection of non-dominated individuals. |
//!
//! NSGA-II re-exports these symbols via `pub use crate::multi_objective::*`
//! for full backward compatibility — existing user code that uses paths like
//! `genetic_algorithms::nsga2::pareto::ParetoIndividual` continues to work.
/// Direction of optimization for a single objective.
///
/// This is the canonical definition. Both `nsga2::configuration` and
/// `nsga3::configuration` re-export this type for backward compatibility.
/// Type alias for a single objective function shared across multi-objective engines.
pub type ObjectiveFn<G> = dyn Fn + Send + Sync;