gemseo.disciplines.scenario_adapters.mdo_objective_scenario_adapter module#

A scenario adapter overwriting the local data with the optimal objective.

class MDOObjectiveScenarioAdapter(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, opt_history_file_prefix='', scenario_log_level=None)[source]#

Bases: MDOScenarioAdapter

A scenario adapter overwriting the local data with the optimal objective.

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • scenario (BaseScenario) -- The scenario to adapt.

  • input_names (Sequence[str]) -- The inputs to overload at sub-scenario execution.

  • output_names (Sequence[str]) -- The outputs to get from the sub-scenario execution.

  • reset_x0_before_opt (bool) --

    If True, reset the initial guess before running the sub optimization.

    By default it is set to False.

  • set_x0_before_opt (bool) --

    If True, set the initial guess of the sub-scenario. This is useful for multi-start optimization.

    By default it is set to False.

  • set_bounds_before_opt (bool) --

    If True, set the bounds of the design space. This is useful for trust regions.

    By default it is set to False.

  • output_multipliers (bool) --

    If True, the Lagrange multipliers of the scenario optimal solution are computed and added 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 databases copies 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 "_i.h5" where i is replaced by the execution number, i.e the number of stored databases. If empty, the databases are not exported. The databases can be exported only is keep_opt_history=True.

    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.

Raises:

ValueError -- If both reset_x0_before_opt and set_x0_before_opt are True.

databases: list[Database]#

The copies of the scenario databases after execution.

keep_opt_history: bool#

Whether to keep databases copies after each execution.

post_optimal_analysis: PostOptimalAnalysis#

The post-optimal analysis.

scenario: BaseScenario#

The scenario to be adapted.