smac.intensifier.abstract_intensifier

Classes

AbstractIntensifier(scenario[, ...])

Base class for all racing methods.

Interfaces

class smac.intensifier.abstract_intensifier.AbstractIntensifier(scenario, min_config_calls=1, max_config_calls=2000, min_challenger=1, seed=None)[source]

Bases: object

Base class for all racing methods.

The intensification is designed to output a TrialInfo object with enough information to run a given configuration (for example, the trial info contains the instance/seed pair, as well as the associated resources).

A worker can execute this TrialInfo object and produce a TrialValue object with the execution results. Each intensifier process the TrialValue object and updates its internal state in preparation for the next iteration.

Parameters:
  • scenario (Scenario) –

  • min_config_calls (int, defaults to 1) – Minimum number of trials per config (summed over all calls to intensify).

  • max_config_calls (int, defaults to 2000) – Maximum number of trials per config (summed over all calls to intensify).

  • min_challenger (int, defaults to 1) – Minimal number of challengers to be considered (even if time_bound is exhausted earlier).

  • seed (int | None, defaults to none) –

get_next_trial(challengers, incumbent, get_next_configurations, runhistory, repeat_configs=True, n_workers=1)[source]

Abstract method for choosing the next challenger. If no more challengers are available, the method should issue a SKIP via RunInfoIntent.SKIP, so that a new iteration can sample new configurations.

Parameters:
  • challengers (list[Configuration] | None) – Promising configurations.

  • incumbent (Configuration) – Incumbent configuration.

  • get_next_configurations (Callable[[], Iterator[Configuration]] | None, defaults to none) – Function that generates next configurations to use for racing.

  • runhistory (RunHistory) –

  • repeat_configs (bool, defaults to true) – If false, an evaluated configuration will not be generated again.

  • n_workers (int, optional, defaults to 1) – The maximum number of workers available.

Return type:

tuple[TrialInfoIntent, TrialInfo]

Returns:

  • TrialInfoIntent – Indicator of how to consume the TrialInfo object.

  • TrialInfo – An object that encapsulates necessary information of the trial.

abstract get_target_function_budgets()[source]

Which budgets are used to call the target function.

Return type:

list[Optional[float]]

abstract get_target_function_instances()[source]

Which instances are used to call the target function.

Return type:

list[Optional[str]]

abstract get_target_function_seeds()[source]

Which seeds are used to call the target function.

Return type:

list[int]

property iteration_done: bool

Whether an iteration is done or not.

Return type:

bool

property meta: dict[str, Any]

Returns the meta data of the created object.

Return type:

dict[str, Any]

property num_trials: int

How many trials have been done in an iteration so far.

Return type:

int

process_results(trial_info, trial_value, incumbent, runhistory, time_bound, log_trajectory=True)[source]

The intensifier stage will be updated based on the results/status of a configuration execution. Also, a incumbent will be determined.

Parameters:
  • trial_info (TrialInfo) –

  • trial_value (TrialValue) –

  • incumbent (Configuration | None) – Best configuration seen so far.

  • runhistory (RunHistory) –

  • time_bound (float) – Time [sec] available to perform intensify.

  • log_trajectory (bool) – Whether to log changes of incumbents in the trajectory.

Return type:

tuple[Configuration, float | list[float]]

Returns:

  • incumbent (Configuration) – Current (maybe new) incumbent configuration.

  • incumbent_costs (float | list[float]) – Empirical cost(s) of the incumbent configuration.

property repeat_configs: bool

Whether configs should be repeated or not.

Return type:

bool

abstract property uses_budgets: bool

If the intensifier needs to make use of budgets.

Return type:

bool

abstract property uses_instances: bool

If the intensifier needs to make use of instances.

Return type:

bool

abstract property uses_seeds: bool

If the intensifier needs to make use of seeds.

Return type:

bool