smac.utils.io.cmd_reader

Functions

cost_for_crash(x)

Convert cost for crash into an array.

multi_objectives(x)

Convert objectives into an array.

truthy(x)

Convert x into its truth value.

Classes

CMDReader()

Use argparse to parse command line options.

CheckScenarioFileAction(option_strings, dest)

Check scenario file given by user.

ConfigurableHelpFormatter(*args[, help_type])

Configurable Help Formatter.

DevHelpAction(*args, **kwargs)

Action to show standard and developer options in help message.

ParseOverallObjectiveAction(option_strings, dest)

Parse overall objective given by user.

ParseRandomConfigurationChooserAction(...[, ...])

Parse random configuration chooser given by user.

ProcessOutputDirAction(option_strings, dest)

Process output directory given by user.

ProcessRunObjectiveAction(option_strings, dest)

Process run objective given by user.

ReadFeatureFileAction(option_strings, dest)

Read feature file given by user.

ReadPCSFileAction(option_strings, dest[, ...])

Read PCS (parameter configuration space) file given by user.

ReadTestInstFileAction(option_strings, dest)

Read test instance file given by user.

ReadTrainInstFileAction(option_strings, dest)

Read training instance file given by user.

SMACArgumentParser(*args, **kwargs)

ArgumentParser that can be extended by additional parsers.

StandardHelpAction(*args, **kwargs)

Action to only show standard options in help message.

class smac.utils.io.cmd_reader.CMDReader[source]

Bases: object

Use argparse to parse command line options.

logger
Type

Logger

parse_main_command(main_cmd_opts)[source]

Parse main options.

Return type

Tuple[Namespace, List[str]]

parse_scenario_command(scenario_file=None, scenario_dict={}, scenario_cmd_opts=[])[source]

Parses scenario options.

Parameters
  • scenario_file (str, optional) – Path to the scenario file, by default None

  • scenario_dict (dict, optional) – Mappings of scenario options to values, by default {}

  • scenario_cmd_opts (List[str], optional) – Scenario options from command line, by default []

Returns

Parsed scenario arguments.

Return type

Namespace

Raises

ValueError – If scenario is not a string or dictionary.

parse_smac_command(smac_dict={}, smac_cmd_opts=[])[source]

Parse SMAC options.

Return type

Tuple[Namespace, Dict, List[str]]

read_cmd(commandline_arguments=('-b', 'html', '.', 'build/html'))[source]

Reads command line options (main, smac and scenario options)

Returns

smac_args_, scen_args_ – main, smac and scenario options parsed with corresponding ArgumentParser

Return type

parsed arguments;

read_smac_scenario_dict_cmd(dict_cmd, scenario_file=None)[source]

Reads smac and scenario options provided in a dictionary.

Returns

smac_args_, scen_args_

Return type

smac and scenario options parsed with corresponding ArgumentParser

write_main_options_to_doc(path='main_options.rst')[source]

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

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

Return type

None

write_scenario_options_to_doc(path='scenario_options.rst')[source]

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

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

Return type

None

write_smac_options_to_doc(path='smac_options.rst')[source]

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

Parameters

path (string) – Where to write to (relative to doc-folder since executed in conf.py)

Return type

None

class smac.utils.io.cmd_reader.CheckScenarioFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Check scenario file given by user.

__call__(parser, namespace, values, option_string=None)[source]

Check scenario file given by user.

Return type

None

class smac.utils.io.cmd_reader.ConfigurableHelpFormatter(*args, help_type='standard', **kwargs)[source]

Bases: argparse.ArgumentDefaultsHelpFormatter

Configurable Help Formatter. Can filter out developer options.

class smac.utils.io.cmd_reader.DevHelpAction(*args, **kwargs)[source]

Bases: argparse.Action

Action to show standard and developer options in help message.

__call__(parser, namespace, values, option_string=None)[source]

Action to show standard and developer options in help message.

Return type

None

class smac.utils.io.cmd_reader.ParseOverallObjectiveAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Parse overall objective given by user.

__call__(parser, namespace, values, option_string=None)[source]

Parse overall objective given by user.

Return type

None

class smac.utils.io.cmd_reader.ParseRandomConfigurationChooserAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Parse random configuration chooser given by user.

__call__(parser, namespace, values, option_string=None)[source]

Parse random configuration chooser given by user.

Return type

None

class smac.utils.io.cmd_reader.ProcessOutputDirAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Process output directory given by user.

__call__(parser, namespace, values, option_string=None)[source]

Process output directory given by user.

Return type

None

class smac.utils.io.cmd_reader.ProcessRunObjectiveAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Process run objective given by user.

__call__(parser, namespace, values, option_string=None)[source]

Process run objective given by user.

Return type

None

class smac.utils.io.cmd_reader.ReadFeatureFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read feature file given by user.

__call__(parser, namespace, values, option_string=None)[source]

Read feature file given by user.

Return type

None

class smac.utils.io.cmd_reader.ReadPCSFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read PCS (parameter configuration space) file given by user.

__call__(parser, namespace, values, option_string=None)[source]

Read PCS (parameter configuration space) file given by user.

Return type

None

class smac.utils.io.cmd_reader.ReadTestInstFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read test instance file given by user.

__call__(parser, namespace, values, option_string=None)[source]

Read test instance file given by user.

Return type

None

class smac.utils.io.cmd_reader.ReadTrainInstFileAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Read training instance file given by user.

__call__(parser, namespace, values, option_string=None)[source]

Read training instance file given by user.

Return type

None

class smac.utils.io.cmd_reader.SMACArgumentParser(*args, **kwargs)[source]

Bases: argparse.ArgumentParser

ArgumentParser that can be extended by additional parsers.

add_parser(additional_parser)[source]

Add parser to self.additional_parsers.

Return type

None

format_help()[source]

Get help string from formatter.

Return type

str

set_help_type(help_type)[source]

Set help type to self.additional_parsers.

Return type

None

class smac.utils.io.cmd_reader.StandardHelpAction(*args, **kwargs)[source]

Bases: argparse.Action

Action to only show standard options in help message.

__call__(parser, namespace, values, option_string=None)[source]

Action to only show standard options in help message.

Return type

None

smac.utils.io.cmd_reader.cost_for_crash(x)[source]

Convert cost for crash into an array.

Return type

Union[int, float, List[Union[int, float]]]

smac.utils.io.cmd_reader.multi_objectives(x)[source]

Convert objectives into an array.

Return type

List[str]

smac.utils.io.cmd_reader.truthy(x)[source]

Convert x into its truth value.

Return type

bool