How to deal with post-processing#

In this section we describe the post processing features of GEMSEO, used to analyze OptimizationResult, called the optimization history.

What data to post-process?#

Post-processing features are applicable to any OptimizationProblem that has been solved, which may have been loaded from the disk.

In practice,

Illustration on the Sobieski use case#

The post-processing features are illustrated on MDO results obtained on the SSBJ use case, using different types of formulation (MDF formulation, IDF formulation, ...)

The following code sets up and executes the problem. It is possible to try different types of MDO strategies by changing the formulation value. For a detailed explanation on how to setup the case, please see Application: Sobieski's Super-Sonic Business Jet (MDO).

from gemseo import create_discipline, create_scenario

formulation = 'MDF'

disciplines = create_discipline(["SobieskiPropulsion", "SobieskiAerodynamics",
                                 "SobieskiMission", "SobieskiStructure"])

scenario = create_scenario(disciplines,
                           formulation=formulation,
                           objective_name="y_4",
                           maximize_objective=True,
                           design_space="design_space.csv")

scenario.set_differentiation_method("user")

for constraint in ["g_1","g_2","g_3"]:
    scenario.add_constraint(constraint, 'ineq')

scenario.execute(algo_name="SLSQP", max_iter=10)

How to apply a post-process feature?#

From this scenario, we can apply any kind of post-processing dedicated to BaseScenario instances,

  • either by means of its post_process() method:

    BaseScenario.post_process(settings_model=None, **settings)[source]

    Post-process the optimization history.

    Parameters:
    • settings_model (BasePostSettings | None) -- The post-processor settings as a Pydantic model. If None, use **settings.

    • **settings (Any) -- The post-processor settings, including the algorithm name (use the keyword "post_name"). These arguments are ignored when settings_model is not None.

    Returns:

    The post-processor.

    Return type:

    BasePost

  • or by means of the execute_post() API method:

    execute_post(to_post_proc, settings_model=None, **settings)[source]

    Post-process a result.

    Parameters:
    • to_post_proc (BaseScenario | OptimizationProblem | str | Path) -- The result to be post-processed, either a DOE scenario, an MDO scenario, an optimization problem or a path to an HDF file containing a saved optimization problem.

    • settings_model (BasePostSettings | None) -- The post-processor settings as a Pydantic model. If None, use **settings.

    • **settings (Any) -- The post-processor settings, including the algorithm name (use the keyword "post_name"). These arguments are ignored when settings_model is not None.

    Returns:

    The post-processor.

    Return type:

    BasePost

    Examples

    >>> from gemseo import create_discipline, create_scenario, execute_post
    >>> from gemseo.problems.mdo.sellar.sellar_design_space import (
    ...     SellarDesignSpace,
    ... )
    >>> disciplines = create_discipline(["Sellar1", "Sellar2", "SellarSystem"])
    >>> design_space = SellarDesignSpace()
    >>> scenario = create_scenario(
    ...     disciplines,
    ...     "obj",
    ...     design_space,
    ...     formulation_name="MDF",
    ...     name="SellarMDFScenario",
    ... )
    >>> scenario.execute(algo_name="NLOPT_SLSQP", max_iter=100)
    >>> execute_post(scenario, post_name="OptHistoryView", show=False, save=True)
    

Note

Only design variables and functions (objective function, constraints) are stored for post-processing. If you want to be able to plot state variables, you must add them as observables before the problem is executed. Use the add_observable() method.

Customize with matplotlib

Customize with matplotlib

Post-process a scenario

Post-process a scenario

Post-process an HDF5 file.

Post-process an HDF5 file.

Post-process an optimization dataset

Post-process an optimization dataset

Post-process an optimization problem

Post-process an optimization problem

Save a scenario for post-processing

Save a scenario for post-processing

Save an optimization problem for post-processing

Save an optimization problem for post-processing

Algorithms#

The data used to illustrate the post-processing algorithms in the following examples are from an MDO scenario on the Sobieski's SSBJ problem. The scenario uses the MDF formulation and was solved using the SciPy SLSQP algorithm. The data have been saved in an HDF5 file, which is passed to the high-level function execute_post() along with the appropriate settings model.

Note

To get the specific settings of a given post-processing, one should use the appropriate settings model accessible in gemseo.settings.post. Further details on the available post-processings and their settings can be found in the following dedicated page: Post-processing algorithms.

Details on how to execute such a scenario can be found here.

Basic history

Basic history

Constraints history

Constraints history

Correlations

Correlations

Gradient Sensitivity

Gradient Sensitivity

Objective and constraints history

Objective and constraints history

Optimization History View

Optimization History View

Parallel coordinates

Parallel coordinates

Pareto front

Pareto front

Pareto front on a multi-objective problem

Pareto front on a multi-objective problem

Quadratic approximations

Quadratic approximations

Radar chart

Radar chart

Robustness

Robustness

Scatter plot matrix

Scatter plot matrix

Self-Organizing Map

Self-Organizing Map

Variables influence

Variables influence

Gallery generated by Sphinx-Gallery