code: def test_incumbents_highest_observed_budget(
      make_scenario, configspace_small, make_config_selector
  ):
      """Tests whether the incumbent is updated correctly."""
      scenario: Scenario = make_scenario(
          configspace_small,
          use_instances=False,
          min_budget=1,
          max_budget=3,
      )
      runhistory = RunHistory()
      intensifier = SuccessiveHalving(
          scenario=scenario,
          eta=3,
          n_seeds=1,
          instance_seed_order=None,
          incumbent_selection="highest_observed_budget",
      )
      intensifier.config_selector = make_config_selector(
          scenario, runhistory, n_initial_configs=1
      )
      intensifier.runhistory = runhistory
      intensifier.__post_init__()
      config = configspace_small.get_default_configuration()
      config2 = configspace_small.sample_configuration(1)
  
      # Add some entries to the runhistory
      runhistory.add(
          config=config,
          cost=0.5,
          time=0.0,
          seed=8,
          budget=1,
          status=StatusType.SUCCESS,
      )
      intensifier.update_incumbents(config)
      assert intensifier.get_incumbent() == config
      assert intensifier.get_instance_seed_budget_keys(config) == [
          InstanceSeedBudgetKey(instance=None, seed=8, budget=1.0)
      ]
  
      # TODO: We actually want to prioritze configs evaluated on higher budgets
      # Not working yet
      runhistory.add(
          config=config2,
          cost=0.5,
          time=0.0,
          seed=8,
          budget=1,
          status=StatusType.SUCCESS,
      )
      intensifier.update_incumbents(config2)
      assert intensifier.get_incumbent() == config
      assert intensifier.get_instance_seed_budget_keys(config2) == [
          InstanceSeedBudgetKey(instance=None, seed=8, budget=1.0)
      ]
  
      # If we evaluate on a higher budget, we don't want to use the lower budget anymore
      runhistory.add(
          config=config2,
          cost=0.0,
          time=0.0,
          seed=8,
          budget=2,
          status=StatusType.SUCCESS,
      )
      intensifier.update_incumbents(config2)
      assert intensifier.get_incumbent() == config2
      assert intensifier.get_instance_seed_budget_keys(config2) == [
          # We don't want InstanceSeedBudgetKey(instance=None, seed=8, budget=1.0) anymore
          # That means, we only calculate the cost based on the highest observed budget
          InstanceSeedBudgetKey(instance=None, seed=8, budget=2.0),
      ]
  
file_path: SMAC3/tests/test_intensifier/test_successive_halving.py
imports: import pytest
  from smac.initial_design.random_design import RandomInitialDesign
  from smac.intensifier.successive_halving import SuccessiveHalving
  from smac.main.config_selector import ConfigSelector
  from smac.runhistory.dataclasses import InstanceSeedBudgetKey
  from smac.runhistory.enumerations import StatusType
  from smac.runhistory.runhistory import RunHistory
  from smac.scenario import Scenario
label_desc: Use image node_id 7 for calling a global function with example usage: test_incumbents_highest_observed_budget(make_scenario, configspace_small, make_config_selector) without return types