.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/doe/plot_sobieski_doe_disc_example.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_doe_plot_sobieski_doe_disc_example.py: Simple disciplinary DOE example on the Sobieski SSBJ test case ============================================================== .. GENERATED FROM PYTHON SOURCE LINES 24-35 .. code-block:: Python from __future__ import annotations from gemseo import configure_logger from gemseo import create_discipline from gemseo import create_scenario from gemseo.problems.mdo.sobieski.core.design_space import SobieskiDesignSpace configure_logger() .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 36-38 Instantiate the discipline -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 38-40 .. code-block:: Python discipline = create_discipline("SobieskiMission") .. GENERATED FROM PYTHON SOURCE LINES 41-43 Create the design space ----------------------- .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: Python design_space = SobieskiDesignSpace() design_space.filter(["y_24", "y_34"]) .. raw:: html
Sobieski design space:
Name Lower bound Value Upper bound Type
y_24 0.44 4.15006276 11.13 float
y_34 0.44 1.10754577 1.98 float


.. GENERATED FROM PYTHON SOURCE LINES 47-51 Create the scenario ----------------------- Build scenario which links the disciplines with the formulation and The DOE algorithm. .. GENERATED FROM PYTHON SOURCE LINES 51-60 .. code-block:: Python scenario = create_scenario( [discipline], "y_4", design_space, maximize_objective=True, scenario_type="DOE", formulation_name="DisciplinaryOpt", ) .. GENERATED FROM PYTHON SOURCE LINES 61-64 Execute the scenario ----------------------- Here we use a latin hypercube sampling algorithm with 30 samples. .. GENERATED FROM PYTHON SOURCE LINES 64-66 .. code-block:: Python scenario.execute(algo_name="PYDOE_LHS", n_samples=30) .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 20:38:57: *** Start DOEScenario execution *** INFO - 20:38:57: DOEScenario INFO - 20:38:57: Disciplines: SobieskiMission INFO - 20:38:57: MDO formulation: DisciplinaryOpt INFO - 20:38:57: Optimization problem: INFO - 20:38:57: minimize -y_4(y_24, y_34) INFO - 20:38:57: with respect to y_24, y_34 INFO - 20:38:57: over the design space: INFO - 20:38:57: +------+-------------+------------+-------------+-------+ INFO - 20:38:57: | Name | Lower bound | Value | Upper bound | Type | INFO - 20:38:57: +------+-------------+------------+-------------+-------+ INFO - 20:38:57: | y_24 | 0.44 | 4.15006276 | 11.13 | float | INFO - 20:38:57: | y_34 | 0.44 | 1.10754577 | 1.98 | float | INFO - 20:38:57: +------+-------------+------------+-------------+-------+ INFO - 20:38:57: Solving optimization problem with algorithm PYDOE_LHS: INFO - 20:38:57: 3%|▎ | 1/30 [00:00<00:00, 374.49 it/sec, obj=-1.53e+3] INFO - 20:38:57: 7%|▋ | 2/30 [00:00<00:00, 666.98 it/sec, obj=-1.66e+3] INFO - 20:38:57: 10%|█ | 3/30 [00:00<00:00, 916.92 it/sec, obj=-832] INFO - 20:38:57: 13%|█▎ | 4/30 [00:00<00:00, 1138.44 it/sec, obj=-1.62e+3] INFO - 20:38:57: 17%|█▋ | 5/30 [00:00<00:00, 1337.38 it/sec, obj=-994] INFO - 20:38:57: 20%|██ | 6/30 [00:00<00:00, 1515.37 it/sec, obj=-601] INFO - 20:38:57: 23%|██▎ | 7/30 [00:00<00:00, 1678.39 it/sec, obj=-180] INFO - 20:38:57: 27%|██▋ | 8/30 [00:00<00:00, 1817.19 it/sec, obj=-755] INFO - 20:38:57: 30%|███ | 9/30 [00:00<00:00, 1952.25 it/sec, obj=-691] INFO - 20:38:57: 33%|███▎ | 10/30 [00:00<00:00, 2064.53 it/sec, obj=-393] INFO - 20:38:57: 37%|███▋ | 11/30 [00:00<00:00, 2169.74 it/sec, obj=-362] INFO - 20:38:57: 40%|████ | 12/30 [00:00<00:00, 2263.83 it/sec, obj=-748] INFO - 20:38:57: 43%|████▎ | 13/30 [00:00<00:00, 2357.37 it/sec, obj=-719] INFO - 20:38:57: 47%|████▋ | 14/30 [00:00<00:00, 2446.68 it/sec, obj=-293] INFO - 20:38:57: 50%|█████ | 15/30 [00:00<00:00, 2529.53 it/sec, obj=-931] INFO - 20:38:57: 53%|█████▎ | 16/30 [00:00<00:00, 2606.07 it/sec, obj=-264] INFO - 20:38:57: 57%|█████▋ | 17/30 [00:00<00:00, 2663.35 it/sec, obj=-1.17e+3] INFO - 20:38:57: 60%|██████ | 18/30 [00:00<00:00, 2729.09 it/sec, obj=-495] INFO - 20:38:57: 63%|██████▎ | 19/30 [00:00<00:00, 2785.84 it/sec, obj=-189] INFO - 20:38:57: 67%|██████▋ | 20/30 [00:00<00:00, 2848.42 it/sec, obj=-2.23e+3] INFO - 20:38:57: 70%|███████ | 21/30 [00:00<00:00, 2897.29 it/sec, obj=-344] INFO - 20:38:57: 73%|███████▎ | 22/30 [00:00<00:00, 2946.10 it/sec, obj=-799] INFO - 20:38:57: 77%|███████▋ | 23/30 [00:00<00:00, 2996.86 it/sec, obj=-55.9] INFO - 20:38:57: 80%|████████ | 24/30 [00:00<00:00, 3047.54 it/sec, obj=-123] INFO - 20:38:57: 83%|████████▎ | 25/30 [00:00<00:00, 3097.26 it/sec, obj=-875] INFO - 20:38:57: 87%|████████▋ | 26/30 [00:00<00:00, 3135.39 it/sec, obj=-726] INFO - 20:38:57: 90%|█████████ | 27/30 [00:00<00:00, 3178.39 it/sec, obj=-69.6] INFO - 20:38:57: 93%|█████████▎| 28/30 [00:00<00:00, 3220.37 it/sec, obj=-1.51e+3] INFO - 20:38:57: 97%|█████████▋| 29/30 [00:00<00:00, 3259.15 it/sec, obj=-1.15e+3] INFO - 20:38:57: 100%|██████████| 30/30 [00:00<00:00, 3296.46 it/sec, obj=-2.73e+3] INFO - 20:38:57: Optimization result: INFO - 20:38:57: Optimizer info: INFO - 20:38:57: Status: None INFO - 20:38:57: Message: None INFO - 20:38:57: Number of calls to the objective function by the optimizer: 0 INFO - 20:38:57: Solution: INFO - 20:38:57: Objective: -2726.3660548732214 INFO - 20:38:57: Design space: INFO - 20:38:57: +------+-------------+--------------------+-------------+-------+ INFO - 20:38:57: | Name | Lower bound | Value | Upper bound | Type | INFO - 20:38:57: +------+-------------+--------------------+-------------+-------+ INFO - 20:38:57: | y_24 | 0.44 | 9.094543945649603 | 11.13 | float | INFO - 20:38:57: | y_34 | 0.44 | 0.4769766573300308 | 1.98 | float | INFO - 20:38:57: +------+-------------+--------------------+-------------+-------+ INFO - 20:38:57: *** End DOEScenario execution (time: 0:00:00.011560) *** .. GENERATED FROM PYTHON SOURCE LINES 67-73 Note that both the formulation settings passed to func:`.create_scenario` and the algorithm settings passed to :meth:`~.DriverLibrary.execute` can be provided via a Pydantic model. For more information, see :ref:`formulation_settings` and :ref:`algorithm_settings`. Plot optimization history view ------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 73-75 .. code-block:: Python scenario.post_process(post_name="OptHistoryView", save=False, show=True) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_001.png :alt: Evolution of the optimization variables :srcset: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_002.png :alt: Evolution of the objective value :srcset: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_003.png :alt: Evolution of the distance to the optimum :srcset: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 76-82 Note that post-processor settings passed to :meth:`.BaseScenario.post_process` can be provided via a Pydantic model (see the example below). For more information, see :ref:`post_processor_settings`. Plot scatter plot matrix ------------------------ .. GENERATED FROM PYTHON SOURCE LINES 82-91 .. code-block:: Python from gemseo.settings.post import ScatterPlotMatrix_Settings # noqa: E402 settings_model = ScatterPlotMatrix_Settings( variable_names=["y_4", "y_24", "y_34"], save=False, show=True, ) scenario.post_process(settings_model) .. image-sg:: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_004.png :alt: plot sobieski doe disc example :srcset: /examples/doe/images/sphx_glr_plot_sobieski_doe_disc_example_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.622 seconds) .. _sphx_glr_download_examples_doe_plot_sobieski_doe_disc_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_sobieski_doe_disc_example.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_sobieski_doe_disc_example.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_sobieski_doe_disc_example.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_