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 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
from matplotlib import pyplot as plt

Import

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

configure_logger()

Out:

<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)

Out:

    INFO - 10:04:51: Optimization problem:
    INFO - 10:04:51:    minimize compute_binhkorn(x, y) = (4*x**2+ 4*y**2, (x-5.)**2 + (y-5.)**2)
    INFO - 10:04:51:    with respect to x, y
    INFO - 10:04:51:    subject to constraints:
    INFO - 10:04:51:       ineq1(x, y): (x-5.)**2 + y**2 <= 25. <= 0.0
    INFO - 10:04:51:       ineq2(x, y): (x-8.)**2 + (y+3)**2 >= 7.7 <= 0.0
    INFO - 10:04:51:    over the design space:
    INFO - 10:04:51:    +------+-------------+-------+-------------+-------+
    INFO - 10:04:51:    | name | lower_bound | value | upper_bound | type  |
    INFO - 10:04:51:    +------+-------------+-------+-------------+-------+
    INFO - 10:04:51:    | x    |      0      |   1   |      5      | float |
    INFO - 10:04:51:    | y    |      0      |   1   |      3      | float |
    INFO - 10:04:51:    +------+-------------+-------+-------------+-------+
    INFO - 10:04:51: Solving optimization problem with algorithm OT_OPT_LHS:
    INFO - 10:04:51: Generation of OT_OPT_LHS DOE with OpenTURNS
    INFO - 10:04:51: ...   0%|          | 0/100 [00:00<?, ?it]
    INFO - 10:04:51: ... 100%|██████████| 100/100 [00:00<00:00, 4846.83 it/sec]
    INFO - 10:04:51: Optimization result:
    INFO - 10:04:51:    Optimizer info:
    INFO - 10:04:51:       Status: None
    INFO - 10:04:51:       Message: None
    INFO - 10:04:51:       Number of calls to the objective function by the optimizer: 100
    INFO - 10:04:51:    Solution:
    INFO - 10:04:51:       The solution is feasible.
    INFO - 10:04:51:       Objective: 30.39964825035985
    INFO - 10:04:51:       Standardized constraints:
    INFO - 10:04:51:          ineq1 = [-11.77907222]
    INFO - 10:04:51:          ineq2 = [-38.26307397]
    INFO - 10:04:51:       Design space:
    INFO - 10:04:51:       +------+-------------+-------------------+-------------+-------+
    INFO - 10:04:51:       | name | lower_bound |       value       | upper_bound | type  |
    INFO - 10:04:51:       +------+-------------+-------------------+-------------+-------+
    INFO - 10:04:51:       | x    |      0      | 1.542975634014225 |      5      | float |
    INFO - 10:04:51:       | y    |      0      | 1.269910308585573 |      3      | float |
    INFO - 10:04:51:       +------+-------------+-------------------+-------------+-------+

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",
    save=False,
    show=False,
    show_non_feasible=False,
    objectives=["compute_binhkorn"],
    objectives_labels=["f1", "f2"],
)

PostFactory().execute(
    problem,
    "ParetoFront",
    save=False,
    show=False,
    show_non_feasible=True,
    objectives=["compute_binhkorn"],
    objectives_labels=["f1", "f2"],
)
# Workaround for HTML rendering, instead of ``show=True``
plt.show()
  • Pareto front
  • Pareto front

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

Gallery generated by Sphinx-Gallery