rollo.executor
Contents
rollo.executor
Module Contents
- class rollo.executor.Executor(input_file, checkpoint_file=None, verbose=False)
Executes rollo simulation from start to finish.
Instances of this class can be used to perform a rollo run.
The Executor class drives the ROLLO code execution with the following steps in the execute method: 1) User input file validation with InputValidation 2) Evaluation function generation with Evaluation class 3) DEAP toolbox initialization with ToolboxGenerator class 4) Constraint initialization with Constraints class 5) Genetic algorithm execution with Algorithm class
- Parameters
input_file (str) – Name of input file
checkpoint_file (str, optional) – Name of checkpoint file
- input_file
Name of input file
- Type
str
- checkpoint_file
Name of checkpoint file
- Type
str
- verbose
- Type
bool
- execute(self)
Executes rollo simulation to generate reactor designs.
Read and validate input file
Initialize evaluator
Initialize DEAP toolbox
Initialize constraints
Run genetic algorithm
- read_input_file(self)
Reads a json input file and returns a dictionary
- Returns
data – json input file converted into a dict
- Return type
dict
- organize_input_output(self, input_dict)
Labels the control variables and output variables with numbers to keep consistency between evaluation, constraints, and algorithm classes
- Parameters
input_dict (dict) – input file dict
- Returns
control_vars (OrderedDict) – Ordered dict of control variables as keys and a list of solvers that use them as values
output_vars (OrderedDict) – Ordered dict of output variables as keys and solvers as values
- load_evaluator(self, control_dict, output_dict, input_dict)
Creates an Evaluation function object
- Parameters
control_dict (OrderedDict) – Ordered dict of control variables as keys and a list of their solver and number of variables as each value
output_dict (OrderedDict) – Ordered dict of output variables as keys and solvers as values
input_dict (dict) – input file dict with default values filled
- Returns
evaluator_fn – function that runs the evaluation software and returns output values output by the software
- Return type
function
- load_toolbox(self, evaluator_fn, input_algorithm, input_ctrl_vars, control_dict)
Creates a DEAP toolbox object based on user-defined parameters.
- Parameters
evaluator_fn (function) – function that runs the evaluation software and returns output values output by the software
input_algorithm (dict) – algorithm sub-dictionary from input file
input_ctrl_vars (dict) – control variables sub-dictionary from input file
control_dict (OrderedDict) – Ordered dict of control variables as keys and a list of their solver and number of variables as each value
- Returns
toolbox (deap.base.Toolbox object) – DEAP toolbox populated with user-defined genetic algorithm parameters
creator (deap.creator object) – DEAP meta-factory allowing to create classes that will fulfill the needs of the evolutionary algorithms
- load_constraints(self, output_dict, input_constraints, toolbox)
Creates a Constraints object loaded with user-defined constraints information.
- Parameters
output_dict (OrderedDict) – Ordered dict of output variables as keys and solvers as values
input_constraints (dict) – constraints sub-dictionary from input file
toolbox (deap.base.Toolbox object) – DEAP toolbox populated with genetic algorithm parameters for this creator
- Returns
constraints_obj – Constraints object loaded with constraint information from the input file
- Return type
rollo.Constraints object