.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/api/plot_optimization.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_api_plot_optimization.py: Optimization algorithms ======================= In this example, we will discover the different functions of the API related to optimization algorithms. .. GENERATED FROM PYTHON SOURCE LINES 31-45 .. code-block:: default from __future__ import absolute_import, division, print_function, unicode_literals from future import standard_library from gemseo.api import ( configure_logger, get_algorithm_options_schema, get_available_opt_algorithms, ) configure_logger() standard_library.install_aliases() .. GENERATED FROM PYTHON SOURCE LINES 46-51 Get available optimization algorithms ------------------------------------- The :meth:`~gemseo.api.get_available_opt_algorithms` function returns the list of optimization algorithms available in |g| or in external modules .. GENERATED FROM PYTHON SOURCE LINES 51-53 .. code-block:: default print(get_available_opt_algorithms()) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none ['NLOPT_MMA', 'NLOPT_COBYLA', 'NLOPT_SLSQP', 'NLOPT_BOBYQA', 'NLOPT_BFGS', 'NLOPT_NEWUOA', 'SLSQP', 'L-BFGS-B', 'TNC'] .. GENERATED FROM PYTHON SOURCE LINES 54-58 Get options schema ------------------ For a given optimization algorithm, e.g. :code:`"NLOPT_SLSQP"`, we can get the options; e.g. .. GENERATED FROM PYTHON SOURCE LINES 58-59 .. code-block:: default print(get_algorithm_options_schema("NLOPT_SLSQP")) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none {'name': 'NLOPT_options', '$schema': 'http://json-schema.org/draft-04/schema', 'type': 'object', 'properties': {'xtol_rel': {'minimum': 0.0, 'type': 'number', 'description': 'Relative design parameter tolerance\n:type xtol_rel: float\n'}, 'normalize_design_space': {'type': 'boolean', 'description': 'If True, scales variables in [0, 1]\n:type normalize_design_space: bool\n'}, 'xtol_abs': {'minimum': 0.0, 'type': 'number', 'description': 'Design parameter tolerance\n:type xtol_abs: float\n'}, 'ftol_rel': {'minimum': 0.0, 'type': 'number', 'description': 'Relative objective function tolerance\n:type ftol_rel: float\n'}, 'ftol_abs': {'minimum': 0.0, 'type': 'number', 'description': 'Objective function tolerance\n:type ftol_abs: float\n'}, 'max_iter': {'minimum': 1, 'type': 'integer', 'description': 'maximum number of iterations\n:type max_iter: int\n'}, 'max_time': {'minimum': 0.0, 'type': 'number', 'description': 'Maximum time\n:type max_time: float\n'}, 'stopval': {'type': 'number', 'description': 'Stop when an objective value of at least stopval\nis found:\nstop minimizing when an objective value :math:`\\leq` stopval is\nfound,\nor stop maximizing a value :math:`\\geq` stopval is found.\n:type stopval: float\n'}, 'ctol_abs': {'minimum': 0.0, 'type': 'number', 'description': 'Absolute tolerance for constraints\n:type ctol_abs: float\n'}, 'eq_tolerance': {'minimum': 0.0, 'type': 'number', 'description': 'equality tolerance\n:type eq_tolerance: float\n'}, 'ineq_tolerance': {'minimum': 0.0, 'type': 'number', 'description': 'inequality tolerance\n:type ineq_tolerance: float\n'}, 'init_step': {'minimum': 0.0, 'type': 'number', 'description': 'initial step size for derivavtive free algorithms\nincreasing init_step will make the initial DOE in COBYLA\nwider steps in the design variables. By defaults, each variable\nis set to x0 + a perturbation that worths 0.25*(ub_i-x0_i) for i\nin xrange(len(x0))\n:type init_step: float'}}, 'required': ['max_iter']} .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.002 seconds) .. _sphx_glr_download_examples_api_plot_optimization.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_optimization.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_optimization.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_