.. 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 Click :ref:`here ` 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 scalable problem based on two strongly coupled disciplines and a weakly one, with the following properties: - 3 shared design parameters, - 2 local design parameters for the first strongly coupled discipline, - 2 coupling variables for the first strongly coupled discipline, - 4 local design parameters for the second strongly coupled discipline, - 3 coupling variables for the second strongly coupled discipline. We would like to solve this MDO problem by means of an MDF formulation. .. GENERATED FROM PYTHON SOURCE LINES 35-45 .. code-block:: default from __future__ import annotations from gemseo.api import configure_logger from gemseo.api import create_scenario from gemseo.api import generate_n2_plot from gemseo.problems.scalable.parametric.problem import TMScalableProblem from matplotlib import pyplot as plt configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 46-48 Instantiation of the scalable problem ------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 48-53 .. code-block:: default n_shared = 3 n_local = [2, 4] n_coupling = [2, 3] problem = TMScalableProblem(n_shared, n_local, n_coupling) .. GENERATED FROM PYTHON SOURCE LINES 54-56 Display the coupling structure ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 56-58 .. 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 59-61 Solve the MDO using an MDF formulation -------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 61-66 .. code-block:: default scenario = create_scenario(problem.disciplines, "MDF", "obj", problem.design_space) scenario.add_constraint("cstr_0", "ineq") scenario.add_constraint("cstr_1", "ineq") scenario.execute({"algo": "NLOPT_SLSQP", "max_iter": 100}) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 14:44:43: INFO - 14:44:43: *** Start MDOScenario execution *** INFO - 14:44:43: MDOScenario INFO - 14:44:43: Disciplines: MainModel SubModel_0 SubModel_1 INFO - 14:44:43: MDO formulation: MDF INFO - 14:44:43: Optimization problem: INFO - 14:44:43: minimize obj(x_local_0, x_local_1, x_shared) INFO - 14:44:43: with respect to x_local_0, x_local_1, x_shared INFO - 14:44:43: subject to constraints: INFO - 14:44:43: cstr_0(x_local_0, x_local_1, x_shared) <= 0.0 INFO - 14:44:43: cstr_1(x_local_0, x_local_1, x_shared) <= 0.0 INFO - 14:44:43: over the design space: INFO - 14:44:43: | Parameter space | INFO - 14:44:43: +-----------+-------------+-------+-------------+-------+----------------------+ INFO - 14:44:43: | name | lower_bound | value | upper_bound | type | Initial distribution | INFO - 14:44:43: +-----------+-------------+-------+-------------+-------+----------------------+ INFO - 14:44:43: | x_local_0 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_local_0 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_local_1 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_local_1 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_local_1 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_local_1 | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_shared | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_shared | 0 | 0.5 | 1 | float | | INFO - 14:44:43: | x_shared | 0 | 0.5 | 1 | float | | INFO - 14:44:43: +-----------+-------------+-------+-------------+-------+----------------------+ INFO - 14:44:43: Solving optimization problem with algorithm NLOPT_SLSQP: INFO - 14:44:43: ... 0%| | 0/100 [00:00` .. 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 `_