shark::LineSearch< SearchPointType > Class Template Reference

Wrapper for the linesearch class of functions in the linear algebra library. More...

#include <shark/Algorithms/GradientDescent/LineSearch.h>

+ Inheritance diagram for shark::LineSearch< SearchPointType >:

Public Types

typedef AbstractObjectiveFunction< SearchPointType, double > ObjectiveFunction
 

Public Member Functions

 LineSearch ()
 
LineSearchType lineSearchType () const
 
LineSearchTypelineSearchType ()
 
double minInterval () const
 minInterval sets the minimum initial bracket
 
double & minInterval ()
 minInterval sets the minimum initial bracket
 
double maxInterval () const
 maxInterval sets the maximum initial bracket
 
double & maxInterval ()
 maxInterval sets the maximum initial bracket
 
void init (ObjectiveFunction const &objectiveFunction)
 initializes the internal state of the LineSearch class and sets the function on which the lineSearch is to be evaluated
 
void operator() (SearchPointType &searchPoint, double &pointValue, SearchPointType const &newtonDirection, SearchPointType &derivative, double stepLength=1.0) const
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive.
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive.
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor.
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...).
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...).
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

double m_minInterval
 initial [min,max] bracket for linesearch
 
double m_maxInterval
 initial [min,max] bracket for linesearch
 
LineSearchType m_lineSearchType
 
ObjectiveFunction const * m_function
 function to optimize
 

Detailed Description

template<class SearchPointType>
class shark::LineSearch< SearchPointType >

Wrapper for the linesearch class of functions in the linear algebra library.

This class is a wrapper for the linesearch class of functions of the linear algebra library. The class is used for example in CG or BFGS for their internal linesearch learning steps. It is NOT an Optimizer on its own, since it needs the Newton direction to be specified.

Definition at line 57 of file LineSearch.h.

Member Typedef Documentation

◆ ObjectiveFunction

template<class SearchPointType >
typedef AbstractObjectiveFunction<SearchPointType,double> shark::LineSearch< SearchPointType >::ObjectiveFunction

Definition at line 60 of file LineSearch.h.

Constructor & Destructor Documentation

◆ LineSearch()

template<class SearchPointType >
shark::LineSearch< SearchPointType >::LineSearch ( )
inline

Initializes the internal variables of the class to useful default values. Dlinmin is used as default

Definition at line 64 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_lineSearchType, shark::LineSearch< SearchPointType >::m_maxInterval, shark::LineSearch< SearchPointType >::m_minInterval, and shark::WolfeCubic.

Member Function Documentation

◆ init()

template<class SearchPointType >
void shark::LineSearch< SearchPointType >::init ( ObjectiveFunction const &  objectiveFunction)
inline

initializes the internal state of the LineSearch class and sets the function on which the lineSearch is to be evaluated

Definition at line 94 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_function.

Referenced by shark::MergeBudgetMaintenanceStrategy< RealVector >::reduceBudget().

◆ lineSearchType() [1/2]

template<class SearchPointType >
LineSearchType & shark::LineSearch< SearchPointType >::lineSearchType ( )
inline

◆ lineSearchType() [2/2]

template<class SearchPointType >
LineSearchType shark::LineSearch< SearchPointType >::lineSearchType ( ) const
inline

◆ maxInterval() [1/2]

template<class SearchPointType >
double & shark::LineSearch< SearchPointType >::maxInterval ( )
inline

maxInterval sets the maximum initial bracket

Definition at line 89 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_maxInterval.

◆ maxInterval() [2/2]

template<class SearchPointType >
double shark::LineSearch< SearchPointType >::maxInterval ( ) const
inline

maxInterval sets the maximum initial bracket

Definition at line 85 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_maxInterval.

◆ minInterval() [1/2]

template<class SearchPointType >
double & shark::LineSearch< SearchPointType >::minInterval ( )
inline

minInterval sets the minimum initial bracket

Definition at line 81 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_minInterval.

◆ minInterval() [2/2]

template<class SearchPointType >
double shark::LineSearch< SearchPointType >::minInterval ( ) const
inline

minInterval sets the minimum initial bracket

Definition at line 77 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_minInterval.

◆ operator()()

template<class SearchPointType >
void shark::LineSearch< SearchPointType >::operator() ( SearchPointType &  searchPoint,
double &  pointValue,
SearchPointType const &  newtonDirection,
SearchPointType &  derivative,
double  stepLength = 1.0 
) const

performs a linesearch on the objectiveFunction given the starting point, its value the newton direction and optionally the derivative at the starting point

Parameters
searchPointthe point where the linesearch start
pointValuethe value of the function at searchPoint
newtonDirectionthe search direction of the line search
derivativethe derivative of the function at searchPoint
stepLengthinitial step length guess for guiding the line search

◆ read()

template<class SearchPointType >
virtual void shark::LineSearch< SearchPointType >::read ( InArchive archive)
inlinevirtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Definition at line 107 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_lineSearchType, shark::LineSearch< SearchPointType >::m_maxInterval, and shark::LineSearch< SearchPointType >::m_minInterval.

◆ write()

template<class SearchPointType >
virtual void shark::LineSearch< SearchPointType >::write ( OutArchive archive) const
inlinevirtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Definition at line 113 of file LineSearch.h.

References shark::LineSearch< SearchPointType >::m_lineSearchType, shark::LineSearch< SearchPointType >::m_maxInterval, and shark::LineSearch< SearchPointType >::m_minInterval.

Member Data Documentation

◆ m_function

template<class SearchPointType >
ObjectiveFunction const* shark::LineSearch< SearchPointType >::m_function
protected

function to optimize

Definition at line 129 of file LineSearch.h.

Referenced by shark::LineSearch< SearchPointType >::init().

◆ m_lineSearchType

◆ m_maxInterval

template<class SearchPointType >
double shark::LineSearch< SearchPointType >::m_maxInterval
protected

◆ m_minInterval

template<class SearchPointType >
double shark::LineSearch< SearchPointType >::m_minInterval
protected

The documentation for this class was generated from the following file: