.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/run_python_script/02_4_oscillator_MOP_sensitivity_and_optimization.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_run_python_script_02_4_oscillator_MOP_sensitivity_and_optimization.py: .. _ref_oscillator_oscillator_MOP_sensitivity_and_optimization: Oscillator sensitivity and optimization on MOP ---------------------------------------------- This example demonstrates how to create an optimization on MOP flow. It uses the ``oscillator_sensitivity_mop.py`` file to create a sensitivity flow for an oscillator and then uses the ``oscillator_optimization_on_mop.py`` file to optimize the MOP (Metamodel of Optimal Prognosis) flow. It then runs these flows. Lastly, it explains how you can optionally save the project to a desired location. .. GENERATED FROM PYTHON SOURCE LINES 40-43 Perform required imports ~~~~~~~~~~~~~~~~~~~~~~~~ Perform the required imports. .. GENERATED FROM PYTHON SOURCE LINES 43-47 .. code-block:: Python from ansys.optislang.core import Optislang import ansys.optislang.core.examples as examples .. GENERATED FROM PYTHON SOURCE LINES 48-51 Create optiSLang instance ~~~~~~~~~~~~~~~~~~~~~~~~~ Create the optiSLang instance. .. GENERATED FROM PYTHON SOURCE LINES 51-55 .. code-block:: Python osl = Optislang(ini_timeout=60) print(osl) .. GENERATED FROM PYTHON SOURCE LINES 56-60 Get paths of example scripts and run them ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the paths of the example scripts and then run these scripts. .. GENERATED FROM PYTHON SOURCE LINES 60-67 .. code-block:: Python paths1 = examples.get_files("oscillator_sensitivity_mop") paths2 = examples.get_files("oscillator_optimization_on_mop") osl.application.project.run_python_file(paths1[0]) osl.application.project.run_python_file(paths2[0]) .. GENERATED FROM PYTHON SOURCE LINES 68-71 Run workflow ~~~~~~~~~~~~ Run the workflow created by the preceding scripts. .. GENERATED FROM PYTHON SOURCE LINES 71-74 .. code-block:: Python osl.application.project.start() .. GENERATED FROM PYTHON SOURCE LINES 75-85 Optionally save project ~~~~~~~~~~~~~~~~~~~~~~~ If you want to save the project to some desired location, uncomment and edit these lines: .. code:: python path = r'' osl.application.save_as(os.path.join(path, "test_project.opf")) .. GENERATED FROM PYTHON SOURCE LINES 87-90 Stop and cancel project ~~~~~~~~~~~~~~~~~~~~~~~ Stop and cancel the project. .. GENERATED FROM PYTHON SOURCE LINES 90-93 .. code-block:: Python osl.dispose() .. GENERATED FROM PYTHON SOURCE LINES 94-102 View generated workflow ~~~~~~~~~~~~~~~~~~~~~~~ This image shows the generated workflow. .. image:: ../../_static/02_4_oscillator_MOP_sensitivity_and_optimization.png :width: 600 :alt: Result of script. .. _sphx_glr_download_examples_run_python_script_02_4_oscillator_MOP_sensitivity_and_optimization.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02_4_oscillator_MOP_sensitivity_and_optimization.ipynb <02_4_oscillator_MOP_sensitivity_and_optimization.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02_4_oscillator_MOP_sensitivity_and_optimization.py <02_4_oscillator_MOP_sensitivity_and_optimization.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_