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 aMDOFormulation
attribute,a
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, …)
To setup the case, please see Application: Sobieski’s Super-Sonic Business Jet (MDO).
The code lines follow, modulo the formulation
value:
from gemseo.api 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.txt")
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] Finds the appropriate library and executes the post processing on the problem
- Parameters
post_name – the post processing name
options – options for the post method, see its package
-
or by means of the
execute_post()
API method:-
api.
execute_post
(post_name, **options) Execute a post-processing method.
- Parameters
to_post_proc (MDOScenario, DOEScenario, OptimizationProblem, or str) – MDO or DOE scenario, or an optimization problem, or a path to a HDF file containing a saved OptimizationProblem.
post_name (str) – Post processing name.
options – Post-processing options.
Examples
>>> from gemseo.api 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', 'MDO') >>> scenario.execute({'algo': 'NLOPT_SLSQP', 'max_iter': 100}) >>> execute_post(scenario, 'OptHistoryView', show=False, save=True)
-