sierra.core.variables.batch_criteria

Base classes used to define Batch Experiments.

class sierra.core.variables.batch_criteria.BatchCriteria(cli_arg: str, main_config: Dict[str, Any], batch_input_root: Path)[source]

Defines experiments via lists of sets of changes to make to an XML file.

cli_arg

Unparsed batch criteria string from command line.

main_config

Parsed dictionary of main YAML configuration.

batch_input_root

Absolute path to the directory where batch experiment directories should be created.

Inheritance

Inheritance diagram of BatchCriteria
__dict__ = mappingproxy({'__module__': 'sierra.core.variables.batch_criteria', '__doc__': 'Defines experiments via  lists of sets of changes to make to an XML file.\n\n    Attributes:\n\n        cli_arg: Unparsed batch criteria string from command line.\n\n        main_config: Parsed dictionary of main YAML configuration.\n\n        batch_input_root: Absolute path to the directory where batch experiment\n                          directories should be created.\n\n    ', '__init__': <function BatchCriteria.__init__>, 'gen_attr_changelist': <function BatchCriteria.gen_attr_changelist>, 'gen_tag_rmlist': <function BatchCriteria.gen_tag_rmlist>, 'gen_tag_addlist': <function BatchCriteria.gen_tag_addlist>, 'gen_files': <function BatchCriteria.gen_files>, 'gen_exp_names': <function BatchCriteria.gen_exp_names>, 'arena_dims': <function BatchCriteria.arena_dims>, 'n_exp': <function BatchCriteria.n_exp>, 'pickle_exp_defs': <function BatchCriteria.pickle_exp_defs>, 'scaffold_exps': <function BatchCriteria.scaffold_exps>, '_scaffold_expi': <function BatchCriteria._scaffold_expi>, '__dict__': <attribute '__dict__' of 'BatchCriteria' objects>, '__weakref__': <attribute '__weakref__' of 'BatchCriteria' objects>, '__annotations__': {}})
__doc__ = 'Defines experiments via  lists of sets of changes to make to an XML file.\n\n    Attributes:\n\n        cli_arg: Unparsed batch criteria string from command line.\n\n        main_config: Parsed dictionary of main YAML configuration.\n\n        batch_input_root: Absolute path to the directory where batch experiment\n                          directories should be created.\n\n    '
__init__(cli_arg: str, main_config: Dict[str, Any], batch_input_root: Path) None[source]
__module__ = 'sierra.core.variables.batch_criteria'
__weakref__

list of weak references to the object (if defined)

_scaffold_expi(expi_def: XMLExpDef, modsi, is_compound: bool, i: int, cmdopts: Dict[str, Any]) None[source]
arena_dims(cmdopts: Dict[str, Any]) List[ArenaExtent][source]

Get the arena dimensions used for each experiment in the batch.

Not applicable to all criteria.

Must be implemented on a per-platform basis, as different platforms have different means of computing the size of the arena.

gen_attr_changelist() List[AttrChangeSet][source]
gen_exp_names(cmdopts: Dict[str, Any]) List[str][source]

Generate list of experiment names from the criteria.

Used for creating unique directory names for each experiment in the batch.

Returns:

List of experiments names for current experiment.

gen_files() None[source]
gen_tag_addlist() List[TagAddList][source]
gen_tag_rmlist() List[TagRmList][source]
n_exp() int[source]
pickle_exp_defs(cmdopts: Dict[str, Any]) None[source]
scaffold_exps(batch_def: XMLExpDef, cmdopts: Dict[str, Any]) None[source]

Scaffold a batch experiment.

Takes the raw template input file and apply XML modifications from the batch criteria for all experiments, and save the result in each experiment’s input directory.

class sierra.core.variables.batch_criteria.IConcreteBatchCriteria[source]

‘Final’ interface for user-visible batch criteria.

Inheritance

Inheritance diagram of IConcreteBatchCriteria
__doc__ = "\n    'Final' interface for user-visible batch criteria.\n    "
__module__ = 'sierra.core.variables.batch_criteria'
graph_xlabel(cmdopts: Dict[str, Any]) str[source]

Get the X-label for a graph.

Returns:

The X-label that should be used for the graphs of various performance measures across batch criteria.

graph_xticklabels(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[str][source]

Calculate X axis tick labels for graph generation.

Parameters:
  • cmdopts – Dictionary of parsed command line options.

  • exp_names – If not None, then these directories will be used to calculate the labels, rather than the results of gen_exp_names().

graph_xticks(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[float][source]

Calculate X axis ticks for graph generation.

Parameters:
  • cmdopts – Dictionary of parsed command line options.

  • exp_names – If not None, then this list of directories will be used to calculate the ticks, rather than the results of gen_exp_names().

class sierra.core.variables.batch_criteria.UnivarBatchCriteria(cli_arg: str, main_config: Dict[str, Any], batch_input_root: Path)[source]

Base class for a univariate batch criteria.

Inheritance

Inheritance diagram of UnivarBatchCriteria
__doc__ = '\n    Base class for a univariate batch criteria.\n    '
__module__ = 'sierra.core.variables.batch_criteria'
is_bivar() bool[source]
is_univar() bool[source]
populations(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[int][source]

Calculate system sizes used the batch experiment, sorted.

Parameters:
  • cmdopts – Dictionary of parsed command line options.

  • exp_names – If is not None, then these directories will be used to calculate the system sizes, rather than the results of gen_exp_names().

class sierra.core.variables.batch_criteria.BivarBatchCriteria(criteria1: IConcreteBatchCriteria, criteria2: IConcreteBatchCriteria)[source]

Combination of the definition of two separate batch criteria.

Changed in version 1.2.20: Bivariate batch criteria can be compound: one criteria can create and the other modify XML tags to create an experiment definition.

Inheritance

Inheritance diagram of BivarBatchCriteria
__doc__ = '\n    Combination of the definition of two separate batch criteria.\n\n    .. versionchanged:: 1.2.20\n\n         Bivariate batch criteria can be compound: one criteria can create and\n         the other modify XML tags to create an experiment definition.\n\n    '
__init__(criteria1: IConcreteBatchCriteria, criteria2: IConcreteBatchCriteria) None[source]
__module__ = 'sierra.core.variables.batch_criteria'
exp_scenario_name(exp_num: int) str[source]

Given the expeperiment number, compute a parsable scenario name.

It is necessary to query this function after generating the changelist in order to create generator classes for each experiment in the batch with the correct name and definition in some cases.

Can only be called if constant density is one of the sub-criteria.

gen_attr_changelist() List[AttrChangeSet][source]
gen_exp_names(cmdopts: Dict[str, Any]) List[str][source]

Generate a SORTED list of strings for all experiment names.

These will be used as directory LEAF names–and don’t include the parents.

gen_tag_addlist() List[TagAddList][source]
gen_tag_rmlist() List[TagRmList][source]
graph_xlabel(cmdopts: Dict[str, Any]) str[source]
graph_xticklabels(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[str][source]
graph_xticks(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[float][source]
graph_ylabel(cmdopts: Dict[str, Any]) str[source]
graph_yticklabels(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[str][source]
graph_yticks(cmdopts: Dict[str, Any], exp_names: Optional[List[str]] = None) List[float][source]
is_bivar() bool[source]
is_univar() bool[source]
n_robots(exp_num: int) int[source]
populations(cmdopts: Dict[str, Any]) List[List[int]][source]

Generate a 2D array of system sizes used the batch experiment.

Sizes are in the same order as the directories returned from gen_exp_names() for each criteria along each axis.

set_batch_input_root(root: Path) None[source]