smac.intensification.abstract_racer¶
Classes
|
Base class for all racing methods. |
|
Class to define different requests on how to process the runinfo. |
- class smac.intensification.abstract_racer.AbstractRacer(stats, traj_logger, rng, instances, instance_specifics=None, cutoff=None, deterministic=False, run_obj_time=True, minR=1, maxR=2000, adaptive_capping_slackfactor=1.2, min_chall=1)[source]¶
Bases:
object
Base class for all racing methods.
The “intensification” is designed to output a RunInfo object with enough information to run a given configuration (for example, the run info contains the instance/seed pair, as well as the associated resources).
A worker can execute this RunInfo object and produce a RunValue object with the execution results. Each intensifier process the RunValue object and updates it’s internal state in preparation for the next iteration.
Note: Do not use directly
- Parameters
stats (Stats) – stats object
traj_logger (smac.utils.io.traj_logging.TrajLogger) – TrajLogger object to log all new incumbents
rng (np.random.RandomState) –
instances (List[str]) – list of all instance ids
instance_specifics (Mapping[str, str]) – 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)
- get_next_run(challengers, incumbent, chooser, run_history, repeat_configs=True, num_workers=1)[source]¶
Abstract method for choosing the next challenger, to allow for different selections across intensifiers uses
_next_challenger()
by default.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]) – promising configurations
incumbent (Configuration) – incumbent configuration
chooser (smac.optimizer.epm_configuration_chooser.EPMChooser) – optimizer that generates next configurations to use for racing
run_history (smac.runhistory.runhistory.RunHistory) – stores all runs we ran so far
repeat_configs (bool) – if False, an evaluated configuration will not be generated again
num_workers (int) – the maximum number of workers available at a given time.
- Return type
Tuple
[RunInfoIntent
,RunInfo
]- Returns
run_info (RunInfo) – An object that encapsulates necessary information for a config run
intent (RunInfoIntent) – Indicator of how to consume the RunInfo object
- process_results(run_info, incumbent, run_history, time_bound, result, log_traj=True)[source]¶
The intensifier stage will be updated based on the results/status of a configuration execution. Also, a incumbent will be determined.
- Parameters
run_info (RunInfo) – A RunInfo containing the configuration that was evaluated
incumbent (Optional[Configuration]) – Best configuration seen so far
run_history (RunHistory) – stores all runs we ran so far if False, an evaluated configuration will not be generated again
time_bound (float) – time in [sec] available to perform intensify
result (RunValue) – Contain the result (status and other methadata) of exercising a challenger/incumbent.
log_traj (bool) – Whether to log changes of incumbents in trajectory
- Return type
Tuple
[Configuration
,float
]- Returns
incumbent (Configuration()) – current (maybe new) incumbent configuration
inc_perf (float) – empirical performance of incumbent configuration