![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
One-dimensional minimization base class and associated functions. More...
#include <cmath>
#include <o2scl/err_hnd.h>
#include <o2scl/funct.h>
Go to the source code of this file.
Definition in file minimize.h.
Data Structures | |
class | minimize< func_t, dfunc_t > |
One-dimensional minimization [abstract base]. More... | |
class | minimize_bkt< func_t, dfunc_t > |
One-dimensional bracketing minimization [abstract base]. More... | |
class | minimize_de< func_t, dfunc_t > |
One-dimensional minimization using derivatives [abstract 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 . |
double constraint | ( | double | x, |
double | center, | ||
double | width, | ||
double | height | ||
) | [inline] |
Defining
center
,
width
,
height
, this returns the value if
and
if
. The value near
or
is
(the value of the function exactly at these points is zero) and the value at
or
is
.
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 may ignore this constraint.
Definition at line 370 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] |
Defining
center
,
width
,
height
,
tightness
, and
exp_arg_limit
, this returns the value
This function is continuous and differentiable. Note that if , then the function returns zero.
The exponential is handled gracefully by assuming that anything smaller than is zero. This creates a small discontinuity which can be removed with the sufficiently large value of
.
It is important to note that, for large distances of x
from center
, this scales quadratically. If you are trying to constrain a function which decreases faster than quadratically by making x
far from center
, then a minimizer may ignore this constraint.
In the limit , this function converges towards the squared value of constraint(), except exactly at the points
and
.
Definition at line 411 of file minimize.h.
double lower_bound | ( | double | x, |
double | center, | ||
double | width, | ||
double | height | ||
) | [inline] |
Defining
center
,
width
,
height
, this returns if
and zero otherwise. The value at
is
, while the value at
is
.
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 may ignore this constraint.
Definition at line 438 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] |
Defining
center
,
width
,
height
,
tightness
, and
exp_arg_limit
, this returns and has the advantage of being a continuous and differentiable function. The value of the function exactly at
is
, but for
just below
the function is
and just above
the function is quite small.
The exponential is handled gracefully by assuming that anything smaller than is zero. This creates a small discontinuity which can be removed with the sufficiently large value of
.
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 may ingore this constraint.
In the limit , this function converges towards lower_bound(), except exactly at the point
.
Definition at line 472 of file minimize.h.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).