code: def _crowding_distance_sort(
      population: List[
          "multi_objective.trial.FrozenMultiObjectiveTrial"
      ],
  ) -> None:
      manhattan_distances = defaultdict(float)
      for i in range(len(population[0].values)):
          population.sort(key=lambda x: cast(float, x.values[i]))
  
          v_min = population[0].values[i]
          v_max = population[-1].values[i]
          assert v_min is not None
          assert v_max is not None
  
          width = v_max - v_min
          if width == 0:
              continue
  
          manhattan_distances[population[0].number] = float("inf")
          manhattan_distances[population[-1].number] = float("inf")
  
          for j in range(1, len(population) - 1):
              v_high = population[j + 1].values[i]
              v_low = population[j - 1].values[i]
              assert v_high is not None
              assert v_low is not None
  
              manhattan_distances[population[j].number] += (
                  v_high - v_low
              ) / width
  
      population.sort(key=lambda x: manhattan_distances[x.number])
      population.reverse()
  
imports: from collections import defaultdict
  import hashlib
  import itertools
  from typing import Any
  from typing import cast
  from typing import DefaultDict
  from typing import Dict
  from typing import List
  from typing import Optional
  from typing import Sequence
  from typing import Tuple
  import optuna
  from optuna import multi_objective
  from optuna._deprecated import deprecated_class
  from optuna.distributions import BaseDistribution
  from optuna.multi_objective.samplers import BaseMultiObjectiveSampler
  from optuna.samplers._lazy_random_state import LazyRandomState
label_desc: Use image node_id 2 for calling a global function with example usage: _crowding_distance_sort(population) without return types