.. include:: ../../toolkit-substitutions

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OEOptimizer0, Optimizer0


.. _OEOpt_OEOptimizer0:

.. oe:class:: OEOptimizer0

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OEOptimizer0

   The :ref:`OEOptimizer0 <OEOpt_OEOptimizer0>` abstract class defines the interface for
   optimizing a set of variables for which a function can be evaluated. 
   Implementations of :ref:`OEOptimizer0 <OEOpt_OEOptimizer0>` use only function values during
   optimization, so it does not calculate gradients.

   The :ref:`OEOptimizer0 <OEOpt_OEOptimizer0>` class defines the following public methods:
    * :oe:meth:`operator()<OEOpt::OEOptimizer0::operator()>`         
    * :oe:meth:`GetIterLimit<OEOpt::OEOptimizer0::GetIterLimit>` and
      :oe:meth:`SetIterLimit<OEOpt::OEOptimizer0::SetIterLimit>`

   .. oe:method:: operator()

      .. oe:language:: c++ java csharp

         .. oe:api::

            double operator()(OEFunc0& function, const double* var, double* opt_var)
            double operator()(OEFunc0& function, OECheckpoint0* check, const double* var, double* opt_var)

      .. oe:language:: python

         .. oe:api:: python

            __call__(function: OEFunc0, var: OEDoubleArray,
                     opt_var: OEDoubleArray) -> float
            __call__(function: OEFunc0, check: OECheckpoint0,
                     var: OEDoubleArray, opt_var: OEDoubleArray) -> float

      These methods define the interface for optimizing a set of variables 
      with the use of evaluated function values. The reference to the function object
      is passed as a first argument. Initial values of variables are passed in the 
      array ``var``. The optimized variables are returned in the array ``opt_var``.
      Both operators return the value of the corresponding optimized function value.
      The second operator takes a pointer to the :ref:`OECheckpoint0 <OEOpt_OECheckpoint0>` object
      that can be used to monitor the progress of an optimization.

   .. oe:method:: GetIterLimit

      .. oe:language:: c++ java csharp

         .. oe:api::

            unsigned GetIterLimit() const

      .. oe:language:: python

         .. oe:api:: python

            GetIterLimit() -> int

      See :oe:meth:`SetIterLimit<OEOpt::OEOptimizer0::SetIterLimit>`.

   .. oe:method:: SetIterLimit

      .. oe:language:: c++ java csharp

         .. oe:api::

            void SetIterLimit(unsigned int itmax)

      .. oe:language:: python

         .. oe:api:: python

            SetIterLimit(itmax: int) -> None

      Defines the interface for setting the maximum number of iterations that an
      optimizer derived from the :ref:`OEOptimizer0 <OEOpt_OEOptimizer0>` will attempt while
      trying to identify a converged minimum function value. Optimization will cease if 
      the iteration limit is reached without finding a converged minimum.
