Skip to main content

recompute_crowding_distance_per_front

Function recompute_crowding_distance_per_front 

Source
pub fn recompute_crowding_distance_per_front<G: EvolutionaryGenome>(
    population: &mut [Nsga2Individual<G>],
)
Expand description

Recompute crowding distance for every non-dominated front separately.

Crowding distance is only defined within a single front (Deb et al. 2002, Section III-B): the neighbours and the per-objective min/max range must be taken from members of the same rank. Groups population indices by rank (already assigned by fast_non_dominated_sort) and calls calculate_crowding_distance once per front.

Computing crowding over the whole mixed-rank population instead (the former behaviour, EV-13) interleaves individuals of different fronts, so a member’s neighbours and the range come from the wrong front — corrupting the values read by binary-tournament parent selection and reported to callers.