code: def test_fast_non_dominated_ranking() -> None:
      params = ng.p.Tuple(
          ng.p.Scalar(lower=0, upper=2), ng.p.Scalar(lower=0, upper=2)
      )
  
      loss_values = [
          [[0.0, 2.0], [1.0, 1.0]],
          [[0.0, 4.0], [1.0, 3.0], [3.0, 1.0]],
          [[2.0, 3.0], [4.0, 2.0]],
      ]
  
      candidates: tp.List[p.Parameter] = []
      expected_frontiers = []
      for vals in loss_values:
          expected_frontier = []
          for v in vals:
              candidate = params.spawn_child().set_standardized_data(v)
              candidate._losses = np.array(v)
              candidates.append(candidate)
              expected_frontier.append(candidate)
          expected_frontiers.append(expected_frontier)
  
      ranking_method = nsga2.FastNonDominatedRanking()
      frontiers = ranking_method.compute_ranking(candidates)
      assert set(frontiers[0]) == set(expected_frontiers[0])
      assert set(frontiers[1]) == set(expected_frontiers[1])
      assert set(frontiers[2]) == set(expected_frontiers[2])
  
file_path: nevergrad/nevergrad/optimization/multiobjective/test_nsga2.py
imports: import random
  import numpy
  import nevergrad
  import nevergrad.common.typing
  from nevergrad.parametrization import parameter
  from .None import nsga2
label_desc: Use image node_id 2 for calling a global function with example usage: test_fast_non_dominated_ranking() without return types