shark::LineSearch Class 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:

Public Types

enum  LineSearchType { Dlinmin, WolfeCubic, Backtracking }
 
typedef AbstractObjectiveFunction< RealVector, double > ObjectiveFunction
 

Public Member Functions

 LineSearch ()
 
LineSearchType lineSearchType () const
 
LineSearchTypelineSearchType ()
 
double minInterval () const
 minInterval sets the minimum initial bracket More...
 
double & minInterval ()
 minInterval sets the minimum initial bracket More...
 
double maxInterval () const
 maxInterval sets the maximum initial bracket More...
 
double & maxInterval ()
 maxInterval sets the maximum initial bracket More...
 
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 More...
 
SHARK_EXPORT_SYMBOL void operator() (RealVector &searchPoint, double &pointValue, RealVector const &newtonDirection, RealVector &derivative, double stepLength=1.0) const
 
virtual void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
virtual void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

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

Detailed Description

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 49 of file LineSearch.h.

Member Typedef Documentation

◆ ObjectiveFunction

Definition at line 56 of file LineSearch.h.

Member Enumeration Documentation

◆ LineSearchType

Enumerator
Dlinmin 
WolfeCubic 
Backtracking 

Definition at line 51 of file LineSearch.h.

Constructor & Destructor Documentation

◆ LineSearch()

shark::LineSearch::LineSearch ( )
inline

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

Definition at line 60 of file LineSearch.h.

References Dlinmin, m_lineSearchType, m_maxInterval, and m_minInterval.

Member Function Documentation

◆ init()

void shark::LineSearch::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 90 of file LineSearch.h.

References m_function, operator()(), shark::searchPoint(), and SHARK_EXPORT_SYMBOL.

◆ lineSearchType() [1/2]

LineSearchType shark::LineSearch::lineSearchType ( ) const
inline

Definition at line 66 of file LineSearch.h.

References m_lineSearchType.

◆ lineSearchType() [2/2]

LineSearchType& shark::LineSearch::lineSearchType ( )
inline

Definition at line 69 of file LineSearch.h.

References m_lineSearchType.

◆ maxInterval() [1/2]

double shark::LineSearch::maxInterval ( ) const
inline

maxInterval sets the maximum initial bracket

Definition at line 81 of file LineSearch.h.

References m_maxInterval.

◆ maxInterval() [2/2]

double& shark::LineSearch::maxInterval ( )
inline

maxInterval sets the maximum initial bracket

Definition at line 85 of file LineSearch.h.

References m_maxInterval.

◆ minInterval() [1/2]

double shark::LineSearch::minInterval ( ) const
inline

minInterval sets the minimum initial bracket

Definition at line 73 of file LineSearch.h.

References m_minInterval.

◆ minInterval() [2/2]

double& shark::LineSearch::minInterval ( )
inline

minInterval sets the minimum initial bracket

Definition at line 77 of file LineSearch.h.

References m_minInterval.

◆ operator()()

SHARK_EXPORT_SYMBOL void shark::LineSearch::operator() ( RealVector &  searchPoint,
double &  pointValue,
RealVector const &  newtonDirection,
RealVector &  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

Referenced by init().

◆ read()

virtual void shark::LineSearch::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 103 of file LineSearch.h.

References m_lineSearchType, m_maxInterval, and m_minInterval.

◆ write()

virtual void shark::LineSearch::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 109 of file LineSearch.h.

References m_lineSearchType, m_maxInterval, and m_minInterval.

Member Data Documentation

◆ m_function

ObjectiveFunction const* shark::LineSearch::m_function
protected

function to optimize

Definition at line 125 of file LineSearch.h.

Referenced by init().

◆ m_lineSearchType

LineSearchType shark::LineSearch::m_lineSearchType
protected

Definition at line 122 of file LineSearch.h.

Referenced by LineSearch(), lineSearchType(), read(), and write().

◆ m_maxInterval

double shark::LineSearch::m_maxInterval
protected

initial [min,max] bracket for linesearch

Definition at line 120 of file LineSearch.h.

Referenced by LineSearch(), maxInterval(), read(), and write().

◆ m_minInterval

double shark::LineSearch::m_minInterval
protected

initial [min,max] bracket for linesearch

Definition at line 118 of file LineSearch.h.

Referenced by LineSearch(), minInterval(), read(), and write().


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