NPL
Neurological Programs and Libraries
Optimization Algorithms

Classes

class  npl::BFGSOpt
 
class  npl::GradientOpt
 
class  npl::LBFGSOpt
 Limited-Memory Broyden–Fletcher–Goldfarb–Shanno Algorithm based on "A Limited Memory Algorithm for Bound Constrained Optimization" Richard H. Byrd, Peihuang Lu, Jorge Nocedal, and Ciyou Zhu http://dx.doi.org/10.1137/0916069. More...
 
class  npl::Optimizer
 

Typedefs

typedef function< int(const VectorXd &x, double &v, VectorXd &g)> npl::ValGradFunc
 Value and Gradient Computation Function. More...
 
typedef function< int(const VectorXd &x, VectorXd &g)> npl::GradFunc
 Gradient Only Computation Function. More...
 
typedef function< int(const VectorXd &x, double &v)> npl::ValFunc
 Value Only Computation Function. More...
 
typedef function< int(const VectorXd &x, double v, const VectorXd &g, size_t iter)> npl::CallBackFunc
 Callback function. More...
 

Enumerations

enum  npl::StopReason {
  npl::ENDGRAD, npl::ENDSTEP, npl::ENDVALUE, npl::ENDABSVALUE,
  npl::ENDITERS, npl::ENDFAIL
}
 

Functions

int npl::testgrad (double &error, const VectorXd &x, double stepsize, double tol, const ValFunc &valfunc, const ValGradFunc &valgradfunc)
 Tests a gradient function using the value function. More...
 
int npl::testgrad (double &error, const VectorXd &x, double stepsize, double tol, const ValFunc &valfunc, const GradFunc &gradfunc)
 Tests a gradient function using the value function. More...
 
int npl::gRosenbrock_G (const VectorXd &x, VectorXd &gradient)
 Implements generized rosenbrock gradient. More...
 
int npl::gRosenbrock_V (const VectorXd &x, double &v)
 Implements generized rosenbrock value. More...
 
void npl::gRosenbrock_callCounts (size_t &vcalls, size_t &gcalls)
 Returns the number of times the Value and Gradient functions for the Generalized Rosenbrock Function were called. More...
 
int npl::noopCallback (const VectorXd &x, double value, const VectorXd &grad, size_t iter)
 Callback that does nothing. More...
 

Detailed Description

Typedef Documentation

typedef function<int(const VectorXd& x, double v, const VectorXd& g, size_t iter)> npl::CallBackFunc

Callback function.

Definition at line 56 of file opt.h.

typedef function<int(const VectorXd& x, VectorXd& g)> npl::GradFunc

Gradient Only Computation Function.

Definition at line 46 of file opt.h.

typedef function<int(const VectorXd& x, double& v)> npl::ValFunc

Value Only Computation Function.

Definition at line 51 of file opt.h.

typedef function<int(const VectorXd& x, double& v, VectorXd& g)> npl::ValGradFunc

Value and Gradient Computation Function.

Definition at line 41 of file opt.h.

Enumeration Type Documentation

Enumerator
ENDGRAD 
ENDSTEP 
ENDVALUE 
ENDABSVALUE 
ENDITERS 
ENDFAIL 

Definition at line 141 of file opt.h.

Function Documentation

void npl::gRosenbrock_callCounts ( size_t &  vcalls,
size_t &  gcalls 
)

Returns the number of times the Value and Gradient functions for the Generalized Rosenbrock Function were called.

Parameters
vcallsValue calls
gcallsGradient calls
int npl::gRosenbrock_G ( const VectorXd &  x,
VectorXd &  gradient 
)

Implements generized rosenbrock gradient.

Parameters
xPosition vector
gradientGradient at the position
Returns
int npl::gRosenbrock_V ( const VectorXd &  x,
double &  v 
)

Implements generized rosenbrock value.

Parameters
xPosition vector
vvalues
Returns
int npl::noopCallback ( const VectorXd &  x,
double  value,
const VectorXd &  grad,
size_t  iter 
)
inline

Callback that does nothing.

Parameters
x
value
grad
iter
Returns

Definition at line 132 of file opt.h.

int npl::testgrad ( double &  error,
const VectorXd &  x,
double  stepsize,
double  tol,
const ValFunc valfunc,
const ValGradFunc valgradfunc 
)

Tests a gradient function using the value function.

Parameters
errorError between analytical and numeric gradient
xPosition to test
stepsizeStep to take when testing gradient (will be taken in each dimension successively)
tolTolerance, error below the tolerance will cause the function to return 0, higher error will cause the function to return -1
valfuncFunction values compute
valgradfuncFunction gradient compute
Returns
int npl::testgrad ( double &  error,
const VectorXd &  x,
double  stepsize,
double  tol,
const ValFunc valfunc,
const GradFunc gradfunc 
)

Tests a gradient function using the value function.

Parameters
errorError between analytical and numeric gradient
xPosition to test
stepsizeStep to take when testing gradient (will be taken in each dimension successively)
tolTolerance, error below the tolerance will cause the function to return 0, higher error will cause the function to return -1
valfuncFunction values compute
gradfuncFunction gradient compute
Returns