minimize.h File Reference


Detailed Description

One-dimensional minimization routines.

Definition in file minimize.h.

Go to the source code of this file.

Data Structures

class  minimize
 Numerical differentiation base. More...

Functions

double constraint (double x, double center, double width, double height)
 Constrain x to be within width of the value given by center.
double cont_constraint (double x, double center, double width, double height, double tightness=40.0, double exp_arg_limit=50.0)
 Constrain x to be within width of the value given by center.
double lower_bound (double x, double center, double width, double height)
 Constrain x to be greater than the value given by center.
double cont_lower_bound (double x, double center, double width, double height, double tightness=40.0, double exp_arg_limit=50.0)
 Constrain x to be greater than the value given by center.


Function Documentation

double constraint ( double  x,
double  center,
double  width,
double  height 
) [inline]

Constrain x to be within width of the value given by center.

Defining $ c= $ center, $ w= $ width, $ h= $ height, this returns the value $ h (1+|x-c-w|/w) $ if $ x>c+w $ and $ h (1+|x-c+w|/w) $ if $ x<c-w $ . The value at $ x=c-w $ or $ x=c+w $ is $ h $ and the value at $ x=c-2w $ or $ x=c+2w $ is $ 2 h $ .

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer will likely ignore this constraint.

Definition at line 237 of file minimize.h.

double cont_constraint ( double  x,
double  center,
double  width,
double  height,
double  tightness = 40.0,
double  exp_arg_limit = 50.0 
) [inline]

Constrain x to be within width of the value given by center.

Defining $ c= $ center, $ w= $ width, $ h= $ height, $ t= $ tightness, and $ \ell= $ exp_arg_limit, this returns the value

\[ \left(\frac{x-c}{w}\right)^2 \left[ 1+ e^{t\left(x-c-w\right)\left(c+w-x\right)/w^2} \right]^{-1} \]

if $ x \geq c $ .

The exponential is handled gracefully by assuming that anything smaller than $ \exp(-\ell) $ is zero. This function is continuous and differentiable. Note that if $ x=c $ , then the function returns zero.

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer will likely ignore this constraint.

Definition at line 272 of file minimize.h.

double cont_lower_bound ( double  x,
double  center,
double  width,
double  height,
double  tightness = 40.0,
double  exp_arg_limit = 50.0 
) [inline]

Constrain x to be greater than the value given by center.

Defining $ c= $ center, $ w= $ width, $ h= $ height, $ t= $ tightness, and $ \ell= $ exp_arg_limit, this returns $ h(c-x+w)/(1+\exp(t(x-c)/w)) $ and has the advantage of being a continuous and differentiable function. The exponential is handled gracefully by assuming that anything smaller than $ \exp(-\ell) $ is zero

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then the constraint will be essentially ignored.

Definition at line 324 of file minimize.h.

double lower_bound ( double  x,
double  center,
double  width,
double  height 
) [inline]

Constrain x to be greater than the value given by center.

Defining $ c= $ center, $ w= $ width, $ h= $ height, this returns $ h(1+|x-c|/w) $ if $ x<c $ and zero otherwise. The value at $ x=c $ is $ h $ , while the value at $ x=c-w $ is $ 2 h $ .

It is important to note that, for large distances of x from center, this only scales linearly. If you are trying to constrain a function which decreases more than linearly by making x far from center, then a minimizer will likely ignore this constraint.

Definition at line 300 of file minimize.h.


Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.