.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/post_process/algorithms/plot_pareto_front_binhkorn.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_post_process_algorithms_plot_pareto_front_binhkorn.py: Pareto front on Binh and Korn problem ===================================== In this example, we illustrate the use of the :class:`.ParetoFront` plot on the Binh and Korn multi-objective problem. .. GENERATED FROM PYTHON SOURCE LINES 28-35 .. code-block:: default from __future__ import annotations from gemseo import configure_logger from gemseo.algos.doe.doe_factory import DOEFactory from gemseo.post.post_factory import PostFactory from gemseo.problems.analytical.binh_korn import BinhKorn .. GENERATED FROM PYTHON SOURCE LINES 36-39 Import ------ The first step is to import a high-level function for logging. .. GENERATED FROM PYTHON SOURCE LINES 39-43 .. code-block:: default configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 44-47 Import the optimization problem ------------------------------- Then, we instantiate the Binh and Korn optimization problem (see :class:`.BinhKorn`). .. GENERATED FROM PYTHON SOURCE LINES 47-50 .. code-block:: default problem = BinhKorn() .. GENERATED FROM PYTHON SOURCE LINES 51-56 Create and execute scenario --------------------------- Then, we instantiate the design of experiment factory, and we request the execution of a 100-length LHS optimized by simulated annealing. .. GENERATED FROM PYTHON SOURCE LINES 56-59 .. code-block:: default doe_factory = DOEFactory() doe_factory.execute(problem, algo_name="OT_OPT_LHS", n_samples=100) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 08:27:52: Optimization problem: INFO - 08:27:52: minimize compute_binhkorn(x, y) = (4*x**2+ 4*y**2, (x-5.)**2 + (y-5.)**2) INFO - 08:27:52: with respect to x, y INFO - 08:27:52: subject to constraints: INFO - 08:27:52: ineq1(x, y): (x-5.)**2 + y**2 <= 25. <= 0.0 INFO - 08:27:52: ineq2(x, y): (x-8.)**2 + (y+3)**2 >= 7.7 <= 0.0 INFO - 08:27:52: over the design space: INFO - 08:27:52: +------+-------------+-------+-------------+-------+ INFO - 08:27:52: | name | lower_bound | value | upper_bound | type | INFO - 08:27:52: +------+-------------+-------+-------------+-------+ INFO - 08:27:52: | x | 0 | 1 | 5 | float | INFO - 08:27:52: | y | 0 | 1 | 3 | float | INFO - 08:27:52: +------+-------------+-------+-------------+-------+ INFO - 08:27:52: Solving optimization problem with algorithm OT_OPT_LHS: INFO - 08:27:52: ... 0%| | 0/100 [00:00
Optimization result:
  • Design variables: [1.54297563 1.26991031]
  • Objective function: 30.39964825035985
  • Feasible solution: True


.. GENERATED FROM PYTHON SOURCE LINES 60-68 Post-process scenario --------------------- Lastly, we post-process the scenario by means of the :class:`.ParetoFront` plot which generates a plot or a matrix of plots if there are more than 2 objectives, plots in blue the locally non dominated points for the current two objectives, plots in green the globally (all objectives) Pareto optimal points. The plots in green denote non-feasible points. Note that the user can avoid the display of the non-feasible points. .. GENERATED FROM PYTHON SOURCE LINES 68-87 .. code-block:: default PostFactory().execute( problem, "ParetoFront", show_non_feasible=False, objectives=["compute_binhkorn"], objectives_labels=["f1", "f2"], save=False, show=True, ) PostFactory().execute( problem, "ParetoFront", objectives=["compute_binhkorn"], objectives_labels=["f1", "f2"], save=False, show=True, ) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/post_process/algorithms/images/sphx_glr_plot_pareto_front_binhkorn_001.png :alt: Pareto front :srcset: /examples/post_process/algorithms/images/sphx_glr_plot_pareto_front_binhkorn_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/post_process/algorithms/images/sphx_glr_plot_pareto_front_binhkorn_002.png :alt: Pareto front :srcset: /examples/post_process/algorithms/images/sphx_glr_plot_pareto_front_binhkorn_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.463 seconds) .. _sphx_glr_download_examples_post_process_algorithms_plot_pareto_front_binhkorn.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pareto_front_binhkorn.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pareto_front_binhkorn.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_