Basis class for line search methods. More...
#include <shark/Algorithms/GradientDescent/AbstractLineSearchOptimizer.h>
Public Member Functions | |
SHARK_EXPORT_SYMBOL | AbstractLineSearchOptimizer () |
SHARK_EXPORT_SYMBOL void | init (ObjectiveFunctionType &objectiveFunction, SearchPointType const &startingPoint) |
initializes the optimizer using a predefined starting point More... | |
SHARK_EXPORT_SYMBOL void | step (ObjectiveFunctionType const &objectiveFunction) |
Carry out one step of the optimizer for the supplied objective function. More... | |
SHARK_EXPORT_SYMBOL void | read (InArchive &archive) |
Read the component from the supplied archive. More... | |
SHARK_EXPORT_SYMBOL void | write (OutArchive &archive) const |
Write the component to the supplied archive. More... | |
LineSearch const & | lineSearch () const |
LineSearch & | lineSearch () |
![]() | |
virtual void | init (ObjectiveFunctionType &function) |
virtual const SolutionType & | solution () const |
returns the current solution of the optimizer More... | |
![]() | |
const Features & | features () const |
virtual void | updateFeatures () |
bool | requiresValue () const |
bool | requiresFirstDerivative () const |
bool | requiresSecondDerivative () const |
bool | canSolveConstrained () const |
bool | requiresClosestFeasible () const |
virtual | ~AbstractOptimizer () |
Empty virtual d'tor. More... | |
![]() | |
virtual | ~INameable () |
virtual std::string | name () const |
returns the name of the object More... | |
![]() | |
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 Member Functions | |
virtual void | initModel ()=0 |
Initializes the internal model. More... | |
virtual void | computeSearchDirection ()=0 |
Updates the Model and computes the next search direction. More... | |
![]() | |
void | checkFeatures (ObjectiveFunctionType const &objectiveFunction) |
Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer. More... | |
Protected Attributes | |
LineSearch | m_linesearch |
used line search method. More... | |
std::size_t | m_dimension |
number of parameters More... | |
double | m_initialStepLength |
Initial step length to begin with the line search. More... | |
RealVector | m_derivative |
gradient of m_best.point More... | |
RealVector | m_searchDirection |
search direction of next step More... | |
RealVector | m_lastPoint |
previous point More... | |
RealVector | m_lastDerivative |
gradient of the previous point More... | |
double | m_lastValue |
value of the previous point More... | |
![]() | |
SolutionType | m_best |
current solution of the optimizer More... | |
![]() | |
Features | m_features |
Additional Inherited Members | |
![]() | |
typedef base_type::SearchPointType | SearchPointType |
typedef base_type::SolutionType | SolutionType |
typedef base_type::ResultType | ResultType |
typedef base_type::ObjectiveFunctionType | ObjectiveFunctionType |
![]() | |
enum | Feature |
Models features that the optimizer requires from the objective function. More... | |
typedef RealVector | SearchPointType |
typedef double | ResultType |
typedef SingleObjectiveResultSet< RealVector > | SolutionType |
typedef AbstractObjectiveFunction< RealVector, ResultType > | ObjectiveFunctionType |
typedef TypedFlags< Feature > | Features |
typedef TypedFeatureNotAvailableException< Feature > | FeatureNotAvailableException |
Basis class for line search methods.
Line Search optimizer find an iterative optimum by starting from some point, choosing a search direction and than performing a line search in that direction. To choose the search direction a local model of the function is often used. This class is a base class for all line search method which implement the general behaviour of line search methods. Derived classes only need to implement initModel() and computeSearchDirection() to initializee and update the model and find a new line search direction. The remaining functionality is implemented by the optimizer.
Also derived classes should specialise read() and write() methods for serialization if they have additional members as well as choose a name() for the optimizer.
Definition at line 55 of file AbstractLineSearchOptimizer.h.
SHARK_EXPORT_SYMBOL shark::AbstractLineSearchOptimizer::AbstractLineSearchOptimizer | ( | ) |
|
protectedpure virtual |
Updates the Model and computes the next search direction.
After a step was performed, this method is called to compute the next search direction. This usually involves updating the internal model using the new and old step information. Afterwards m_searchDirection should contain the next search direction.
Implemented in shark::CG, shark::LBFGS, and shark::BFGS.
|
virtual |
initializes the optimizer using a predefined starting point
Implements shark::AbstractSingleObjectiveOptimizer< RealVector >.
Referenced by main().
|
protectedpure virtual |
Initializes the internal model.
Line Search Methods use a Model to search for the next search direction. The model is initialized during init()
Implemented in shark::CG, shark::LBFGS, and shark::BFGS.
|
inline |
Definition at line 86 of file AbstractLineSearchOptimizer.h.
References m_linesearch.
Referenced by main().
|
inline |
Definition at line 89 of file AbstractLineSearchOptimizer.h.
References m_linesearch.
|
virtual |
Read the component from the supplied archive.
[in,out] | archive | The archive to read from. |
Reimplemented from shark::ISerializable.
Reimplemented in shark::LBFGS, shark::CG, and shark::BFGS.
|
virtual |
Carry out one step of the optimizer for the supplied objective function.
[in] | function | The objective function to initialize for. |
Implements shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >.
Referenced by main(), and shark::LBFGS::setHistCount().
|
virtual |
Write the component to the supplied archive.
[in,out] | archive | The archive to write to. |
Reimplemented from shark::ISerializable.
Reimplemented in shark::LBFGS, shark::CG, and shark::BFGS.
|
protected |
gradient of m_best.point
Definition at line 100 of file AbstractLineSearchOptimizer.h.
|
protected |
number of parameters
Definition at line 97 of file AbstractLineSearchOptimizer.h.
|
protected |
Initial step length to begin with the line search.
Definition at line 98 of file AbstractLineSearchOptimizer.h.
|
protected |
gradient of the previous point
Definition at line 105 of file AbstractLineSearchOptimizer.h.
|
protected |
previous point
Definition at line 104 of file AbstractLineSearchOptimizer.h.
|
protected |
value of the previous point
Definition at line 106 of file AbstractLineSearchOptimizer.h.
|
protected |
used line search method.
Definition at line 96 of file AbstractLineSearchOptimizer.h.
Referenced by lineSearch().
|
protected |
search direction of next step
Definition at line 101 of file AbstractLineSearchOptimizer.h.