.. 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 a multi-objective 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 27-34 .. code-block:: Python from __future__ import annotations from gemseo.algos.doe.factory import DOELibraryFactory from gemseo.post.factory import PostFactory from gemseo.problems.multiobjective_optimization.binh_korn import BinhKorn .. GENERATED FROM PYTHON SOURCE LINES 35-38 Import the optimization problem ------------------------------- Then, we instantiate the Binh and Korn optimization problem (see :class:`.BinhKorn`). .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python problem = BinhKorn() .. GENERATED FROM PYTHON SOURCE LINES 42-47 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 47-50 .. code-block:: Python doe_factory = DOELibraryFactory() doe_factory.execute(problem, algo_name="OT_OPT_LHS", n_samples=100) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:14:12: Optimization problem: INFO - 16:14:12: minimize compute_binhkorn(x, y) = (4*x**2+ 4*y**2, (x-5.)**2 + (y-5.)**2) INFO - 16:14:12: with respect to x, y INFO - 16:14:12: under the inequality constraints INFO - 16:14:12: ineq1(x, y): (x-5.)**2 + y**2 <= 25. <= 0.0 INFO - 16:14:12: ineq2(x, y): (x-8.)**2 + (y+3)**2 >= 7.7 <= 0.0 INFO - 16:14:12: over the design space: INFO - 16:14:12: +------+-------------+-------+-------------+-------+ INFO - 16:14:12: | Name | Lower bound | Value | Upper bound | Type | INFO - 16:14:12: +------+-------------+-------+-------------+-------+ INFO - 16:14:12: | x | 0 | 1 | 5 | float | INFO - 16:14:12: | y | 0 | 1 | 3 | float | INFO - 16:14:12: +------+-------------+-------+-------------+-------+ INFO - 16:14:12: Solving optimization problem with algorithm OT_OPT_LHS: INFO - 16:14:12: 1%| | 1/100 [00:00<00:00, 2552.83 it/sec, feas=True, obj=[98.50728236 17.96432773]] INFO - 16:14:12: 2%|▏ | 2/100 [00:00<00:00, 2023.79 it/sec, feas=True, obj=[ 5.10086961 36.30607322]] INFO - 16:14:12: 3%|▎ | 3/100 [00:00<00:00, 2016.82 it/sec, feas=True, obj=[ 5.73344945 34.53104096]] INFO - 16:14:12: 4%|▍ | 4/100 [00:00<00:00, 1904.77 it/sec, feas=True, obj=[ 2.99274814 38.89733089]] INFO - 16:14:12: 5%|▌ | 5/100 [00:00<00:00, 1900.28 it/sec, feas=True, obj=[ 1.45355254 43.72252794]] INFO - 16:14:12: 6%|▌ | 6/100 [00:00<00:00, 1919.88 it/sec, feas=True, obj=[26.6936315 22.26390516]] INFO - 16:14:12: 7%|▋ | 7/100 [00:00<00:00, 1937.71 it/sec, feas=True, obj=[95.06326723 19.21865528]] INFO - 16:14:12: 8%|▊ | 8/100 [00:00<00:00, 1951.29 it/sec, feas=True, obj=[11.37121324 33.49445422]] INFO - 16:14:12: 9%|▉ | 9/100 [00:00<00:00, 1967.51 it/sec, feas=True, obj=[33.52756721 17.72645069]] INFO - 16:14:12: 10%|█ | 10/100 [00:00<00:00, 1949.21 it/sec, feas=True, obj=[ 4.39737722 39.0292696 ]] INFO - 16:14:12: 11%|█ | 11/100 [00:00<00:00, 1950.01 it/sec, feas=True, obj=[83.81080473 6.44933463]] INFO - 16:14:12: 12%|█▏ | 12/100 [00:00<00:00, 1955.08 it/sec, feas=True, obj=[64.12902701 21.25106868]] INFO - 16:14:12: 13%|█▎ | 13/100 [00:00<00:00, 1911.11 it/sec, feas=True, obj=[71.23914138 9.90898899]] INFO - 16:14:12: 14%|█▍ | 14/100 [00:00<00:00, 1921.79 it/sec, feas=True, obj=[58.61362754 10.51836124]] INFO - 16:14:12: 15%|█▌ | 15/100 [00:00<00:00, 1922.23 it/sec, feas=True, obj=[17.1313131 28.27257144]] INFO - 16:14:12: 16%|█▌ | 16/100 [00:00<00:00, 1930.14 it/sec, feas=True, obj=[38.07815452 16.26141839]] INFO - 16:14:12: 17%|█▋ | 17/100 [00:00<00:00, 1924.72 it/sec, feas=True, obj=[45.29614269 15.87407947]] INFO - 16:14:12: 18%|█▊ | 18/100 [00:00<00:00, 1924.38 it/sec, feas=True, obj=[78.26474617 13.97242459]] INFO - 16:14:12: 19%|█▉ | 19/100 [00:00<00:00, 1921.44 it/sec, feas=True, obj=[58.47852866 16.87161502]] INFO - 16:14:12: 20%|██ | 20/100 [00:00<00:00, 1923.64 it/sec, feas=True, obj=[ 7.27923171 33.31157275]] INFO - 16:14:12: 21%|██ | 21/100 [00:00<00:00, 1927.28 it/sec, feas=True, obj=[15.973784 25.86458657]] INFO - 16:14:12: 22%|██▏ | 22/100 [00:00<00:00, 1936.02 it/sec, feas=True, obj=[47.66727367 15.96717933]] INFO - 16:14:12: 23%|██▎ | 23/100 [00:00<00:00, 1931.58 it/sec, feas=True, obj=[88.93580164 6.7712213 ]] INFO - 16:14:12: 24%|██▍ | 24/100 [00:00<00:00, 1935.16 it/sec, feas=True, obj=[22.10070032 24.30208587]] INFO - 16:14:12: 25%|██▌ | 25/100 [00:00<00:00, 1934.43 it/sec, feas=True, obj=[16.24176378 31.32352362]] INFO - 16:14:12: 26%|██▌ | 26/100 [00:00<00:00, 1942.81 it/sec, feas=True, obj=[29.38105263 25.45614728]] INFO - 16:14:12: 27%|██▋ | 27/100 [00:00<00:00, 1942.67 it/sec, feas=True, obj=[27.91051427 19.91664614]] INFO - 16:14:12: 28%|██▊ | 28/100 [00:00<00:00, 1942.58 it/sec, feas=True, obj=[37.28915469 18.0103703 ]] INFO - 16:14:12: 29%|██▉ | 29/100 [00:00<00:00, 1943.73 it/sec, feas=True, obj=[ 1.01177424 43.45819442]] INFO - 16:14:12: 30%|███ | 30/100 [00:00<00:00, 1950.11 it/sec, feas=True, obj=[85.96675181 10.67473104]] INFO - 16:14:12: 31%|███ | 31/100 [00:00<00:00, 1950.60 it/sec, feas=True, obj=[87.34794862 6.40751572]] INFO - 16:14:12: 32%|███▏ | 32/100 [00:00<00:00, 1956.13 it/sec, feas=True, obj=[25.57943091 20.74700556]] INFO - 16:14:12: 33%|███▎ | 33/100 [00:00<00:00, 1952.55 it/sec, feas=True, obj=[76.39229092 11.95231974]] INFO - 16:14:12: 34%|███▍ | 34/100 [00:00<00:00, 1958.42 it/sec, feas=True, obj=[51.64657249 21.13171808]] INFO - 16:14:12: 35%|███▌ | 35/100 [00:00<00:00, 1959.07 it/sec, feas=True, obj=[95.8196038 9.31540942]] INFO - 16:14:12: 36%|███▌ | 36/100 [00:00<00:00, 1965.06 it/sec, feas=True, obj=[117.01496061 6.96792478]] INFO - 16:14:12: 37%|███▋ | 37/100 [00:00<00:00, 1965.64 it/sec, feas=True, obj=[78.37371654 21.95951365]] INFO - 16:14:12: 38%|███▊ | 38/100 [00:00<00:00, 1964.79 it/sec, feas=True, obj=[38.21112297 20.46923673]] INFO - 16:14:12: 39%|███▉ | 39/100 [00:00<00:00, 1964.66 it/sec, feas=True, obj=[77.87964266 17.24338363]] INFO - 16:14:12: 40%|████ | 40/100 [00:00<00:00, 1968.69 it/sec, feas=True, obj=[59.79323468 22.48208172]] INFO - 16:14:12: 41%|████ | 41/100 [00:00<00:00, 1967.78 it/sec, feas=True, obj=[34.56674439 21.30358144]] INFO - 16:14:12: 42%|████▏ | 42/100 [00:00<00:00, 1971.78 it/sec, feas=True, obj=[ 0.46290462 45.68910522]] INFO - 16:14:12: 43%|████▎ | 43/100 [00:00<00:00, 1968.96 it/sec, feas=True, obj=[100.73843409 11.99829359]] INFO - 16:14:12: 44%|████▍ | 44/100 [00:00<00:00, 1971.20 it/sec, feas=True, obj=[21.18253098 23.10192252]] INFO - 16:14:12: 45%|████▌ | 45/100 [00:00<00:00, 1970.16 it/sec, feas=True, obj=[51.0570421 12.66142788]] INFO - 16:14:12: 46%|████▌ | 46/100 [00:00<00:00, 1973.75 it/sec, feas=True, obj=[90.5172837 14.59877358]] INFO - 16:14:12: 47%|████▋ | 47/100 [00:00<00:00, 1973.53 it/sec, feas=True, obj=[19.5728568 23.86163594]] INFO - 16:14:12: 48%|████▊ | 48/100 [00:00<00:00, 1977.18 it/sec, feas=True, obj=[47.52592344 19.80950276]] INFO - 16:14:12: 49%|████▉ | 49/100 [00:00<00:00, 1975.52 it/sec, feas=True, obj=[113.47621648 6.0816867 ]] INFO - 16:14:12: 50%|█████ | 50/100 [00:00<00:00, 1978.76 it/sec, feas=True, obj=[37.3534796 16.14867587]] INFO - 16:14:12: 51%|█████ | 51/100 [00:00<00:00, 1979.23 it/sec, feas=True, obj=[41.42991507 25.64561402]] INFO - 16:14:12: 52%|█████▏ | 52/100 [00:00<00:00, 1983.07 it/sec, feas=True, obj=[11.19222105 30.06624599]] INFO - 16:14:12: 53%|█████▎ | 53/100 [00:00<00:00, 1985.05 it/sec, feas=True, obj=[86.67968625 15.70216699]] INFO - 16:14:12: 54%|█████▍ | 54/100 [00:00<00:00, 1986.74 it/sec, feas=True, obj=[90.96123503 7.41344494]] INFO - 16:14:12: 55%|█████▌ | 55/100 [00:00<00:00, 1987.56 it/sec, feas=True, obj=[34.69157131 20.23247304]] INFO - 16:14:12: 56%|█████▌ | 56/100 [00:00<00:00, 1988.46 it/sec, feas=True, obj=[56.73716821 11.35918483]] INFO - 16:14:12: 57%|█████▋ | 57/100 [00:00<00:00, 1977.55 it/sec, feas=True, obj=[58.33058905 10.70125973]] INFO - 16:14:12: 58%|█████▊ | 58/100 [00:00<00:00, 1974.54 it/sec, feas=False, obj=[19.48697889 32.41188233]] INFO - 16:14:12: 59%|█████▉ | 59/100 [00:00<00:00, 1974.97 it/sec, feas=True, obj=[ 9.51315338 32.51410675]] INFO - 16:14:12: 60%|██████ | 60/100 [00:00<00:00, 1973.68 it/sec, feas=True, obj=[14.29503909 27.34400969]] INFO - 16:14:12: 61%|██████ | 61/100 [00:00<00:00, 1974.03 it/sec, feas=True, obj=[21.01471588 31.54351738]] INFO - 16:14:12: 62%|██████▏ | 62/100 [00:00<00:00, 1975.12 it/sec, feas=True, obj=[32.62517737 26.61449355]] INFO - 16:14:12: 63%|██████▎ | 63/100 [00:00<00:00, 1975.62 it/sec, feas=True, obj=[54.44405197 15.56114393]] INFO - 16:14:12: 64%|██████▍ | 64/100 [00:00<00:00, 1977.34 it/sec, feas=True, obj=[31.67860311 19.0346702 ]] INFO - 16:14:12: 65%|██████▌ | 65/100 [00:00<00:00, 1977.40 it/sec, feas=True, obj=[12.95434975 27.79409607]] INFO - 16:14:12: 66%|██████▌ | 66/100 [00:00<00:00, 1976.43 it/sec, feas=True, obj=[33.53586239 22.39126054]] INFO - 16:14:12: 67%|██████▋ | 67/100 [00:00<00:00, 1977.61 it/sec, feas=True, obj=[13.77290554 32.89122016]] INFO - 16:14:12: 68%|██████▊ | 68/100 [00:00<00:00, 1978.68 it/sec, feas=True, obj=[24.55394276 22.04978627]] INFO - 16:14:12: 69%|██████▉ | 69/100 [00:00<00:00, 1978.42 it/sec, feas=True, obj=[38.26118694 15.93322028]] INFO - 16:14:12: 70%|███████ | 70/100 [00:00<00:00, 1979.43 it/sec, feas=True, obj=[69.87762034 24.69083953]] INFO - 16:14:12: 71%|███████ | 71/100 [00:00<00:00, 1978.47 it/sec, feas=True, obj=[117.708931 4.51806144]] INFO - 16:14:12: 72%|███████▏ | 72/100 [00:00<00:00, 1978.24 it/sec, feas=False, obj=[24.18294227 29.58378487]] INFO - 16:14:12: 73%|███████▎ | 73/100 [00:00<00:00, 1977.90 it/sec, feas=True, obj=[65.41388231 10.29184587]] INFO - 16:14:12: 74%|███████▍ | 74/100 [00:00<00:00, 1979.11 it/sec, feas=True, obj=[12.24819086 35.25245724]] INFO - 16:14:12: 75%|███████▌ | 75/100 [00:00<00:00, 1980.00 it/sec, feas=True, obj=[25.31003032 24.72346394]] INFO - 16:14:12: 76%|███████▌ | 76/100 [00:00<00:00, 1981.15 it/sec, feas=True, obj=[49.90530196 13.18421478]] INFO - 16:14:12: 77%|███████▋ | 77/100 [00:00<00:00, 1981.60 it/sec, feas=True, obj=[13.58752584 29.15968355]] INFO - 16:14:12: 78%|███████▊ | 78/100 [00:00<00:00, 1982.62 it/sec, feas=True, obj=[ 7.8547085 33.00337593]] INFO - 16:14:12: 79%|███████▉ | 79/100 [00:00<00:00, 1982.46 it/sec, feas=True, obj=[34.10323875 25.61801713]] INFO - 16:14:12: 80%|████████ | 80/100 [00:00<00:00, 1983.46 it/sec, feas=True, obj=[50.66487602 26.86160736]] INFO - 16:14:12: 81%|████████ | 81/100 [00:00<00:00, 1981.64 it/sec, feas=True, obj=[19.81349957 25.42966204]] INFO - 16:14:12: 82%|████████▏ | 82/100 [00:00<00:00, 1981.02 it/sec, feas=True, obj=[ 7.4546377 34.97394601]] INFO - 16:14:12: 83%|████████▎ | 83/100 [00:00<00:00, 1982.15 it/sec, feas=True, obj=[106.96361831 5.44850984]] INFO - 16:14:12: 84%|████████▍ | 84/100 [00:00<00:00, 1982.37 it/sec, feas=False, obj=[ 5.36344422 38.7517519 ]] INFO - 16:14:12: 85%|████████▌ | 85/100 [00:00<00:00, 1982.38 it/sec, feas=True, obj=[49.116045 14.30366519]] INFO - 16:14:12: 86%|████████▌ | 86/100 [00:00<00:00, 1984.51 it/sec, feas=True, obj=[65.46370949 9.53265669]] INFO - 16:14:12: 87%|████████▋ | 87/100 [00:00<00:00, 1984.17 it/sec, feas=True, obj=[34.43204876 18.46542147]] INFO - 16:14:12: 88%|████████▊ | 88/100 [00:00<00:00, 1986.09 it/sec, feas=True, obj=[89.05896719 23.04880076]] INFO - 16:14:12: 89%|████████▉ | 89/100 [00:00<00:00, 1984.77 it/sec, feas=True, obj=[28.30965373 24.49805668]] INFO - 16:14:12: 90%|█████████ | 90/100 [00:00<00:00, 1986.78 it/sec, feas=True, obj=[39.10277528 23.64680578]] INFO - 16:14:12: 91%|█████████ | 91/100 [00:00<00:00, 1986.10 it/sec, feas=True, obj=[117.48545685 8.18526365]] INFO - 16:14:12: 92%|█████████▏| 92/100 [00:00<00:00, 1987.91 it/sec, feas=True, obj=[66.02068516 15.50045449]] INFO - 16:14:12: 93%|█████████▎| 93/100 [00:00<00:00, 1987.47 it/sec, feas=True, obj=[67.39952092 12.92818287]] INFO - 16:14:12: 94%|█████████▍| 94/100 [00:00<00:00, 1989.33 it/sec, feas=True, obj=[55.28167693 13.5771757 ]] INFO - 16:14:12: 95%|█████████▌| 95/100 [00:00<00:00, 1990.50 it/sec, feas=True, obj=[17.335399 26.84155459]] INFO - 16:14:12: 96%|█████████▌| 96/100 [00:00<00:00, 1991.46 it/sec, feas=True, obj=[ 4.93473731 35.93049995]] INFO - 16:14:12: 97%|█████████▋| 97/100 [00:00<00:00, 1992.54 it/sec, feas=True, obj=[25.16386975 26.89754332]] INFO - 16:14:12: 98%|█████████▊| 98/100 [00:00<00:00, 1992.84 it/sec, feas=True, obj=[81.61206359 10.43246637]] INFO - 16:14:12: 99%|█████████▉| 99/100 [00:00<00:00, 1993.67 it/sec, feas=True, obj=[40.83406128 15.59204339]] INFO - 16:14:12: 100%|██████████| 100/100 [00:00<00:00, 1940.90 it/sec, feas=True, obj=[52.02690192 12.02601654]] INFO - 16:14:12: Optimization result: INFO - 16:14:12: Optimizer info: INFO - 16:14:12: Status: None INFO - 16:14:12: Message: None INFO - 16:14:12: Solution: INFO - 16:14:12: The solution is feasible. INFO - 16:14:12: Objective: 30.399648250359846 INFO - 16:14:12: Standardized constraints: INFO - 16:14:12: ineq1 = [-11.77907222] INFO - 16:14:12: ineq2 = [-38.26307397] INFO - 16:14:12: Design space: INFO - 16:14:12: +------+-------------+-------------------+-------------+-------+ INFO - 16:14:12: | Name | Lower bound | Value | Upper bound | Type | INFO - 16:14:12: +------+-------------+-------------------+-------------+-------+ INFO - 16:14:12: | x | 0 | 1.542975634014225 | 5 | float | INFO - 16:14:12: | y | 0 | 1.269910308585573 | 3 | float | INFO - 16:14:12: +------+-------------+-------------------+-------------+-------+ .. raw:: html
Optimization result:
  • Design variables: [1.54297563 1.26991031]
  • Objective function: 30.399648250359846
  • Feasible solution: True


.. GENERATED FROM PYTHON SOURCE LINES 51-59 Post-processing --------------- 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 59-78 .. code-block:: Python PostFactory().execute( problem, post_name="ParetoFront", show_non_feasible=False, objectives=["compute_binhkorn"], objectives_labels=["f1", "f2"], save=False, show=True, ) PostFactory().execute( problem, post_name="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.374 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-jupyter :download:`Download Jupyter notebook: plot_pareto_front_binhkorn.ipynb ` .. 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-zip :download:`Download zipped: plot_pareto_front_binhkorn.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_