smac.tae.execute_ta_run module

exception smac.tae.execute_ta_run.BudgetExhaustedException[source]

Bases: Exception

Exception indicating that time- or memory-budgets are exhausted.

exception smac.tae.execute_ta_run.CappedRunException[source]

Bases: Exception

Exception indicating that a run was capped with a cutoff smaller than the actual timeout

class smac.tae.execute_ta_run.ExecuteTARun(ta: Union[List[str], Callable], stats: smac.stats.stats.Stats, runhistory: Optional[RunHistory] = None, run_obj: str = 'runtime', par_factor: int = 1, cost_for_crash: float = 2147483647.0, abort_on_first_run_crash: bool = True)[source]

Bases: object

Executes a target algorithm run with a given configuration on a given instance and some resource limitations

ta
stats
runhistory
run_obj
par_factor
crash_cost
logger

Constructor

Parameters
  • ta (list) – target algorithm command line as list of arguments

  • runhistory (RunHistory, optional) – runhistory to keep track of all runs; only used if set

  • stats (Stats()) – stats object to collect statistics about runtime and so on

  • run_obj (str) – run objective of SMAC

  • par_factor (int) – penalization factor

  • cost_for_crash (float) – cost that is used in case of crashed runs (including runs that returned NaN or inf)

  • abort_on_first_run_crash (bool) – if true and first run crashes, raise FirstRunCrashedException

run(config: ConfigSpace.configuration_space.Configuration, instance: str, cutoff: Optional[float] = None, seed: int = 12345, budget: Optional[float] = None, instance_specific: str = '0') → Tuple[smac.tae.execute_ta_run.StatusType, float, float, Dict][source]

Runs target algorithm <self.ta> with configuration <config> on instance <instance> with instance specifics <specifics> for at most <cutoff> seconds and random seed <seed>

Parameters
  • config (Configuration) – dictionary param -> value

  • instance (string) – problem instance

  • cutoff (float, optional) – Wallclock time limit of the target algorithm. If no value is provided no limit will be enforced.

  • seed (int) – random seed

  • budget (float, optional) – A positive, real-valued number representing an arbitrary limit to the target algorithm Handled by the target algorithm internally

  • instance_specific (str) – instance specific information (e.g., domain file or solution)

Returns

  • status (enum of StatusType (int)) – {SUCCESS, TIMEOUT, CRASHED, ABORT}

  • cost (float) – cost/regret/quality (float) (None, if not returned by TA)

  • runtime (float) – runtime (None if not returned by TA)

  • additional_info (dict) – all further additional run information

start(config: ConfigSpace.configuration_space.Configuration, instance: str, cutoff: Optional[float] = None, seed: int = 12345, budget: float = 0.0, instance_specific: str = '0', capped: bool = False) → Tuple[smac.tae.execute_ta_run.StatusType, float, float, Dict][source]

Wrapper function for ExecuteTARun.run() to check configuration budget before the runs and to update stats after run

Parameters
  • config (Configuration) – Mainly a dictionary param -> value

  • instance (string) – Problem instance

  • cutoff (float, optional) – Runtime cutoff

  • seed (int) – Random seed

  • budget (float, optional) – A positive, real-valued number representing an arbitrary limit to the target algorithm Handled by the target algorithm internally

  • instance_specific (str) – Instance specific information (e.g., domain file or solution)

  • capped (bool) – If true and status is StatusType.TIMEOUT, uses StatusType.CAPPED

Returns

  • status (enum of StatusType (int)) – {SUCCESS, TIMEOUT, CRASHED, ABORT}

  • cost (float) – cost/regret/quality (float) (None, if not returned by TA)

  • runtime (float) – runtime (None if not returned by TA)

  • additional_info (dict) – all further additional run information

exception smac.tae.execute_ta_run.FirstRunCrashedException[source]

Bases: smac.tae.execute_ta_run.TAEAbortException

Exception indicating that the first run crashed (depending on options this could trigger an ABORT of SMAC.)

class smac.tae.execute_ta_run.StatusType(value)[source]

Bases: enum.Enum

Class to define numbers for status types

ABORT = 4
CAPPED = 6
CRASHED = 3
DONOTADVANCE = 7
MEMOUT = 5
SUCCESS = 1
TIMEOUT = 2
static enum_hook(obj: Dict) → Any[source]

Hook function passed to json-deserializer as “object_hook”. EnumEncoder in runhistory/runhistory.

exception smac.tae.execute_ta_run.TAEAbortException[source]

Bases: Exception

Exception indicating that the target algorithm suggests an ABORT of SMAC, usually because it assumes that all further runs will surely fail.