RDCode: BFGSOpt Namespace Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories

- Namespace List
- Namespace Members

# BFGSOpt Namespace Reference

## Functions
void | linearSearch (unsigned int dim, double *oldPt, double oldVal, double *grad, double *dir, double *newPt, double &newVal, double(*func)(double *), double maxStep, int &resCode)
| Do a Quasi-Newton minimization along a line.
int | minimize (unsigned int dim, double *pos, double gradTol, unsigned int &numIters, double &funcVal, double(*func)(double *), void(*gradFunc)(double *, double *), double funcTol=TOLX, unsigned int maxIts=MAXITS)
| Do a BFGS minimization of a function.
## Variables
const double | FUNCTOL = 1e-4
| Default tolerance for function convergence in the minimizer.
const double | MOVETOL = 1e-7
| Default tolerance for x changes in the minimizer.
const int | MAXITS = 200
| Default maximum number of iterations.
const double | EPS = 3e-8
| Default gradient tolerance in the minimizer.
const double | TOLX = 4.*EPS
| Default direction vector tolerance in the minimizer.
const double | MAXSTEP = 100.0
| Default maximim step size in the minimizer.

## Function Documentation

void BFGSOpt::linearSearch | ( | unsigned int | dim,
|  | double * | oldPt,
|  | double | oldVal,
|  | double * | grad,
|  | double * | dir,
|  | double * | newPt,
|  | double & | newVal,
|  | double(*)(double *) | func,
|  | double | maxStep,
|  | int & | resCode |
| ) |  |  |

Do a Quasi-Newton minimization along a line.

See Numerical Recipes in C, Section 9.7 for a description of the algorithm.

Parameters:

  | dim | the dimensionality of the space.
  | oldPt | the current position, as an array.
  | oldVal | the current function value.
  | grad | the value of the function gradient at oldPt
  | dir | the minimization direction
  | newPt | used to return the final position
  | newVal | used to return the final function value
  | func | the function to minimize
  | maxStep | the maximum allowable step size
  | resCode | used to return the results of the search.

Possible values for resCode are on return are:

- 0: success
- 1: the stepsize got too small. This probably indicates success.
- -1: the direction is bad (orthogonal to the gradient)

int BFGSOpt::minimize | ( | unsigned int | dim,
|  | double * | pos,
|  | double | gradTol,
|  | unsigned int & | numIters,
|  | double & | funcVal,
|  | double(*)(double *) | func,
|  | void(*)(double *, double *) | gradFunc,
|  | double | funcTol = `TOLX`,
|  | unsigned int | maxIts = `MAXITS` |
| ) |  |  |

Do a BFGS minimization of a function.

See Numerical Recipes in C, Section 10.7 for a description of the algorithm.

Parameters:

  | dim | the dimensionality of the space.
  | pos | the starting position, as an array.
  | gradTol | tolerance for gradient convergence
  | numIters | used to return the number of iterations required
  | funcVal | used to return the final function value
  | func | the function to minimize
  | gradFunc | calculates the gradient of func
  | funcTol | tolerance for changes in the function value for convergence.
  | maxIts | maximum number of iterations allowed

Returns:
  a flag indicating success (or type of failure). Possible values are:
  - 0: success
  - 1: too many iterations were required

## Variable Documentation

const double BFGSOpt::EPS = 3e-8

Default gradient tolerance in the minimizer.

Definition at line 11 of file BFGSOpt.h.

const double BFGSOpt::FUNCTOL = 1e-4

Default tolerance for function convergence in the minimizer.

Definition at line 8 of file BFGSOpt.h.

const int BFGSOpt::MAXITS = 200

Default maximum number of iterations.

Definition at line 10 of file BFGSOpt.h.

const double BFGSOpt::MAXSTEP = 100.0

Default maximim step size in the minimizer.

Definition at line 13 of file BFGSOpt.h.

const double BFGSOpt::MOVETOL = 1e-7

Default tolerance for x changes in the minimizer.

Definition at line 9 of file BFGSOpt.h.

const double BFGSOpt::TOLX = 4.*EPS

Default direction vector tolerance in the minimizer.

Definition at line 12 of file BFGSOpt.h.