.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/multi_objective/plot_mnbi_fonseca.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_multi_objective_plot_mnbi_fonseca.py: Multi-objective Fonseca-Fleming example with the mNBI algorithm =============================================================== In this example, the modified Normal Boundary Intersection algorithm (mNBI) is used to solve the :class:`.FonsecaFleming` optimization problem :cite:`fonseca1995overview`: .. math:: \begin{aligned} \text{minimize the objective function } & f_1(x) = 1 - exp(-\sum_{i=1}^{d}((x_i - 1 / sqrt(d)) ^ 2)) \\ & f_2(x) = 1 + exp(-\sum_{i=1}^{d}((x_i + 1 / sqrt(d)) ^ 2)) \\ \text{with respect to the design variables }&x\\ \text{subject to the bound constraint} & x\in[-4,4]^d \end{aligned} We also show how the Pareto front can be refined. .. GENERATED FROM PYTHON SOURCE LINES 40-51 .. code-block:: Python from __future__ import annotations from gemseo import configure_logger from gemseo import execute_algo from gemseo import execute_post from gemseo.problems.optimization.fonseca_fleming import FonsecaFleming configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: pytb Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/gemseo/checkouts/develop/doc_src/_examples/multi_objective/plot_mnbi_fonseca.py", line 46, in from gemseo.problems.optimization.fonseca_fleming import FonsecaFleming ModuleNotFoundError: No module named 'gemseo.problems.optimization.fonseca_fleming' .. GENERATED FROM PYTHON SOURCE LINES 52-58 Solve the Fonseca-Fleming optimization problem ---------------------------------------------- The 3 sub-optimization problems of mNBI are solved with SLSQP, a gradient-based optimization algorithm from the NLOPT library, with a maximum of 100 iterations. The analytic gradients are provided. .. GENERATED FROM PYTHON SOURCE LINES 58-67 .. code-block:: Python opt_problem = FonsecaFleming() result = execute_algo( opt_problem, "MNBI", max_iter=1000, sub_optim_max_iter=100, n_sub_optim=3, sub_optim_algo="NLOPT_SLSQP", ) .. GENERATED FROM PYTHON SOURCE LINES 68-74 Display the Pareto front ^^^^^^^^^^^^^^^^^^^^^^^^ |g| detects the Pareto optimal points and the dominated ones. The Fonseca-Fleming problem is interesting because its Pareto front is not convex. The mNBI algorithm successfully computes it. .. GENERATED FROM PYTHON SOURCE LINES 74-77 .. code-block:: Python execute_post(opt_problem, "ParetoFront", save=False, show=True) .. GENERATED FROM PYTHON SOURCE LINES 78-81 Solve the Fonseca-Fleming optimization problem more finely ---------------------------------------------------------- The Pareto front is then refined with 10 sub-optimizations instead of 3. .. GENERATED FROM PYTHON SOURCE LINES 81-90 .. code-block:: Python opt_problem = FonsecaFleming() result = execute_algo( opt_problem, "MNBI", max_iter=1000, sub_optim_max_iter=100, n_sub_optim=10, sub_optim_algo="NLOPT_SLSQP", ) .. GENERATED FROM PYTHON SOURCE LINES 91-94 Display the Pareto front ^^^^^^^^^^^^^^^^^^^^^^^^ We can clearly see the effect of the refinement. .. GENERATED FROM PYTHON SOURCE LINES 94-96 .. code-block:: Python execute_post(opt_problem, "ParetoFront", save=False, show=True) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.002 seconds) .. _sphx_glr_download_examples_multi_objective_plot_mnbi_fonseca.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_mnbi_fonseca.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_mnbi_fonseca.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_