Loading...
Searching...
No Matches
BFGSOpt Namespace Reference

## Functions

template<typename EnergyFunctor>
void | linearSearch (unsigned int dim, double *oldPt, double oldVal, double *grad, double *dir, double *newPt, double &newVal, EnergyFunctor func, double maxStep, int &resCode)
template<typename EnergyFunctor, typename GradientFunctor>
int | minimize (unsigned int dim, double *pos, double gradTol, unsigned int &numIters, double &funcVal, EnergyFunctor func, GradientFunctor gradFunc, unsigned int snapshotFreq, RDKit::SnapshotVect *snapshotVect, double funcTol=TOLX, unsigned int maxIts=MAXITS)
| Do a BFGS minimization of a function.
template<typename EnergyFunctor, typename GradientFunctor>
int | minimize (unsigned int dim, double *pos, double gradTol, unsigned int &numIters, double &funcVal, EnergyFunctor func, GradientFunctor gradFunc, double funcTol=TOLX, unsigned int maxIts=MAXITS)
| Do a BFGS minimization of a function.
static bool | cpuHasSVE ()

## Variables

RDKIT_OPTIMIZER_EXPORT int | HEAD_ONLY_LIBRARY
RDKIT_OPTIMIZER_EXPORT int | REALLY_A_HEADER_ONLY_LIBRARY
const double | FUNCTOL
| Default tolerance for function convergence in the minimizer.
const double | MOVETOL
| 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
| Default direction vector tolerance in the minimizer.
const double | MAXSTEP = 100.0
| Default maximum step size in the minimizer.

## Function Documentation

## cpuHasSVE()

bool BFGSOpt::cpuHasSVE | ( |  | ) |

static

Definition at line 16 of file BFGSOpt_SVE.h.

Referenced by minimize().

## linearSearch()

template<typename EnergyFunctor>

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

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)

Definition at line 55 of file BFGSOpt.h.

References FUNCTOL, MOVETOL, and PRECONDITION.

Referenced by minimize().

## minimize() [1/2]

template<typename EnergyFunctor, typename GradientFunctor>

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

Do a BFGS minimization of a function.

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

Definition at line 385 of file BFGSOpt.h.

References MAXITS, minimize(), and TOLX.

## minimize() [2/2]

template<typename EnergyFunctor, typename GradientFunctor>

int BFGSOpt::minimize | ( | unsigned int | dim,
|  | double * | pos,
|  | double | gradTol,
|  | unsigned int & | numIters,
|  | double & | funcVal,
|  | EnergyFunctor | func,
|  | GradientFunctor | gradFunc,
|  | unsigned int | snapshotFreq,
|  | RDKit::SnapshotVect * | snapshotVect,
|  | 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
  snapshotFreq | a snapshot of the minimization trajectory will be stored after as many steps as indicated through this parameter; defaults to 0 (no snapshots stored)
  snapshotVect | pointer to a std::vector<Snapshot> object that will receive the coordinates and energies every snapshotFreq steps; defaults to NULL (no snapshots stored)

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

Definition at line 184 of file BFGSOpt.h.

References CHECK_INVARIANT, cpuHasSVE(), EPS, linearSearch(), MAXITS, MAXSTEP, PRECONDITION, RDUNUSED_PARAM, and TOLX.

Referenced by minimize().

## Variable Documentation

## EPS

const double BFGSOpt::EPS = 3e-8

Default gradient tolerance in the minimizer.

Definition at line 30 of file BFGSOpt.h.

Referenced by minimize().

## FUNCTOL

const double BFGSOpt::FUNCTOL

Initial value:
=
1e-4

Default tolerance for function convergence in the minimizer.

Definition at line 25 of file BFGSOpt.h.

Referenced by linearSearch().

## HEAD_ONLY_LIBRARY

RDKIT_OPTIMIZER_EXPORT int BFGSOpt::HEAD_ONLY_LIBRARY

extern

## MAXITS

const int BFGSOpt::MAXITS = 200

Default maximum number of iterations.

Definition at line 29 of file BFGSOpt.h.

Referenced by minimize(), and minimize().

## MAXSTEP

const double BFGSOpt::MAXSTEP = 100.0

Default maximum step size in the minimizer.

Definition at line 33 of file BFGSOpt.h.

Referenced by minimize().

## MOVETOL

const double BFGSOpt::MOVETOL

Initial value:
=
1e-7

Default tolerance for x changes in the minimizer.

Definition at line 27 of file BFGSOpt.h.

Referenced by linearSearch().

## REALLY_A_HEADER_ONLY_LIBRARY

RDKIT_OPTIMIZER_EXPORT int BFGSOpt::REALLY_A_HEADER_ONLY_LIBRARY

extern

## TOLX

const double BFGSOpt::TOLX

Initial value:
=
4. * EPS
BFGSOpt::EPS
const double EPS
Default gradient tolerance in the minimizer.
Definition BFGSOpt.h:30

Default direction vector tolerance in the minimizer.

Definition at line 31 of file BFGSOpt.h.

Referenced by minimize(), and minimize().