class_docstr: Tests for `BracketEVES` class..
class_docstr_tok: ["Tests","for","`","BracketEVES","`","class",".."]
docstr: Verify duplicated candidates can be found and processed correctly.
code: def test_duplicated_mutated_population(
      self, bracket: BracketEVES, rung_4: RungDict
  ):
      """Verify duplicated candidates can be found and processed correctly."""
      red_team = [0, 2]
      blue_team = [0, 2]  # no mutate occur at first.
      population_range = 4
  
      rung_trials = list(rung_4["results"].values())
      # Duplicate second item
      rung_trials.insert(2, rung_trials[1])
      for trial_index in range(4):
          objective, trial = rung_trials[trial_index]
  
          # bracket.eves.performance[trial_index] = objective
          for ith_dim in [1, 2]:
              bracket.owner.population[ith_dim][
                  trial_index
              ] = trial.params[bracket.owner.space[ith_dim].name]
  
      trials, nums_all_equal = bracket._mutate_population(
          red_team,
          blue_team,
          rung_4["results"],
          population_range,
          fidelity=2,
      )
  
      # In this case, duplication will occur, and we can make it mutate one more time.
      # The trials 1 and 2 should be different, while one of nums_all_equal should be 1.
      if trials[1].params["lr"] != trials[2].params["lr"]:
          assert (
              trials[1].params["weight_decay"]
              == trials[2].params["weight_decay"]
          )
      else:
          assert (
              trials[1].params["weight_decay"]
              != trials[2].params["weight_decay"]
          )
  
      assert nums_all_equal[0] == 0
      assert nums_all_equal[1] == 0
      assert nums_all_equal[2] == 1
      assert nums_all_equal[3] == 0
  
imports: from __future__ import annotations
  import copy
  from typing import ClassVar
  import numpy
  import pytest
  from test_hyperband import create_rung_from_points, create_trial_for_hb
  from orion.algo.evolution_es import BracketEVES, BudgetTuple, EvolutionES, compute_budgets
  from orion.algo.hyperband import RungDict
  from orion.algo.space import Fidelity, Real, Space
  from orion.core.utils import backward
  from orion.core.worker.trial import Trial
  from orion.testing.algo import BaseAlgoTests, TestPhase, _are_equal
  from orion.testing.trial import create_trial
label_desc: Use image node_id 3 for calling the TestBracketEVES obj's underlying member method code with example usage: obj.test_duplicated_mutated_population(bracket, rung_4) without return types