Save an optimization problem for post-processing

from __future__ import annotations

from gemseo import create_design_space
from gemseo import execute_algo
from gemseo.algos.opt_problem import OptimizationProblem
from gemseo.core.mdofunctions.mdo_function import MDOFunction

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

objective = MDOFunction(lambda x: x**2, "f", input_names=["x"], output_names=["y"])

design_space = create_design_space()
design_space.add_variable("x", l_b=0.0, u_b=1.0)

optimization_problem = OptimizationProblem(design_space)
optimization_problem.objective = objective

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

execute_algo(optimization_problem, "NLOPT_COBYLA", max_iter=10)

Then, we save the results to an HDF5 file for future post-processing:


Gallery generated by Sphinx-Gallery