NPL
Neurological Programs and Libraries
npl::Optimizer Class Reference

#include <opt.h>

Inherited by npl::BFGSOpt [virtual], npl::GradientOpt [virtual], and npl::LBFGSOpt [virtual].

Public Member Functions

 Optimizer (size_t dim, const ValFunc &valfunc, const GradFunc &gradfunc, const ValGradFunc &valgradfunc, const CallBackFunc &callback=noopCallback)
 Constructor for optimizer function. More...
 
 Optimizer (size_t dim, const ValFunc &valfunc, const GradFunc &gradfunc, const CallBackFunc &callback=noopCallback)
 Constructor for optimizer function. More...
 
virtual StopReason optimize ()
 Perform optimization. More...
 

Static Public Member Functions

static std::string explainStop (StopReason r)
 Provides a string that describes the stop reason. More...
 

Public Attributes

VectorXd state_x
 State variable, set to initialize. More...
 
double stop_G
 Stop when graient magnitde falls below this value. More...
 
double stop_X
 Stop when step size drops below this value. More...
 
double stop_F
 Stop when change in function value drops below this value. More...
 
double stop_F_over
 Stop immediately when value goes above this. More...
 
double stop_F_under
 Stop immediately when value goes below this. More...
 
int stop_Its
 Stop after this many iterations (does not include linesearch) More...
 

Protected Attributes

ValGradFunc m_compFG
 
GradFunc m_compG
 
ValFunc m_compF
 
CallBackFunc m_callback
 

Detailed Description

Definition at line 155 of file opt.h.

Constructor & Destructor Documentation

npl::Optimizer::Optimizer ( size_t  dim,
const ValFunc valfunc,
const GradFunc gradfunc,
const ValGradFunc valgradfunc,
const CallBackFunc callback = noopCallback 
)

Constructor for optimizer function.

Parameters
dimDimensionality of state vector
valfuncFunction which computes the energy of the underlying mathematical function
gradfuncFunction which computes the gradient of energy in the underlying mathematical function
valgradfuncFunction which computes the both the energy and gradient in the underlying mathematical function
callbackFunction which should be called at the end of each iteration (for instance, to debug)
npl::Optimizer::Optimizer ( size_t  dim,
const ValFunc valfunc,
const GradFunc gradfunc,
const CallBackFunc callback = noopCallback 
)

Constructor for optimizer function.

Parameters
dimDimensionality of state vector
valfuncFunction which computes the energy of the underlying mathematical function
gradfuncFunction which computes the gradient of energy in the underlying mathematical function
callbackFunction which should be called at the end of each iteration (for instance, to debug)

Member Function Documentation

static std::string npl::Optimizer::explainStop ( StopReason  r)
static

Provides a string that describes the stop reason.

Parameters
r
virtual StopReason npl::Optimizer::optimize ( )
inlinevirtual

Perform optimization.

Returns
StopReason

Reimplemented in npl::GradientOpt, npl::BFGSOpt, and npl::LBFGSOpt.

Definition at line 232 of file opt.h.

Member Data Documentation

CallBackFunc npl::Optimizer::m_callback
protected

Definition at line 245 of file opt.h.

ValFunc npl::Optimizer::m_compF
protected

Definition at line 244 of file opt.h.

ValGradFunc npl::Optimizer::m_compFG
protected

Definition at line 242 of file opt.h.

GradFunc npl::Optimizer::m_compG
protected

Definition at line 243 of file opt.h.

VectorXd npl::Optimizer::state_x

State variable, set to initialize.

Definition at line 162 of file opt.h.

double npl::Optimizer::stop_F

Stop when change in function value drops below this value.

Definition at line 177 of file opt.h.

double npl::Optimizer::stop_F_over

Stop immediately when value goes above this.

Definition at line 182 of file opt.h.

double npl::Optimizer::stop_F_under

Stop immediately when value goes below this.

Definition at line 187 of file opt.h.

double npl::Optimizer::stop_G

Stop when graient magnitde falls below this value.

Definition at line 167 of file opt.h.

int npl::Optimizer::stop_Its

Stop after this many iterations (does not include linesearch)

Definition at line 192 of file opt.h.

double npl::Optimizer::stop_X

Stop when step size drops below this value.

Definition at line 172 of file opt.h.


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