sierra.plugins.engine.argos.variables.constant_density#

Functionality for mapping arena size -> swarm size to maintain a constant ratio.

Classes#

ConstantDensity

Defines common functionality for all constant-density classes.

Functions#

parse(→ sierra.core.types.CLIArgSpec)

Enforces specification of a ConstantDensity derived batch criteria.

Module Contents#

class sierra.plugins.engine.argos.variables.constant_density.ConstantDensity(cli_arg: str, main_config: sierra.core.types.YAMLDict, batch_input_root: pathlib.Path, target_density: float, dimensions: list[sierra.core.utils.ArenaExtent], scenario_tag: str)[source]#
Inheritance diagram of sierra.plugins.engine.argos.variables.constant_density.ConstantDensity

Defines common functionality for all constant-density classes.

Constant density = SOMETHING/arena size is held constant as arena size is increased. This class is a base class which should NEVER be used on its own.

target_density#

The target density.

dimensions#

List of (X,Y) dimensions to use (creates rectangular arenas).

scenario_tag#

A scenario tag (presumably part of --scenario) to use to generate scenario names.

changes#

List of sets of changes to apply to generate the specified arena sizes.

arena_dims(cmdopts: sierra.core.types.Cmdopts) list[sierra.core.utils.ArenaExtent]#

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

Not applicable to all criteria.

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

exp_scenario_name(exp_num: int) str[source]#

Given the exp number in the batch, compute a parsable scenario name.

It is necessary to query this criteria 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.

Normally controller+scenario are used to look up all necessary changes for the specified arena size, but for this criteria the specified scenario is the base scenario (i.e., the starting arena dimensions), and the correct arena dimensions for a given exp must be found via lookup with THIS function).

gen_attr_changelist() list[sierra.core.experiment.definition.AttrChangeSet]#

Generate expdef attributes to change in a batch experiment definition.

Modifications are sets, one per experiment in the batch, because the order you apply them doesn't matter.

gen_element_addlist() list[sierra.core.experiment.definition.ElementAddList]#

Generate expdef elelemnts to add to the batch experiment definition.

Modifications are lists, one per experiment in the batch, because the order you apply them matters.

gen_files() None#

Generate files to add to the batch experiment definition.

Presumably, the created files will be referenced in the --expdef-template file by path.

gen_tag_rmlist() list[sierra.core.experiment.definition.ElementRmList]#

Generate expdef tags to remove from the batch experiment definition.

Modifications are lists, one per experiment in the batch, because the order you apply them matters.

populations(cmdopts: sierra.core.types.Cmdopts, exp_names: list[str] | None = None) list[int]#

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().

scaffold_exps(batch_def: sierra.core.experiment.definition.BaseExpDef, cmdopts: sierra.core.types.Cmdopts) None#

Scaffold a batch experiment.

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

sierra.plugins.engine.argos.variables.constant_density.parse(arg: str) sierra.core.types.CLIArgSpec[source]#

Enforces specification of a ConstantDensity derived batch criteria.

Returns:

target_density: Floating point value of parsed target density arena_size_inc: Integer increment for arena size

Return type:

Dict