Pareto front on Binh and Korn problem

In this example, we illustrate the use of the ParetoFront plot on the Binh and Korn multi-objective problem.

from __future__ import annotations

from gemseo.algos.doe.doe_factory import DOEFactory
from gemseo.api import configure_logger
from gemseo.post.post_factory import PostFactory
from gemseo.problems.analytical.binh_korn import BinhKorn

Import

The first step is to import some functions from the API and a method to get the design space.

configure_logger()
<RootLogger root (INFO)>

Import the optimization problem

Then, we instantiate the BinkKorn optimization problem.

problem = BinhKorn()

Create and execute scenario

Then, we create a Design of Experiment factory, and we request the execution a a full-factorial DOE using 100 samples

doe_factory = DOEFactory()
doe_factory.execute(problem, algo_name="OT_OPT_LHS", n_samples=100)
    INFO - 15:56:29: Optimization problem:
    INFO - 15:56:29:    minimize compute_binhkorn(x, y) = (4*x**2+ 4*y**2, (x-5.)**2 + (y-5.)**2)
    INFO - 15:56:29:    with respect to x, y
    INFO - 15:56:29:    subject to constraints:
    INFO - 15:56:29:       ineq1(x, y): (x-5.)**2 + y**2 <= 25. <= 0.0
    INFO - 15:56:29:       ineq2(x, y): (x-8.)**2 + (y+3)**2 >= 7.7 <= 0.0
    INFO - 15:56:29:    over the design space:
    INFO - 15:56:29:    +------+-------------+-------+-------------+-------+
    INFO - 15:56:29:    | name | lower_bound | value | upper_bound | type  |
    INFO - 15:56:29:    +------+-------------+-------+-------------+-------+
    INFO - 15:56:29:    | x    |      0      |   1   |      5      | float |
    INFO - 15:56:29:    | y    |      0      |   1   |      3      | float |
    INFO - 15:56:29:    +------+-------------+-------+-------------+-------+
    INFO - 15:56:29: Solving optimization problem with algorithm OT_OPT_LHS:
    INFO - 15:56:29: ...   0%|          | 0/100 [00:00<?, ?it]
    INFO - 15:56:29: ...   1%|          | 1/100 [00:00<00:00, 2695.57 it/sec, obj=[98.50728236 17.96432773]]
    INFO - 15:56:29: ...   2%|▏         | 2/100 [00:00<00:00, 2035.08 it/sec, obj=[ 5.10086961 36.30607322]]
    INFO - 15:56:29: ...   3%|▎         | 3/100 [00:00<00:00, 1901.03 it/sec, obj=[ 5.73344945 34.53104096]]
    INFO - 15:56:29: ...   4%|▍         | 4/100 [00:00<00:00, 1867.46 it/sec, obj=[ 2.99274814 38.89733089]]
    INFO - 15:56:29: ...   5%|▌         | 5/100 [00:00<00:00, 1809.76 it/sec, obj=[ 1.45355254 43.72252794]]
    INFO - 15:56:29: ...   6%|▌         | 6/100 [00:00<00:00, 1802.32 it/sec, obj=[26.6936315  22.26390516]]
    INFO - 15:56:29: ...   7%|▋         | 7/100 [00:00<00:00, 1802.89 it/sec, obj=[95.06326723 19.21865528]]
    INFO - 15:56:29: ...   8%|▊         | 8/100 [00:00<00:00, 1802.06 it/sec, obj=[11.37121324 33.49445422]]
    INFO - 15:56:29: ...   9%|▉         | 9/100 [00:00<00:00, 1800.73 it/sec, obj=[33.52756721 17.72645069]]
    INFO - 15:56:29: ...  10%|█         | 10/100 [00:00<00:00, 1801.44 it/sec, obj=[ 4.39737722 39.0292696 ]]
    INFO - 15:56:29: ...  11%|█         | 11/100 [00:00<00:00, 1801.18 it/sec, obj=[83.81080473  6.44933463]]
    INFO - 15:56:29: ...  12%|█▏        | 12/100 [00:00<00:00, 1784.87 it/sec, obj=[64.12902701 21.25106868]]
    INFO - 15:56:29: ...  13%|█▎        | 13/100 [00:00<00:00, 1783.00 it/sec, obj=[71.23914138  9.90898899]]
    INFO - 15:56:29: ...  14%|█▍        | 14/100 [00:00<00:00, 1783.51 it/sec, obj=[58.61362754 10.51836124]]
    INFO - 15:56:29: ...  15%|█▌        | 15/100 [00:00<00:00, 1783.85 it/sec, obj=[17.1313131  28.27257144]]
    INFO - 15:56:29: ...  16%|█▌        | 16/100 [00:00<00:00, 1784.76 it/sec, obj=[38.07815452 16.26141839]]
    INFO - 15:56:29: ...  17%|█▋        | 17/100 [00:00<00:00, 1785.79 it/sec, obj=[45.29614269 15.87407947]]
    INFO - 15:56:29: ...  18%|█▊        | 18/100 [00:00<00:00, 1786.20 it/sec, obj=[78.26474617 13.97242459]]
    INFO - 15:56:29: ...  19%|█▉        | 19/100 [00:00<00:00, 1779.19 it/sec, obj=[58.47852866 16.87161502]]
    INFO - 15:56:29: ...  20%|██        | 20/100 [00:00<00:00, 1779.92 it/sec, obj=[ 7.27923171 33.31157275]]
    INFO - 15:56:29: ...  21%|██        | 21/100 [00:00<00:00, 1781.31 it/sec, obj=[15.973784   25.86458657]]
    INFO - 15:56:29: ...  22%|██▏       | 22/100 [00:00<00:00, 1782.64 it/sec, obj=[47.66727367 15.96717933]]
    INFO - 15:56:29: ...  23%|██▎       | 23/100 [00:00<00:00, 1783.52 it/sec, obj=[88.93580164  6.7712213 ]]
    INFO - 15:56:29: ...  24%|██▍       | 24/100 [00:00<00:00, 1784.15 it/sec, obj=[22.10070032 24.30208587]]
    INFO - 15:56:29: ...  25%|██▌       | 25/100 [00:00<00:00, 1785.24 it/sec, obj=[16.24176378 31.32352362]]
    INFO - 15:56:29: ...  26%|██▌       | 26/100 [00:00<00:00, 1780.73 it/sec, obj=[29.38105263 25.45614728]]
    INFO - 15:56:29: ...  27%|██▋       | 27/100 [00:00<00:00, 1780.29 it/sec, obj=[27.91051427 19.91664614]]
    INFO - 15:56:29: ...  28%|██▊       | 28/100 [00:00<00:00, 1780.75 it/sec, obj=[37.28915469 18.0103703 ]]
    INFO - 15:56:29: ...  29%|██▉       | 29/100 [00:00<00:00, 1781.44 it/sec, obj=[ 1.01177424 43.45819442]]
    INFO - 15:56:29: ...  30%|███       | 30/100 [00:00<00:00, 1781.42 it/sec, obj=[85.96675181 10.67473104]]
    INFO - 15:56:29: ...  31%|███       | 31/100 [00:00<00:00, 1781.56 it/sec, obj=[87.34794862  6.40751572]]
    INFO - 15:56:29: ...  32%|███▏      | 32/100 [00:00<00:00, 1782.13 it/sec, obj=[25.57943091 20.74700556]]
    INFO - 15:56:29: ...  33%|███▎      | 33/100 [00:00<00:00, 1779.17 it/sec, obj=[76.39229092 11.95231974]]
    INFO - 15:56:29: ...  34%|███▍      | 34/100 [00:00<00:00, 1779.27 it/sec, obj=[51.64657249 21.13171808]]
    INFO - 15:56:29: ...  35%|███▌      | 35/100 [00:00<00:00, 1780.01 it/sec, obj=[95.8196038   9.31540942]]
    INFO - 15:56:29: ...  36%|███▌      | 36/100 [00:00<00:00, 1780.52 it/sec, obj=[117.01496061   6.96792478]]
    INFO - 15:56:29: ...  37%|███▋      | 37/100 [00:00<00:00, 1780.76 it/sec, obj=[78.37371654 21.95951365]]
    INFO - 15:56:29: ...  38%|███▊      | 38/100 [00:00<00:00, 1781.48 it/sec, obj=[38.21112297 20.46923673]]
    INFO - 15:56:29: ...  39%|███▉      | 39/100 [00:00<00:00, 1782.07 it/sec, obj=[77.87964266 17.24338363]]
    INFO - 15:56:29: ...  40%|████      | 40/100 [00:00<00:00, 1777.38 it/sec, obj=[59.79323468 22.48208172]]
    INFO - 15:56:29: ...  41%|████      | 41/100 [00:00<00:00, 1777.10 it/sec, obj=[34.56674439 21.30358144]]
    INFO - 15:56:29: ...  42%|████▏     | 42/100 [00:00<00:00, 1777.71 it/sec, obj=[ 0.46290462 45.68910522]]
    INFO - 15:56:29: ...  43%|████▎     | 43/100 [00:00<00:00, 1777.81 it/sec, obj=[100.73843409  11.99829359]]
    INFO - 15:56:29: ...  44%|████▍     | 44/100 [00:00<00:00, 1778.14 it/sec, obj=[21.18253098 23.10192252]]
    INFO - 15:56:29: ...  45%|████▌     | 45/100 [00:00<00:00, 1778.75 it/sec, obj=[51.0570421  12.66142788]]
    INFO - 15:56:29: ...  46%|████▌     | 46/100 [00:00<00:00, 1778.87 it/sec, obj=[90.5172837  14.59877358]]
    INFO - 15:56:29: ...  47%|████▋     | 47/100 [00:00<00:00, 1776.91 it/sec, obj=[19.5728568  23.86163594]]
    INFO - 15:56:29: ...  48%|████▊     | 48/100 [00:00<00:00, 1776.87 it/sec, obj=[47.52592344 19.80950276]]
    INFO - 15:56:29: ...  49%|████▉     | 49/100 [00:00<00:00, 1777.19 it/sec, obj=[113.47621648   6.0816867 ]]
    INFO - 15:56:29: ...  50%|█████     | 50/100 [00:00<00:00, 1777.34 it/sec, obj=[37.3534796  16.14867587]]
    INFO - 15:56:29: ...  51%|█████     | 51/100 [00:00<00:00, 1777.35 it/sec, obj=[41.42991507 25.64561402]]
    INFO - 15:56:29: ...  52%|█████▏    | 52/100 [00:00<00:00, 1777.97 it/sec, obj=[11.19222105 30.06624599]]
    INFO - 15:56:29: ...  53%|█████▎    | 53/100 [00:00<00:00, 1778.56 it/sec, obj=[86.67968625 15.70216699]]
    INFO - 15:56:29: ...  54%|█████▍    | 54/100 [00:00<00:00, 1776.86 it/sec, obj=[90.96123503  7.41344494]]
    INFO - 15:56:29: ...  55%|█████▌    | 55/100 [00:00<00:00, 1776.56 it/sec, obj=[34.69157131 20.23247304]]
    INFO - 15:56:29: ...  56%|█████▌    | 56/100 [00:00<00:00, 1776.88 it/sec, obj=[56.73716821 11.35918483]]
    INFO - 15:56:29: ...  57%|█████▋    | 57/100 [00:00<00:00, 1777.19 it/sec, obj=[58.33058905 10.70125973]]
    INFO - 15:56:29: ...  58%|█████▊    | 58/100 [00:00<00:00, 1777.70 it/sec, obj=[19.48697889 32.41188233]]
    INFO - 15:56:29: ...  59%|█████▉    | 59/100 [00:00<00:00, 1773.62 it/sec, obj=[ 9.51315338 32.51410675]]
    INFO - 15:56:29: ...  60%|██████    | 60/100 [00:00<00:00, 1773.62 it/sec, obj=[14.29503909 27.34400969]]
    INFO - 15:56:29: ...  61%|██████    | 61/100 [00:00<00:00, 1771.53 it/sec, obj=[21.01471588 31.54351738]]
    INFO - 15:56:29: ...  62%|██████▏   | 62/100 [00:00<00:00, 1770.93 it/sec, obj=[32.62517737 26.61449355]]
    INFO - 15:56:29: ...  63%|██████▎   | 63/100 [00:00<00:00, 1771.31 it/sec, obj=[54.44405197 15.56114393]]
    INFO - 15:56:29: ...  64%|██████▍   | 64/100 [00:00<00:00, 1771.92 it/sec, obj=[31.67860311 19.0346702 ]]
    INFO - 15:56:29: ...  65%|██████▌   | 65/100 [00:00<00:00, 1772.53 it/sec, obj=[12.95434975 27.79409607]]
    INFO - 15:56:29: ...  66%|██████▌   | 66/100 [00:00<00:00, 1772.93 it/sec, obj=[33.53586239 22.39126054]]
    INFO - 15:56:29: ...  67%|██████▋   | 67/100 [00:00<00:00, 1773.36 it/sec, obj=[13.77290554 32.89122016]]
    INFO - 15:56:29: ...  68%|██████▊   | 68/100 [00:00<00:00, 1773.04 it/sec, obj=[24.55394276 22.04978627]]
    INFO - 15:56:29: ...  69%|██████▉   | 69/100 [00:00<00:00, 1772.06 it/sec, obj=[38.26118694 15.93322028]]
    INFO - 15:56:29: ...  70%|███████   | 70/100 [00:00<00:00, 1772.49 it/sec, obj=[69.87762034 24.69083953]]
    INFO - 15:56:29: ...  71%|███████   | 71/100 [00:00<00:00, 1772.85 it/sec, obj=[117.708931     4.51806144]]
    INFO - 15:56:29: ...  72%|███████▏  | 72/100 [00:00<00:00, 1773.27 it/sec, obj=[24.18294227 29.58378487]]
    INFO - 15:56:29: ...  73%|███████▎  | 73/100 [00:00<00:00, 1773.77 it/sec, obj=[65.41388231 10.29184587]]
    INFO - 15:56:29: ...  74%|███████▍  | 74/100 [00:00<00:00, 1773.93 it/sec, obj=[12.24819086 35.25245724]]
    INFO - 15:56:29: ...  75%|███████▌  | 75/100 [00:00<00:00, 1774.35 it/sec, obj=[25.31003032 24.72346394]]
    INFO - 15:56:29: ...  76%|███████▌  | 76/100 [00:00<00:00, 1772.10 it/sec, obj=[49.90530196 13.18421478]]
    INFO - 15:56:29: ...  77%|███████▋  | 77/100 [00:00<00:00, 1772.31 it/sec, obj=[13.58752584 29.15968355]]
    INFO - 15:56:29: ...  78%|███████▊  | 78/100 [00:00<00:00, 1772.63 it/sec, obj=[ 7.8547085  33.00337593]]
    INFO - 15:56:29: ...  79%|███████▉  | 79/100 [00:00<00:00, 1772.76 it/sec, obj=[34.10323875 25.61801713]]
    INFO - 15:56:29: ...  80%|████████  | 80/100 [00:00<00:00, 1773.16 it/sec, obj=[50.66487602 26.86160736]]
    INFO - 15:56:29: ...  81%|████████  | 81/100 [00:00<00:00, 1773.63 it/sec, obj=[19.81349957 25.42966204]]
    INFO - 15:56:29: ...  82%|████████▏ | 82/100 [00:00<00:00, 1774.10 it/sec, obj=[ 7.4546377  34.97394601]]
    INFO - 15:56:29: ...  83%|████████▎ | 83/100 [00:00<00:00, 1772.80 it/sec, obj=[106.96361831   5.44850984]]
    INFO - 15:56:29: ...  84%|████████▍ | 84/100 [00:00<00:00, 1772.95 it/sec, obj=[ 5.36344422 38.7517519 ]]
    INFO - 15:56:29: ...  85%|████████▌ | 85/100 [00:00<00:00, 1773.15 it/sec, obj=[49.116045   14.30366519]]
    INFO - 15:56:29: ...  86%|████████▌ | 86/100 [00:00<00:00, 1773.48 it/sec, obj=[65.46370949  9.53265669]]
    INFO - 15:56:29: ...  87%|████████▋ | 87/100 [00:00<00:00, 1773.83 it/sec, obj=[34.43204876 18.46542147]]
    INFO - 15:56:29: ...  88%|████████▊ | 88/100 [00:00<00:00, 1774.13 it/sec, obj=[89.05896719 23.04880076]]
    INFO - 15:56:29: ...  89%|████████▉ | 89/100 [00:00<00:00, 1774.48 it/sec, obj=[28.30965373 24.49805668]]
    INFO - 15:56:29: ...  90%|█████████ | 90/100 [00:00<00:00, 1773.34 it/sec, obj=[39.10277528 23.64680578]]
    INFO - 15:56:29: ...  91%|█████████ | 91/100 [00:00<00:00, 1773.42 it/sec, obj=[117.48545685   8.18526365]]
    INFO - 15:56:29: ...  92%|█████████▏| 92/100 [00:00<00:00, 1773.69 it/sec, obj=[66.02068516 15.50045449]]
    INFO - 15:56:29: ...  93%|█████████▎| 93/100 [00:00<00:00, 1774.06 it/sec, obj=[67.39952092 12.92818287]]
    INFO - 15:56:29: ...  94%|█████████▍| 94/100 [00:00<00:00, 1774.20 it/sec, obj=[55.28167693 13.5771757 ]]
    INFO - 15:56:29: ...  95%|█████████▌| 95/100 [00:00<00:00, 1774.38 it/sec, obj=[17.335399   26.84155459]]
    INFO - 15:56:29: ...  96%|█████████▌| 96/100 [00:00<00:00, 1774.74 it/sec, obj=[ 4.93473731 35.93049995]]
    INFO - 15:56:29: ...  97%|█████████▋| 97/100 [00:00<00:00, 1773.76 it/sec, obj=[25.16386975 26.89754332]]
    INFO - 15:56:29: ...  98%|█████████▊| 98/100 [00:00<00:00, 1773.87 it/sec, obj=[81.61206359 10.43246637]]
    INFO - 15:56:29: ...  99%|█████████▉| 99/100 [00:00<00:00, 1774.02 it/sec, obj=[40.83406128 15.59204339]]
    INFO - 15:56:29: ... 100%|██████████| 100/100 [00:00<00:00, 1774.20 it/sec, obj=[52.02690192 12.02601654]]
    INFO - 15:56:29: Optimization result:
    INFO - 15:56:29:    Optimizer info:
    INFO - 15:56:29:       Status: None
    INFO - 15:56:29:       Message: None
    INFO - 15:56:29:       Number of calls to the objective function by the optimizer: 100
    INFO - 15:56:29:    Solution:
    INFO - 15:56:29:       The solution is feasible.
    INFO - 15:56:29:       Objective: 30.39964825035985
    INFO - 15:56:29:       Standardized constraints:
    INFO - 15:56:29:          ineq1 = [-11.77907222]
    INFO - 15:56:29:          ineq2 = [-38.26307397]
    INFO - 15:56:29:       Design space:
    INFO - 15:56:29:       +------+-------------+-------------------+-------------+-------+
    INFO - 15:56:29:       | name | lower_bound |       value       | upper_bound | type  |
    INFO - 15:56:29:       +------+-------------+-------------------+-------------+-------+
    INFO - 15:56:29:       | x    |      0      | 1.542975634014225 |      5      | float |
    INFO - 15:56:29:       | y    |      0      | 1.269910308585573 |      3      | float |
    INFO - 15:56:29:       +------+-------------+-------------------+-------------+-------+

Optimization result:
   Design variables: [1.54297563 1.26991031]
   Objective function: 30.39964825035985
   Feasible solution: True

Post-process scenario

Lastly, we post-process the scenario by means of the 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 denotes non-feasible points. Note that the user can avoid the display of the non-feasible points.

PostFactory().execute(
    problem,
    "ParetoFront",
    show_non_feasible=False,
    objectives=["compute_binhkorn"],
    objectives_labels=["f1", "f2"],
    save=False,
    show=True,
)

PostFactory().execute(
    problem,
    "ParetoFront",
    show_non_feasible=True,
    objectives=["compute_binhkorn"],
    objectives_labels=["f1", "f2"],
    save=False,
    show=True,
)
  • Pareto front
  • Pareto front
<gemseo.post.pareto_front.ParetoFront object at 0x7ff1ae8ec2e0>

Total running time of the script: ( 0 minutes 0.476 seconds)

Gallery generated by Sphinx-Gallery