code: def get_pareto_optimal_parameters(
      experiment: Experiment,
      generation_strategy: GenerationStrategy,
      optimization_config: Optional[OptimizationConfig] = None,
      trial_indices: Optional[Iterable[int]] = None,
      use_model_predictions: bool = True,
  ) -> Dict[int, Tuple[TParameterization, TModelPredictArm]]:
      """Identifies the best parameterizations tried in the experiment so far,
      using model predictions if ``use_model_predictions`` is true and using
      observed values from the experiment otherwise. By default, uses model
      predictions to account for observation noise.
  
      NOTE: The format of this method's output is as follows:
      { trial_index --> (parameterization, (means, covariances) }, where means
      are a dictionary of form { metric_name --> metric_mean } and covariances
      are a nested dictionary of form
      { one_metric_name --> { another_metric_name: covariance } }.
  
      Args:
          experiment: Experiment, from which to find Pareto-optimal arms.
          generation_strategy: Generation strategy containing the modelbridge.
          optimization_config: Optimization config to use in place of the one stored
              on the experiment.
          trial_indices: Indices of trials for which to retrieve data. If None will
              retrieve data from all available trials.
          use_model_predictions: Whether to extract the Pareto frontier using
              model predictions or directly observed values. If ``True``,
              the metric means and covariances in this method's output will
              also be based on model predictions and may differ from the
              observed values.
  
      Returns:
          A mapping from trial index to the tuple of:
          - the parameterization of the arm in that trial,
          - two-item tuple of metric means dictionary and covariance matrix
              (model-predicted if ``use_model_predictions=True`` and observed
              otherwise).
      """
      optimization_config = (
          optimization_config or experiment.optimization_config
      )
      if optimization_config is None:
          raise ValueError(
              "Cannot identify the best point without an optimization config, but no "
              "optimization config was provided on the experiment or as an argument."
          )
  
      # Validate aspects of the experiment: that it is a MOO experiment and
      # that the current model can be used to produce the Pareto frontier.
      if not optimization_config.is_moo_problem:
          raise UnsupportedError(
              "Please use `get_best_parameters` for single-objective problems."
          )
  
      moo_optimization_config = checked_cast(
          MultiObjectiveOptimizationConfig, optimization_config
      )
  
      # Use existing modelbridge if it supports MOO otherwise create a new MOO modelbridge
      # to use for Pareto frontier extraction.
      modelbridge = generation_strategy.model
      is_moo_modelbridge = (
          modelbridge
          and isinstance(modelbridge, TorchModelBridge)
          and checked_cast(TorchModelBridge, modelbridge).is_moo_problem
      )
      if is_moo_modelbridge:
          generation_strategy._fit_current_model(data=None)
      else:
          modelbridge = Models.MOO(
              experiment=experiment,
              data=checked_cast(
                  Data,
                  experiment.lookup_data(trial_indices=trial_indices),
              ),
          )
      modelbridge = checked_cast(TorchModelBridge, modelbridge)
  
      # If objective thresholds are not specified in optimization config, extract
      # the inferred ones if possible or infer them anew if not.
      objective_thresholds_override = None
      if not moo_optimization_config.objective_thresholds:
          lgr = generation_strategy.last_generator_run
          if (
              lgr
              and lgr.gen_metadata
              and "objective_thresholds" in lgr.gen_metadata
          ):
              objective_thresholds_override = lgr.gen_metadata[
                  "objective_thresholds"
              ]
          objective_thresholds_override = (
              modelbridge.infer_objective_thresholds(
                  search_space=experiment.search_space,
                  optimization_config=optimization_config,
                  fixed_features=None,
              )
          )
          logger.info(
              f"Using inferred objective thresholds: {objective_thresholds_override}, "
              "as objective thresholds were not specified as part of the optimization "
              "configuration on the experiment."
          )
  
      pareto_util = (
          predicted_pareto if use_model_predictions else observed_pareto
      )
      pareto_optimal_observations = pareto_util(
          modelbridge=modelbridge,
          optimization_config=moo_optimization_config,
          objective_thresholds=objective_thresholds_override,
      )
  
      # Insert observations into OrderedDict in order of descending individual
      # hypervolume, formated as
      # { trial_index --> (parameterization, (means, covariances) }
      res: Dict[
          int, Tuple[TParameterization, TModelPredictArm]
      ] = OrderedDict()
      for obs in pareto_optimal_observations:
          res[int(not_none(obs.features.trial_index))] = (
              obs.features.parameters,
              (obs.data.means_dict, obs.data.covariance_matrix),
          )
  
      return res
  
imports: from collections import OrderedDict
  from functools import reduce
  from logging import Logger
  from typing import Dict, Iterable, List, Optional, Tuple, Type
  import pandas
  import torch
  from ax.core.base_trial import TrialStatus
  from ax.core.batch_trial import BatchTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.objective import MultiObjective, Objective, ScalarizedObjective
  from ax.core.observation import Observation
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, OptimizationConfig
  from ax.core.outcome_constraint import ObjectiveThreshold, OutcomeConstraint
  from ax.core.trial import Trial
  from ax.core.types import ComparisonOp, TModelPredictArm, TParameterization
  from ax.exceptions.core import UnsupportedError, UserInputError
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.cross_validation import assess_model_fit, compute_diagnostics, cross_validate
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.modelbridge.modelbridge_utils import observed_pareto_frontier, predicted_pareto_frontier
  from ax.modelbridge.registry import get_model_from_generator_run, ModelRegistryBase, Models
  from ax.modelbridge.torch import TorchModelBridge
  from ax.modelbridge.transforms.utils import derelativize_optimization_config_with_raw_status_quo
  from ax.plot.pareto_utils import get_tensor_converter_model
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast, not_none
  from numpy import NaN
  from torch import Tensor
label_desc: Use image node_id 11 for calling a global function with example usage: get_pareto_optimal_parameters(experiment, generation_strategy, optimization_config, trial_indices, use_model_predictions) and returns: res