code: def test_dominates_2d() -> None:
      directions = [StudyDirection.MINIMIZE, StudyDirection.MAXIMIZE]
  
      # Check all pairs of trials consisting of these values, i.e.,
      # [-inf, -inf], [-inf, -1], [-inf, 1], [-inf, inf], [-1, -inf], ...
      # These values should be specified in ascending order.
      vals = [-float("inf"), -1, 1, float("inf")]
  
      # The following table illustrates an example of dominance relations.
      # "d" cells in the table dominates the "t" cell in (MINIMIZE, MAXIMIZE) setting.
      #
      #                        value1
      #        ╔═════╤═════╤═════╤═════╤═════╗
      #        ║     │ -∞  │ -1  │  1  │  ∞  ║
      #        ╟─────┼─────┼─────┼─────┼─────╢
      #        ║ -∞  │     │     │  d  │  d  ║
      #        ╟─────┼─────┼─────┼─────┼─────╢
      #        ║ -1  │     │     │  d  │  d  ║
      # value0 ╟─────┼─────┼─────┼─────┼─────╢
      #        ║  1  │     │     │  t  │  d  ║
      #        ╟─────┼─────┼─────┼─────┼─────╢
      #        ║  ∞  │     │     │     │     ║
      #        ╚═════╧═════╧═════╧═════╧═════╝
      #
      # In the following code, we check that for each position of "t" cell, the relation
      # above holds.
  
      # Generate the set of all possible indices.
      all_indices = set(
          (i, j) for i in range(len(vals)) for j in range(len(vals))
      )
      for t_i, t_j in all_indices:
          # Generate the set of all indices that dominates the current index.
          dominating_indices = set(
              (d_i, d_j)
              for d_i in range(t_i + 1)
              for d_j in range(t_j, len(vals))
          )
          dominating_indices -= {(t_i, t_j)}
  
          for d_i, d_j in dominating_indices:
              trial1 = create_trial(values=[vals[t_i], vals[t_j]])
              trial2 = create_trial(values=[vals[d_i], vals[d_j]])
              assert _dominates(trial2, trial1, directions)
  
          for d_i, d_j in all_indices - dominating_indices:
              trial1 = create_trial(values=[vals[t_i], vals[t_j]])
              trial2 = create_trial(values=[vals[d_i], vals[d_j]])
              assert not _dominates(trial2, trial1, directions)
  
file_path: optuna/tests/study_tests/test_multi_objective.py
imports: import pytest
  from optuna.study import StudyDirection
  from optuna.study._multi_objective import _dominates
  from optuna.trial import create_trial
  from optuna.trial import TrialState
label_desc: Use image node_id 3 for calling a global function with example usage: test_dominates_2d() without return types