gemseo.disciplines.scenario_adapters.mdo_scenario_adapter module#
A discipline running a scenario.
- class MDOScenarioAdapter(scenario, input_names, output_names, reset_x0_before_opt=False, set_x0_before_opt=False, set_bounds_before_opt=False, output_multipliers=False, name='', keep_opt_history=False, save_opt_history=False, opt_history_file_prefix='', scenario_log_level=None, naming=Naming.NUMBERED)[source]#
Bases:
ProcessDisciplineA discipline running an MDO scenario.
Its execution is in three stage:
update the default input data of the top-level disciplines of the MDO formulation from its own input data,
run the MDO scenario,
update its output data from the output data of the top-level disciplines.
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
scenario (BaseScenario) -- The scenario to adapt.
input_names (Sequence[str]) -- The names of the inputs of the top-level disciplines to overload before executing the scenario. These are the adapter's input variables.
output_names (Sequence[str]) -- The names of the outputs of the top-level disciplines to get after executing the scenario. These are the adapter's output variables.
reset_x0_before_opt (bool) --
Whether to reset the initial guess of the optimization problem before executing the scenario.
By default it is set to False.
set_x0_before_opt (bool) --
Whether to set the initial guess of the optimization problem before executing the scenario. This is useful for multi-start optimization.
By default it is set to False.
set_bounds_before_opt (bool) --
Whether to set the bounds of the design space. This is useful for trust regions.
By default it is set to False.
output_multipliers (bool) --
Whether to compute the Lagrange multipliers of the scenario optimal solution and add them to the outputs.
By default it is set to False.
name (str) --
The name of the scenario adapter. If empty, use the name of the scenario adapter suffixed by
"_adapter".By default it is set to "".
keep_opt_history (bool) --
Whether to keep database copies after each execution. Depending on the size of the databases and the number of consecutive executions, this can be very memory consuming. If the adapter will be executed in parallel, the databases will not be saved to the main process by the sub-processes, so this argument should be set to
Falseto avoid unnecessary memory use in the sub-processes.By default it is set to False.
save_opt_history (bool) --
Whether to save the optimization history to an HDF5 file after each execution.
By default it is set to False.
opt_history_file_prefix (str) --
The base name for the databases to be exported. The full names of the databases are built from the provided base name suffixed by
"_identifier.h5"whereidentifieris replaced by an identifier according to thenaming_method. If empty, useDEFAULT_DATABASE_FILE_PREFIX.By default it is set to "".
scenario_log_level (int | None) -- The level of the root logger during the scenario execution. If
None, do not change the level of the root logger.naming (NameGenerator.Naming) --
The way of naming the database files. When the adapter will be executed in parallel, this method shall be set to
UUIDbecause this method is multiprocess-safe.By default it is set to "NUMBERED".
- Raises:
ValueError -- If both
reset_x0_before_optandset_x0_before_optareTrue.
- classmethod get_bnd_mult_name(variable_name, is_upper)[source]#
Return the name of the lower bound-constraint multiplier of a variable.
- classmethod get_cstr_mult_name(constraint_name)[source]#
Return the name of the multiplier of a constraint.
- add_outputs(output_names)[source]#
Add outputs to the scenario adapter.
- Parameters:
output_names (Iterable[str]) -- The names of the outputs to be added.
- Return type:
None
- post_optimal_analysis: PostOptimalAnalysis#
The post-optimal analysis.
- scenario: BaseScenario#
The scenario to be adapted.