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,
a
Scenario
instance has anMDOFormulation
attribute,an
MDOFormulation
instance has anOptimizationProblem
attribute,an
OptimizationProblem
instance has anOptimizationResult
attribute.
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")
algo_options = {'max_iter': 10, 'algo': "SLSQP"}
for constraint in ["g_1","g_2","g_3"]:
scenario.add_constraint(constraint, 'ineq')
scenario.execute(algo_options)
How to apply a post-process feature?¶
From this scenario
, we can apply any kind of post-processing dedicated to Scenario
instances,
either by means of its
post_process()
method:- Scenario.post_process(post_name, **options)[source]
Post-process the optimization history.
- Parameters:
post_name (str) – The name of the post-processor, i.e. the name of a class inheriting from
OptPostProcessor
.**options (OptPostProcessorOptionType | Path) – The options for the post-processor.
- Returns:
The post-processing instance related to the optimization scenario.
- Return type:
or by means of the
execute_post()
API method:- gemseo.execute_post(to_post_proc, post_name, **options)[source]
Post-process a result.
- Parameters:
to_post_proc (Scenario | 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.
post_name (str) – The name of the post-processing.
**options (Any) – The post-processing options.
- Returns:
The post-processor.
- Return type:
Examples
>>> from gemseo import create_discipline, create_scenario, execute_post >>> from gemseo.problems.sellar.sellar_design_space import SellarDesignSpace >>> disciplines = create_discipline(["Sellar1", "Sellar2", "SellarSystem"]) >>> design_space = SellarDesignSpace() >>> scenario = create_scenario(disciplines, 'MDF', 'obj', design_space, 'SellarMDFScenario') >>> scenario.execute({"algo": "NLOPT_SLSQP", "max_iter": 100}) >>> execute_post(scenario, "OptHistoryView", show=False, save=True)
See also
get_available_post_processings get_post_processing_options_schema
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.
Post-process an optimization problem
Save a scenario for post-processing
Save an optimization problem for post-processing
Algorithms¶
Objective and constraints history
Pareto front on Binh and Korn problem