primatologist-gpl  5.1.2
aims::GradientDescent< O, L > Class Template Reference

#include <primatologist/optimization/gradient_decl.h>

Collaboration diagram for aims::GradientDescent< O, L >:

Public Types

typedef O Objective
 
typedef L< O > LineSearch
 
typedef math::Matrix Matrix
 
typedef math::Vector Vector
 

Public Member Functions

 GradientDescent (const Objective &f=Objective(), const Vector &x=Vector())
 
 GradientDescent (const GradientDescent< O, L > &other)
 
 ~GradientDescent ()
 
GradientDescent< O, L > & operator= (const GradientDescent< O, L > &other)
 
void setGamma (float gamma=0.1)
 
void setStopCriterion (const std::string &crit="absdiff")
 Can take values: More...
 
void setStopValue (float epsilon=1E-5)
 
void setLineSearch (const LineSearch &l=LineSearch())
 
void setMaximize (bool maximize=false)
 
void setMaxIterations (int n=- 1)
 
void setVerbose (int v=carto::verbose)
 
void setObjectiveFunction (const Objective &f)
 
void setPosition (const Vector &x=Vector())
 
float gamma () const
 
const std::string & stopCriterion () const
 
float stopValue () const
 
LineSearchlineSearch ()
 
bool maximize () const
 
int maxIterations () const
 
int verbose () const
 
const Vectorposition () const
 
const ObjectiveobjectiveFunction () const
 
Vector execute ()
 

Protected Attributes

float _gamma
 Fixed Gamma or initial gamma for line search. More...
 
Vector _x
 position More...
 
Objective _f
 objectiveFunction More...
 
LineSearch _ls
 lineSearch More...
 
int _verbose
 verbosity level More...
 
bool _maximize
 maximize or minimize More...
 
int _max_it
 maximum number of iterations More...
 
std::string _crit
 stop criterion More...
 
float _epsilon
 stop value More...
 

Detailed Description

template<typename O, template< typename > class L = NoLineSearch>
class aims::GradientDescent< O, L >

Definition at line 25 of file gradient_decl.h.

Member Typedef Documentation

◆ LineSearch

template<typename O , template< typename > class L = NoLineSearch>
typedef L<O> aims::GradientDescent< O, L >::LineSearch

Definition at line 32 of file gradient_decl.h.

◆ Matrix

template<typename O , template< typename > class L = NoLineSearch>
typedef math::Matrix aims::GradientDescent< O, L >::Matrix

Definition at line 33 of file gradient_decl.h.

◆ Objective

template<typename O , template< typename > class L = NoLineSearch>
typedef O aims::GradientDescent< O, L >::Objective

Definition at line 31 of file gradient_decl.h.

◆ Vector

template<typename O , template< typename > class L = NoLineSearch>
typedef math::Vector aims::GradientDescent< O, L >::Vector

Definition at line 34 of file gradient_decl.h.

Constructor & Destructor Documentation

◆ GradientDescent() [1/2]

template<typename O , template< typename > class L>
aims::GradientDescent< O, L >::GradientDescent ( const Objective f = Objective(),
const Vector x = Vector() 
)

◆ GradientDescent() [2/2]

template<typename O , template< typename > class L>
aims::GradientDescent< O, L >::GradientDescent ( const GradientDescent< O, L > &  other)

Definition at line 37 of file gradient_d.h.

◆ ~GradientDescent()

template<typename O , template< typename > class L>
aims::GradientDescent< O, L >::~GradientDescent

Definition at line 48 of file gradient_d.h.

Member Function Documentation

◆ execute()

template<typename O , template< typename > class L>
GradientDescent< O, L >::Vector aims::GradientDescent< O, L >::execute

Definition at line 198 of file gradient_d.h.

◆ gamma()

template<typename O , template< typename > class L>
float aims::GradientDescent< O, L >::gamma

Definition at line 137 of file gradient_d.h.

References aims::_gamma.

◆ lineSearch()

template<typename O , template< typename > class L>
GradientDescent< O, L >::LineSearch & aims::GradientDescent< O, L >::lineSearch

Definition at line 156 of file gradient_d.h.

◆ maximize()

template<typename O , template< typename > class L>
bool aims::GradientDescent< O, L >::maximize

Definition at line 162 of file gradient_d.h.

◆ maxIterations()

template<typename O , template< typename > class L>
int aims::GradientDescent< O, L >::maxIterations

Definition at line 168 of file gradient_d.h.

◆ objectiveFunction()

template<typename O , template< typename > class L>
const GradientDescent< O, L >::Objective & aims::GradientDescent< O, L >::objectiveFunction

Definition at line 188 of file gradient_d.h.

◆ operator=()

◆ position()

template<typename O , template< typename > class L>
const GradientDescent< O, L >::Vector & aims::GradientDescent< O, L >::position

Definition at line 181 of file gradient_d.h.

◆ setGamma()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setGamma ( float  gamma = 0.1)

Definition at line 73 of file gradient_d.h.

References aims::_gamma.

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setLineSearch()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setLineSearch ( const LineSearch l = LineSearch())
Warning
the LineSearch object needs to be copiable and thus needs a copy constructor and an assignment operator

Definition at line 91 of file gradient_d.h.

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setMaximize()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setMaximize ( bool  maximize = false)

Definition at line 100 of file gradient_d.h.

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setMaxIterations()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setMaxIterations ( int  n = - 1)

Definition at line 107 of file gradient_d.h.

References max().

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setObjectiveFunction()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setObjectiveFunction ( const Objective f)
Warning
the Objective function needs to be copiable and thus needs a copy constructor and an assignment operator

Definition at line 120 of file gradient_d.h.

◆ setPosition()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setPosition ( const Vector x = Vector())

Definition at line 127 of file gradient_d.h.

◆ setStopCriterion()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setStopCriterion ( const std::string &  crit = "absdiff")

Can take values:

  • absdiff
  • gain

Definition at line 79 of file gradient_d.h.

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setStopValue()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setStopValue ( float  epsilon = 1E-5)

Definition at line 85 of file gradient_d.h.

References epsilon().

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ setVerbose()

template<typename O , template< typename > class L>
void aims::GradientDescent< O, L >::setVerbose ( int  v = carto::verbose)

Definition at line 113 of file gradient_d.h.

Referenced by aims::GradientDescent< O, L >::GradientDescent().

◆ stopCriterion()

template<typename O , template< typename > class L>
const std::string & aims::GradientDescent< O, L >::stopCriterion

Definition at line 143 of file gradient_d.h.

◆ stopValue()

template<typename O , template< typename > class L>
float aims::GradientDescent< O, L >::stopValue

Definition at line 149 of file gradient_d.h.

◆ verbose()

template<typename O , template< typename > class L>
int aims::GradientDescent< O, L >::verbose

Definition at line 174 of file gradient_d.h.

Member Data Documentation

◆ _crit

template<typename O , template< typename > class L = NoLineSearch>
std::string aims::GradientDescent< O, L >::_crit
protected

stop criterion

Definition at line 100 of file gradient_decl.h.

◆ _epsilon

template<typename O , template< typename > class L = NoLineSearch>
float aims::GradientDescent< O, L >::_epsilon
protected

stop value

Definition at line 101 of file gradient_decl.h.

◆ _f

template<typename O , template< typename > class L = NoLineSearch>
Objective aims::GradientDescent< O, L >::_f
protected

objectiveFunction

Definition at line 95 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _gamma

template<typename O , template< typename > class L = NoLineSearch>
float aims::GradientDescent< O, L >::_gamma
protected

Fixed Gamma or initial gamma for line search.

Definition at line 93 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _ls

template<typename O , template< typename > class L = NoLineSearch>
LineSearch aims::GradientDescent< O, L >::_ls
protected

lineSearch

Definition at line 96 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _max_it

template<typename O , template< typename > class L = NoLineSearch>
int aims::GradientDescent< O, L >::_max_it
protected

maximum number of iterations

Definition at line 99 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _maximize

template<typename O , template< typename > class L = NoLineSearch>
bool aims::GradientDescent< O, L >::_maximize
protected

maximize or minimize

Definition at line 98 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _verbose

template<typename O , template< typename > class L = NoLineSearch>
int aims::GradientDescent< O, L >::_verbose
protected

verbosity level

Definition at line 97 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().

◆ _x

template<typename O , template< typename > class L = NoLineSearch>
Vector aims::GradientDescent< O, L >::_x
protected

position

Definition at line 94 of file gradient_decl.h.

Referenced by aims::GradientDescent< O, L >::operator=().


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