[−][src]Function vrp_core::algorithms::nsga2::select_and_rank
pub fn select_and_rank<'a, S: 'a>(
solutions: &'a [S],
n: usize,
multi_objective: &impl MultiObjective<Solution = S>
) -> Vec<AssignedCrowdingDistance<'a, S>>
Select n
solutions using the approach taken by NSGA2.
We first sort the solutions into their corresponding pareto fronts using a non-dominated sort
algorithm. Then, we put as many "complete" fronts into the result set, until we cannot fit in a
whole front anymore, without exceeding n
solutions in the result set. For this last front,
that does not completely fit into the result set, we sort it's solutions according to their
crowding distance (higher crowding distance is "better"), and prefer those solutions with the
higher crowding distance until we have exactly n
solutions in the result set.