.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/post_process/algorithms/plot_quad_approx.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_post_process_algorithms_plot_quad_approx.py: Quadratic approximations ======================== In this example, we illustrate the use of the :class:`.QuadApprox` plot on the Sobieski's SSBJ problem. The :class:`.QuadApprox` post-processing performs a quadratic approximation of a given function from an optimization history and provide two plots. The first plot shows an approximation of the Hessian matrix :math:`\dfrac{\partial^2 f}{\partial x_i \partial x_j}` based on the *Symmetric Rank 1* method (SR1) :cite:`Nocedal2006`. The color map uses a symmetric logarithmic (symlog) scale. This plots the cross influence of the design variables on the objective function or constraints. For instance, on the last figure, the maximal second-order sensitivity is :math:`\dfrac{\partial^2 -y_4}{\partial^2 x_0} = 2.10^5`, which means that the :math:`x_0` is the most influential variable. Then, the cross derivative :math:`\dfrac{\partial^2 -y_4}{\partial x_0 \partial x_2} = 5.10^4` is positive and relatively high compared to the previous one but the combined effects of :math:`x_0` and :math:`x_2` are non-negligible in comparison. The second plot represents the quadratic approximation of the objective around the optimal solution : :math:`a_{i}(t)=0.5 (t-x^*_i)^2 \dfrac{\partial^2 f}{\partial x_i^2} + (t-x^*_i) \dfrac{\partial f}{\partial x_i} + f(x^*)`, where :math:`x^*` is the optimal solution. This approximation highlights the sensitivity of the :term:`objective function` with respect to the :term:`design variables`: we notice that the design variables :math:`x\_1, x\_5, x\_6` have little influence , whereas :math:`x\_0, x\_2, x\_9` have a huge influence on the objective. This trend is also noted in the diagonal terms of the :term:`Hessian` matrix :math:`\dfrac{\partial^2 f}{\partial x_i^2}`. .. GENERATED FROM PYTHON SOURCE LINES 53-63 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/post_process/algorithms/images/sphx_glr_plot_quad_approx_001.png :alt: Hessian matrix SR1 approximation of -y_4 :srcset: /examples/post_process/algorithms/images/sphx_glr_plot_quad_approx_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/post_process/algorithms/images/sphx_glr_plot_quad_approx_002.png :alt: plot quad approx :srcset: /examples/post_process/algorithms/images/sphx_glr_plot_quad_approx_002.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none INFO - 16:25:50: Importing the optimization problem from the file sobieski_mdf_scenario.h5 | .. code-block:: Python from __future__ import annotations from gemseo import execute_post from gemseo.settings.post import QuadApprox_Settings execute_post( "sobieski_mdf_scenario.h5", settings_model=QuadApprox_Settings(function="-y_4", save=False, show=True), ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.511 seconds) .. _sphx_glr_download_examples_post_process_algorithms_plot_quad_approx.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_quad_approx.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_quad_approx.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_quad_approx.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_