.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/dataset/plot_dataset_from_optproblem.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_dataset_plot_dataset_from_optproblem.py: Dataset from an optimization problem ==================================== In this example, we will see how to build a :class:`.Dataset` from objects of an :class:`.OptimizationProblem`. For that, we need to import this :class:`.Dataset` class: .. GENERATED FROM PYTHON SOURCE LINES 31-39 .. code-block:: default from __future__ import division, unicode_literals from gemseo.api import configure_logger, create_discipline, create_scenario from gemseo.problems.sellar.sellar_design_space import SellarDesignSpace configure_logger() .. rst-class:: sphx-glr-script-out Out: .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 40-44 Synthetic data -------------- We can sample the :class:`.Sellar1` discipline and use the corresponding :class:`.OptimizationProblem`: .. GENERATED FROM PYTHON SOURCE LINES 44-54 .. code-block:: default discipline = create_discipline("Sellar1") design_space = SellarDesignSpace().filter(discipline.get_input_data_names()) scenario = create_scenario( [discipline], "DisciplinaryOpt", "y_1", design_space, scenario_type="DOE" ) scenario.execute({"algo": "lhs", "n_samples": 5}) opt_problem = scenario.formulation.opt_problem .. rst-class:: sphx-glr-script-out Out: .. code-block:: none INFO - 14:43:44: INFO - 14:43:44: *** Start DOE Scenario execution *** INFO - 14:43:44: DOEScenario INFO - 14:43:44: Disciplines: Sellar1 INFO - 14:43:44: MDOFormulation: DisciplinaryOpt INFO - 14:43:44: Algorithm: lhs INFO - 14:43:44: Optimization problem: INFO - 14:43:44: Minimize: y_1(x_local, x_shared, y_2) INFO - 14:43:44: With respect to: x_local, x_shared, y_2 INFO - 14:43:44: DOE sampling: 0%| | 0/5 [00:00` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dataset_from_optproblem.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_