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

.. oe:namespace:: OEOpt



.. meta::
   :keywords: OELineMinimize, LineMinimize


.. _OEOpt_OELineMinimize:

.. oe:class:: OELineMinimize

   .. attention::

      |TWOLANGUAGE|

   .. oe:api::


      class OELineMinimize

   The :ref:`OELineMinimize <OEOpt_OELineMinimize>` class is a base class which defines the interface for
   line minimization used in different types of optimization. 

   The :ref:`OELineMinimize <OEOpt_OELineMinimize>` class defines the following public methods:
    * :oe:meth:`operator()<OEOpt::OELineMinimize::operator()>`           
    * :oe:meth:`CreateCopy<OEOpt::OELineMinimize::CreateCopy>`
    * :oe:meth:`SetMaxStep<OEOpt::OELineMinimize::SetMaxStep>`

   The following classes derive from this class:   
    * :ref:`OECGLineMinimize <OEOpt_OECGLineMinimize>`
    * :ref:`OEMaxStepLineMinimize <OEOpt_OEMaxStepLineMinimize>`
    * :ref:`OEQNLineMinimize <OEOpt_OEQNLineMinimize>`
    * :ref:`OENRLineSearch <OEOpt_OENRLineSearch>`
   

   .. oe:method:: operator()

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

         .. oe:api::

            bool operator()(unsigned int n, const double* p, double* d, double* g, double* k, double* gmin, double* alpha, OEFunc1& fun ) const = 0

      .. oe:language:: python

         .. oe:api:: python

            __call__(n: int, p: OEDoubleArray, d: OEDoubleArray,
                     g: OEDoubleArray, k: OEDoubleArray, gmin: OEDoubleArray,
                     alpha: OEDoubleArray, fun: OEFunc1) -> bool

      Defines the interface for finding the step size ``alpha`` for the current optimizer 
      iteration in the search direction determined by the vector ``d``. ``n`` is the number 
      of optimized variables, array ``p`` and ``g`` contain initial coordinates and gradients, 
      while array ``k`` returns gradients for the coordinates determined by the returned step 
      size ``alpha``. ``gmin`` contains the initial function value and returns its optimized 
      value, and ``fun`` is a reference to optimized function object. Operator returns ``true`` 
      when a value lower than the initial function value is found, ``false`` otherwise.

   .. oe:method:: SetMaxStep

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

         .. oe:api::

            bool SetMaxStep(unsigned int , double *)

      .. oe:language:: python

         .. oe:api:: python

            SetMaxStep(arg2: int, arg3: OEDoubleArray) -> bool

      Defines the interface for determination of the maximum step size. This method has a trivial 
      implementation in the base class, and provides a way to determine the maximum step if the 
      specific line optimization derived from :ref:`OELineMinimize <OEOpt_OELineMinimize>` needs it.

   .. oe:method:: CreateCopy

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

         .. oe:api::

            OELineMinimize* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OELineMinimize

      Defines the interface for creating a copy of line minimization object.

