code: def test_doc_multiobjective() -> None:
      # DOC_MULTIOBJ_OPT_0
      import nevergrad as ng
      import numpy as np
  
      def multiobjective(x):
          return [np.sum(x**2), np.sum((x - 1) ** 2)]
  
      print("Example: ", multiobjective(np.array([1.0, 2.0, 0])))
      # >>> Example: [5.0, 2.0]
  
      optimizer = ng.optimizers.CMA(parametrization=3, budget=100)
  
      # for all but DE optimizers, deriving a volume out of the losses,
      # it's not strictly necessary but highly advised to provide an
      # upper bound reference for the losses (if not provided, such upper
      # bound is automatically inferred with the first few "tell")
      optimizer.tell(ng.p.MultiobjectiveReference(), [5, 5])
      # note that you can provide a Parameter to MultiobjectiveReference,
      # which will be passed to the optimizer
  
      optimizer.minimize(multiobjective, verbosity=2)
  
      # The function embeds its Pareto-front:
      print("Pareto front:")
      for param in sorted(
          optimizer.pareto_front(), key=lambda p: p.losses[0]
      ):
          print(f"{param} with losses {param.losses}")
  
      # >>> Array{(3,)}:[0. 0. 0.] with loss [0. 3.]
      #     Array{(3,)}:[0.39480968 0.98105712 0.55785803] with loss [1.42955333 0.56210368]
      #     Array{(3,)}:[1.09901515 0.97673712 0.97153943] with loss [3.10573857 0.01115516]
  
      # It can also provide subsets:
      print(
          "Random subset:", optimizer.pareto_front(2, subset="random")
      )
      print(
          "Loss-covering subset:",
          optimizer.pareto_front(2, subset="loss-covering"),
      )
      print(
          "Domain-covering subset:",
          optimizer.pareto_front(2, subset="domain-covering"),
      )
      print("EPS subset:", optimizer.pareto_front(2, subset="EPS"))
  
      # DOC_MULTIOBJ_OPT_1
      assert len(optimizer.pareto_front()) > 1
      assert len(optimizer.pareto_front(2, "loss-covering")) == 2
      assert len(optimizer.pareto_front(2, "domain-covering")) == 2
      assert len(optimizer.pareto_front(2, "hypervolume")) == 2
      assert len(optimizer.pareto_front(2, "random")) == 2
      assert len(optimizer.pareto_front(2, "EPS")) == 2
  
file_path: nevergrad/nevergrad/optimization/multiobjective/test_core.py
imports: import warnings
  from unittest import SkipTest
  import numpy
  import pytest
  import nevergrad.common.typing
  import nevergrad
  from ..None import base
  from ..optimizerlib import registry
  from .None import core
label_desc: Use image node_id 6 for calling a global function with example usage: test_doc_multiobjective() and returns: list