Definition in file minimize.h.
#include <o2scl/err_hnd.h>
Go to the source code of this file.
Data Structures | |
class | minimize |
One-dimensional minimization [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] |
Constrain x
to be within width
of the value given by center
.
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 278 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
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 319 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
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 382 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
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 347 of file minimize.h.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page