Skip to main content

non_dominated_sort

Function non_dominated_sort 

Source
pub fn non_dominated_sort(points: &[Vec<f64>]) -> Vec<Vec<usize>>
Expand description

Fast non-dominated sorting.

Returns a list of fronts, where each front is a Vec<usize> of indices into points. Front 0 contains the non-dominated set; front 1 contains points dominated only by front 0, and so on.

This implements the O(MN²) algorithm from Deb et al. (2002).

§Arguments

  • points - Slice of objective vectors. Each inner Vec<f64> must have the same length (number of objectives).

§Returns

Vector of fronts; result[0] = Pareto-optimal indices, etc.

§Examples

use scirs2_optimize::multiobjective::indicators::non_dominated_sort;
let pts = vec![vec![1.0,2.0], vec![2.0,1.0], vec![3.0,3.0]];
let fronts = non_dominated_sort(&pts);
assert_eq!(fronts[0].len(), 2); // (1,2) and (2,1) are non-dominated
assert_eq!(fronts[1].len(), 1); // (3,3) dominated