smac.scenario.scenario module

class smac.scenario.scenario.Scenario(scenario, cmd_args: dict = None)[source]

Bases: object

Scenario contains the configuration of the optimization process and constructs a scenario object from a file or dictionary.

All arguments set in the Scenario are set as attributes.

Creates a scenario-object. The output_dir will be “output_dir/run_id/” and if that exists already, the old folder and its content will be moved (without any checks on whether it’s still used by another process) to “output_dir/run_id.OLD”. If that exists, “.OLD”s will be appended until possible.

  • scenario (str or dict) – If str, it will be interpreted as to a path a scenario file If dict, it will be directly to get all scenario related information
  • cmd_args (dict) – Command line arguments that were not processed by argparse
add_argument(name: str, help: str, callback=None, default=None, dest: str = None, required: bool = False, mutually_exclusive_group: str = None, choice=None)[source]

Add argument to the scenario object.

  • name (str) – Argument name
  • help (str) – Help text which can be displayed in the documentation.
  • callback (callable, optional) – If given, the callback will be called when the argument is parsed. Useful for custom casting/typechecking.
  • default (object, optional) – Default value if the argument is not given. Default to None.
  • dest (str) – Assign the argument to scenario object by this name.
  • required (bool) – If True, the scenario will raise an error if the argument is not given.
  • mutually_exclusive_group (str) – Group arguments with similar behaviour by assigning the same string value. The scenario will ensure that exactly one of the arguments is given. Is used for example to ensure that either a configuration space object or a parameter file is passed to the scenario. Can not be used together with required.
  • choice (list/set/tuple) – List of possible string for this argument

Write scenario to self.output_dir/scenario.txt.


Writes the option-list to file for autogeneration in documentation. The list is created in doc/ and read in doc/options.rst.

Parameters:path (string) – Where to write to (relative to doc-folder since executed in