Post-process a scenario#

from __future__ import annotations

from gemseo import create_design_space
from gemseo import create_discipline
from gemseo import create_scenario
from gemseo import execute_post

We consider a minimization problem over the interval \([0,1]\) of the \(f(x)=x^2\) objective function:

discipline = create_discipline("AnalyticDiscipline", expressions={"y": "x**2"})

design_space = create_design_space()
design_space.add_variable("x", lower_bound=0.0, upper_bound=1.0)

scenario = create_scenario(
    [discipline], "y", design_space, formulation_name="DisciplinaryOpt"
)

We solve this optimization problem with the gradient-free algorithm COBYLA:

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

Then, we can post-process this MDOScenario either with its method post_process():

scenario.post_process(post_name="BasicHistory", variable_names=["y"])

or with the function execute_post():

execute_post(scenario, post_name="BasicHistory", variable_names=["y"])

Note

By default, GEMSEO saves the images on the disk. Use save=False to not save figures and show=True to display them on the screen.

Gallery generated by Sphinx-Gallery