Loading...
Searching...
No Matches
BALL::LineSearch Class Reference
Molecular Modeling » Molecular Mechanics » Energy Minimizer

`#include <BALL/MOLMEC/MINIMIZATION/lineSearch.h>`

## Public Member Functions

Constructors and Destructors
| LineSearch ()
| LineSearch (EnergyMinimizer &minimizer)
| LineSearch (const LineSearch &line_search)
virtual | ~LineSearch ()
Assignments
const LineSearch & | operator= (const LineSearch &LineSearch)
Accessors
void | setAlpha (double alpha)
void | setBeta (double beta)
double | getAlpha () const
double | getBeta () const
Size | getMaxSteps () const
void | setMaxSteps (Size steps)
void | setLowerBound (double lbound)
double | getLowerBound () const
void | setXTol (double xtol)
double | getXTol () const
void | setBracketedFlag (bool bracktd)
bool | isBracketed () const
void | setMinimizer (EnergyMinimizer &minimizer)
virtual void | takeStep (double &st_a, double &f_a, double &g_a, double &st_b, double &f_b, double &g_b, double &stp, double f, double g, double minstp, double maxstp)

## Minimization

double | alpha_
double | beta_
Size | max_steps_
double | lower_energy_bound_
double | stptol_
bool | is_bracketed_
EnergyMinimizer * | minimizer_
virtual bool | minimize (double &stp, bool keep_gradient=false)

## Detailed Description

Basic line search class. This method minimizes the energy of a system along a given direction using a two stage algorithm. It is based on cubic and quadratic interpolation methods of Jorge J. More and David J. Thuente. See

[1] J. More and D. Thuente, "Line search algorithms with guaranteed sufficient decrease," ACM Transactions on Mathematical Software 20 (1994), no. 3, pp. 286-307.

Definition at line 32 of file lineSearch.h.

## Constructor & Destructor Documentation

## LineSearch() [1/3]

BALL::LineSearch::LineSearch | ( |  | ) |

Default constructor.

## LineSearch() [2/3]

BALL::LineSearch::LineSearch | ( | EnergyMinimizer & | minimizer | ) |

Detailed constructor.

## LineSearch() [3/3]

BALL::LineSearch::LineSearch | ( | const LineSearch & | line_search | ) |

Copy constructor

## ~LineSearch()

virtual BALL::LineSearch::~LineSearch | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## getAlpha()

double BALL::LineSearch::getAlpha | ( |  | ) | const

Get the parameter alpha (convergence criterion for the line search).

See also
  minimize

## getBeta()

double BALL::LineSearch::getBeta | ( |  | ) | const

Get the parameter beta (convergence criterion for the line search).

See also
  minimize

## getLowerBound()

double BALL::LineSearch::getLowerBound | ( |  | ) | const

Get the lower bound on energy values.

## getMaxSteps()

Size BALL::LineSearch::getMaxSteps | ( |  | ) | const

Get the parameter max_steps.

## getXTol()

double BALL::LineSearch::getXTol | ( |  | ) | const

Get the nonnegative relative tolerance for an acceptable step length.

## isBracketed()

bool BALL::LineSearch::isBracketed | ( |  | ) | const

Return whether a minimizer has already been bracketed. Warning: this returns only the flag is_bracketed_. If this flag has not been set by the algorithm but changed by setBracketedFlag this might not be trustworthy!

## minimize()

virtual bool BALL::LineSearch::minimize | ( | double & | stp,
|  | bool | keep_gradient = false )

virtual

Perform a line search. Find the minimum position for all atoms along the direction provided by the minimization algorithm. A two stage algorithm is used proposed by Jorge J. More and David J. Thuente. If necessary (the convergence criterion is not fulfilled) a minimizer along the given direction is bracketed in the first stage. In the second stage this function looks for a minimizer whithin the bracketed interval. The routine exits

(1) if the strong Wolfe conditions are satisfied (convergence criterion for the line search), that are

and

where and are the initial and the current gradient and is the search direction, is the current and the initial energy (stp = 0), and are two parameters (usually 0.9 and 0.0001).

(2) if the relative tolerance for an acceptable step is reached (length of the bracketing interval).

(3) if there has been some numerical problems. In this case the best step length which could be found is returned.

Parameters

  stp | Unused on entry since the line search always starts with stp = 1.0. On exit the step length corresponding to a successful step or just the best this function was able to find.
  keep_gradient | If true, we will not calculate the gradient for stp = 1 but assume that this has already been performed instead.

## operator=()

const LineSearch & BALL::LineSearch::operator= | ( | const LineSearch & | LineSearch | ) |

Assignment operator

## setAlpha()

void BALL::LineSearch::setAlpha | ( | double | alpha | ) |

Set the parameter alpha (convergence criterion for the line search).

See also
  minimize

## setBeta()

void BALL::LineSearch::setBeta | ( | double | beta | ) |

Set the parameter beta (convergence criterion for the line search).

See also
  minimize

## setBracketedFlag()

void BALL::LineSearch::setBracketedFlag | ( | bool | bracktd | ) |

Set the flag is_bracketed_. The algorithm will act as if a minimizer has already been bracketed (true) or not (false). Warning: this can be useful if a user exactly knows what they are doing. Usually, this flag should not be touched! The algorithm sets this flag automatically if a minimizer could be bracketed.

## setLowerBound()

void BALL::LineSearch::setLowerBound | ( | double | lbound | ) |

Set the lower bound on energy values. An estimation for the maximum step length is computed based on this value.

## setMaxSteps()

void BALL::LineSearch::setMaxSteps | ( | Size | steps | ) |

Set the parameter max_steps.

## setMinimizer()

void BALL::LineSearch::setMinimizer | ( | EnergyMinimizer & | minimizer | ) |

Set the minimizer class which provides the search direction and the force field among other things.

## setXTol()

void BALL::LineSearch::setXTol | ( | double | xtol | ) |

Set the nonnegative relative tolerance for an acceptable step length.

## takeStep()

virtual void BALL::LineSearch::takeStep | ( | double & | st_a,
|  | double & | f_a,
|  | double & | g_a,
|  | double & | st_b,
|  | double & | f_b,
|  | double & | g_b,
|  | double & | stp,
|  | double | f,
|  | double | g,
|  | double | minstp,
|  | double | maxstp )

virtual

Computes a safeguarded step for a search procedure by case differentiation dependend on whether a minimum could already be bracketed or not. All computations are done by safeguarded quadratic and cubic interpolation. The interval that contains a step that satisfies a sufficient decrease and the curvature condition is updated. This function is based on the proposed step computation of Jorge J. More and David J. Thuente. Don't worry if interval bounds are changed after this routine exits.

Parameters

  st_a | Best step obtained so far and an endpoint of the interval that contains the minimizer.
  f_a | Energy value at st_a.
  g_a | Directional derivative at st_a.
  st_b | Second endpoint of the interval that contains the minimizer.
  f_b | Energy value at st_b.
  g_b | Directional derivative at st_b.
  stp | Current step. If is_bracketed_ is set to true then stp must be between st_a and st_b.
  f | Energy value at stp.
  g | Directional derivative at stp.
  minstp | Lower bound for the step.
  maxstp | Upper bound for the step.

## Member Data Documentation

## alpha_

double BALL::LineSearch::alpha_

protected

Definition at line 202 of file lineSearch.h.

## beta_

double BALL::LineSearch::beta_

protected

Definition at line 206 of file lineSearch.h.

## is_bracketed_

bool BALL::LineSearch::is_bracketed_

protected

Definition at line 222 of file lineSearch.h.

## lower_energy_bound_

double BALL::LineSearch::lower_energy_bound_

protected

Definition at line 214 of file lineSearch.h.

## max_steps_

Size BALL::LineSearch::max_steps_

protected

Definition at line 210 of file lineSearch.h.

## minimizer_

EnergyMinimizer* BALL::LineSearch::minimizer_

protected

Definition at line 226 of file lineSearch.h.

## stptol_

double BALL::LineSearch::stptol_

protected

Definition at line 218 of file lineSearch.h.