.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/scalable/plot_scalable_param_mdf.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_scalable_plot_scalable_param_mdf.py: Parametric scalable MDO problem - MDF ===================================== We define a :class:`~.gemseo.problems.scalable.parametric.scalable_problem.ScalableProblem` with a shared design variable of size 1 and 2 strongly coupled disciplines. The first one has a local design variable of size 1 and a coupling variable of size 2 while the second one has a local design variable of size 3 and a coupling variable of size 4. We would like to solve this MDO problem by means of an MDF formulation. .. GENERATED FROM PYTHON SOURCE LINES 35-48 .. code-block:: default from __future__ import annotations from gemseo import configure_logger from gemseo import execute_algo from gemseo import execute_post from gemseo import generate_n2_plot from gemseo.problems.scalable.parametric.core.scalable_discipline_settings import ( ScalableDisciplineSettings, ) from gemseo.problems.scalable.parametric.scalable_problem import ScalableProblem configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 49-51 Instantiation of the scalable problem ------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 51-55 .. code-block:: default problem = ScalableProblem( [ScalableDisciplineSettings(1, 2), ScalableDisciplineSettings(3, 4)], 1 ) .. GENERATED FROM PYTHON SOURCE LINES 56-58 Display the coupling structure ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 58-60 .. code-block:: default generate_n2_plot(problem.disciplines, save=False, show=True) .. image-sg:: /examples/scalable/images/sphx_glr_plot_scalable_param_mdf_001.png :alt: plot scalable param mdf :srcset: /examples/scalable/images/sphx_glr_plot_scalable_param_mdf_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 61-63 Solve the MDO using an MDF formulation -------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 63-66 .. code-block:: default scenario = problem.create_scenario() scenario.execute({"algo": "NLOPT_SLSQP", "max_iter": 100}) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:25:34: INFO - 16:25:34: *** Start MDOScenario execution *** INFO - 16:25:34: MDOScenario INFO - 16:25:34: Disciplines: MainDiscipline ScalableDiscipline[1] ScalableDiscipline[2] INFO - 16:25:34: MDO formulation: MDF INFO - 16:25:34: Optimization problem: INFO - 16:25:34: minimize f(x_0, x_1, x_2) INFO - 16:25:34: with respect to x_0, x_1, x_2 INFO - 16:25:34: subject to constraints: INFO - 16:25:34: c_1(x_0, x_1, x_2) <= 0.0 INFO - 16:25:34: c_2(x_0, x_1, x_2) <= 0.0 INFO - 16:25:34: over the design space: INFO - 16:25:34: | Parameter space | INFO - 16:25:34: +------+-------------+-------+-------------+-------+----------------------+ INFO - 16:25:34: | name | lower_bound | value | upper_bound | type | Initial distribution | INFO - 16:25:34: +------+-------------+-------+-------------+-------+----------------------+ INFO - 16:25:34: | x_0 | 0 | 0.5 | 1 | float | | INFO - 16:25:34: | x_1 | 0 | 0.5 | 1 | float | | INFO - 16:25:34: | x_2 | 0 | 0.5 | 1 | float | | INFO - 16:25:34: | x_2 | 0 | 0.5 | 1 | float | | INFO - 16:25:34: | x_2 | 0 | 0.5 | 1 | float | | INFO - 16:25:34: +------+-------------+-------+-------------+-------+----------------------+ INFO - 16:25:34: Solving optimization problem with algorithm NLOPT_SLSQP: INFO - 16:25:34: ... 0%| | 0/100 [00:00 .. GENERATED FROM PYTHON SOURCE LINES 72-74 Solve the associated quadratic programming problem -------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 74-77 .. code-block:: default problem = problem.create_quadratic_programming_problem() execute_algo(problem, algo_name="NLOPT_SLSQP", max_iter=100) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:25:36: Optimization problem: INFO - 16:25:36: minimize f = 0.5x'Qx + c'x + d INFO - 16:25:36: with respect to x INFO - 16:25:36: subject to constraints: INFO - 16:25:36: g: Ax-b <= 0 <= 0.0 INFO - 16:25:36: over the design space: INFO - 16:25:36: +------+-------------+-------+-------------+-------+ INFO - 16:25:36: | name | lower_bound | value | upper_bound | type | INFO - 16:25:36: +------+-------------+-------+-------------+-------+ INFO - 16:25:36: | x[0] | 0 | 0.5 | 1 | float | INFO - 16:25:36: | x[1] | 0 | 0.5 | 1 | float | INFO - 16:25:36: | x[2] | 0 | 0.5 | 1 | float | INFO - 16:25:36: | x[3] | 0 | 0.5 | 1 | float | INFO - 16:25:36: | x[4] | 0 | 0.5 | 1 | float | INFO - 16:25:36: +------+-------------+-------+-------------+-------+ INFO - 16:25:36: Solving optimization problem with algorithm NLOPT_SLSQP: INFO - 16:25:36: ... 0%| | 0/100 [00:00 .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 4.217 seconds) .. _sphx_glr_download_examples_scalable_plot_scalable_param_mdf.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_scalable_param_mdf.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_scalable_param_mdf.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_