generate_configs#

Generate a bash script to run multiple experiments. Make sure you generate configs from base BitstreamEvolution Directory.

Origionally written by Allyn, improved and extended by Isaac.

class tools.generate_configs.CommandData(config_path: str, description: str, copy_best_asc_target_path: str | None = None, best_asc_workspace_path: str = './workspace/best.asc', skip_next_command_if_success: bool = False, skip_next_command_if_error: bool = False, skip_next_command_if_skipped: bool = False)[source]#

A class that stores all data needed to invoke and run evolve on the command line.

class tools.generate_configs.CommandInfo(*args, **kwargs)[source]#

A protocol specifying all data needed to invoke and run evolve on the command line.

copy_best_asc_target_path: str | None#

This is the path we want to copy best.asc to once it has run successfully, None if don’t want to copy it to a different location.

tools.generate_configs.path_store_best_asc = 'data/previous_best.asc'#

This variable is where the best.asc is copied to is set command to copy_best_target_path by default

tools.generate_configs.pulse_count_config_generator(target_pulses: list[int], use_tolerant_ff: bool = True, use_sensitive_ff: bool = True, population_size: int = 50, max_generations: int = 500, store_best_circuit: bool = False, skip_next_if_fail: bool = False, skip_next_if_skipped: bool = False) Generator[CommandInfo, None, None][source]#

Generates configs for pulse_count experiments

The order experiments will run if all fitness functions are selected is: tolerant -> sensitive

Parameters:
  • target_pulses (list[int]) – A list of all of the target pulse counts you want to train for

  • use_tolerant_ff (bool, optional) – If each pulse get a run using the tolerant fitness function, by default True

  • use_sensitive_ff (bool, optional) – If each pulse get a run using the sinsitive fitness function, by default True

  • population_size (int, optional) – This sets how many circuits are in each population, by default 50

  • max_generations (int, optional) – Sets how many generations are allowed to run before the experiment ends, by default 500

  • store_best_circuit (bool, optional) – If this is set the best.asc file will be copied to the data directory specified in path_store_best_asc, by default False

  • skip_next_if_fail (bool, optional) – This will set the bash script to skip the next command it would run if this script fails, by default False

  • skip_next_if_skipped (bool, optional) – Sets the bash script to skip the next command if this command is skipped, by default False

Yields:

Generator[CommandInfo,None,None] – The path to the output file generated.

tools.generate_configs.pulse_count_then_sensitivity_config_generator(target_pulses: list[int], use_tolerant_ff: bool = True, use_sensitive_ff: bool = True, population_size: int = 50, max_generations: int = 500) Generator[CommandInfo, None, None][source]#

Generates configs for pulse_count experiments, then follows them with the config for a sensitivity config.

The order experiments will run if all fitness functions are selected is: tolerant -> sensitive

Parameters:
  • target_pulses (list[int]) – A list of all of the target pulse counts you want to train for

  • use_tolerant_ff (bool, optional) – If each pulse get a run using the tolerant fitness function, by default True

  • use_sensitive_ff (bool, optional) – If each pulse get a run using the sinsitive fitness function, by default True

  • population_size (int, optional) – The number of circuits in each generation for pulse count, by default 50

  • max_generations (int, optional) – The number of generations run before ending the simulation for pulse count, by default 500

tools.generate_configs.repeat(repeat_count: int, generator: Generator[Any, None, None]) Generator[Any, None, None][source]#

Repeats the outputs of the instantiated generator it is passed.

Parameters:
  • repeat_count (int) – number of times to duplicate the sequence

  • generator (Generator[Any,None,None]) – Instantiated generator it duplicates

Yields:

Generator[Any,None,None] – The repeated output of the input generator