smac.intensification.abstract_racer module

class smac.intensification.abstract_racer.AbstractRacer(tae_runner: smac.tae.execute_ta_run.ExecuteTARun, stats: smac.stats.stats.Stats, traj_logger:, rng: numpy.random.mtrand.RandomState, instances: List[str], instance_specifics: Optional[Mapping[str, numpy.ndarray]] = None, cutoff: Optional[float] = None, deterministic: bool = False, run_obj_time: bool = True, minR: int = 1, maxR: int = 2000, adaptive_capping_slackfactor: float = 1.2, min_chall: int = 1)[source]

Bases: object

Base class for all racing methods

The “intensification” is designed to be spread across multiple eval_challenger() runs. This is to facilitate on-demand configuration sampling if multiple configurations are required, like Successive Halving or Hyperband.

Note: Do not use directly

  • tae_runner (tae.executre_ta_run_*.ExecuteTARun* Object) – target algorithm run executor

  • stats (Stats) – stats object

  • traj_logger ( – TrajLogger object to log all new incumbents

  • rng (np.random.RandomState) –

  • instances (typing.List[str]) – list of all instance ids

  • instance_specifics (typing.Mapping[str,np.ndarray]) – mapping from instance name to instance specific string

  • cutoff (float) – runtime cutoff of TA runs

  • deterministic (bool) – whether the TA is deterministic or not

  • run_obj_time (bool) – whether the run objective is runtime or not (if true, apply adaptive capping)

  • minR (int) – Minimum number of run per config (summed over all calls to intensify).

  • maxR (int) – Maximum number of runs per config (summed over all calls to intensifiy).

  • adaptive_capping_slackfactor (float) – slack factor of adpative capping (factor * adpative cutoff)

  • min_chall (int) – minimal number of challengers to be considered (even if time_bound is exhausted earlier)

_adapt_cutoff(challenger: ConfigSpace.configuration_space.Configuration, run_history: smac.runhistory.runhistory.RunHistory, inc_sum_cost: float) → float[source]

Adaptive capping: Compute cutoff based on time so far used for incumbent and reduce cutoff for next run of challenger accordingly

!Only applicable if self.run_obj_time

!runs on incumbent should be superset of the runs performed for the



cutoff – Adapted cutoff

Return type


_compare_configs(incumbent: ConfigSpace.configuration_space.Configuration, challenger: ConfigSpace.configuration_space.Configuration, run_history: smac.runhistory.runhistory.RunHistory, log_traj: bool = True) → Optional[ConfigSpace.configuration_space.Configuration][source]

Compare two configuration wrt the runhistory and return the one which performs better (or None if the decision is not safe)

Decision strategy to return x as being better than y:
  1. x has at least as many runs as y

  2. x performs better than y on the intersection of runs on x and y

Implicit assumption:

Challenger was evaluated on the same instance-seed pairs as incumbent


Return type

None or better of the two configurations x,y

_log_incumbent_changes(incumbent: ConfigSpace.configuration_space.Configuration, challenger: ConfigSpace.configuration_space.Configuration) → None[source]
_next_challenger(challengers: Optional[List[ConfigSpace.configuration_space.Configuration]], chooser: Optional[smac.optimizer.epm_configuration_chooser.EPMChooser], run_history: smac.runhistory.runhistory.RunHistory, repeat_configs: bool = True) → Optional[ConfigSpace.configuration_space.Configuration][source]

Retuns the next challenger to use in intensification If challenger is None, then optimizer will be used to generate the next challenger


next challenger to use

Return type


eval_challenger(challenger: ConfigSpace.configuration_space.Configuration, incumbent: Optional[ConfigSpace.configuration_space.Configuration], run_history: smac.runhistory.runhistory.RunHistory, time_bound: float = 2147483647.0, log_traj: bool = True) → Tuple[ConfigSpace.configuration_space.Configuration, float][source]

Runs intensification by evaluating one configuration-instance at a time Side effect: adds runs to run_history

  • challenger (Configuration) – promising configuration

  • incumbent (typing.Optional[Configuration]) – best configuration so far, None in 1st run

  • run_history (smac.runhistory.runhistory.RunHistory) – stores all runs we ran so far

  • time_bound (float, optional (default=2 ** 31 - 1)) – time in [sec] available to perform intensify

  • log_traj (bool) – whether to log changes of incumbents in trajectory


incumbent and incumbent cost

Return type

typing.Tuple[Configuration, float]

get_next_challenger(challengers: Optional[List[ConfigSpace.configuration_space.Configuration]], chooser: Optional[smac.optimizer.epm_configuration_chooser.EPMChooser], run_history: smac.runhistory.runhistory.RunHistory, repeat_configs: bool = True) → Tuple[Optional[ConfigSpace.configuration_space.Configuration], bool][source]

Abstract method for choosing the next challenger, to allow for different selections across intensifiers uses _next_challenger() by default


  • typing.Optional[Configuration] – next configuration to evaluate

  • bool – flag telling if the configuration is newly sampled or one currently being tracked