Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
o2scl::min_quad_golden< func_t > Class Template Reference

Minimization of a function using the safeguarded step-length algorithm of Gill and Murray [GSL]. More...

#include <min_quad_golden.h>

Inheritance diagram for o2scl::min_quad_golden< func_t >:
o2scl::min_bkt_base< func_t > o2scl::min_base< func_t, func_t >

Public Member Functions

int set (func_t &func, double xmin, double lower, double upper)
 Set the function and the initial bracketing interval.
 
int set_with_values (func_t &func, double xmin, double fmin, double lower, double fl, double upper, double fu)
 Set the function, the initial bracketing interval, and the corresponding function values.
 
int iterate ()
 Perform an iteration.
 
virtual int min_bkt (double &x2, double x1, double x3, double &fmin, func_t &func)
 Calculate the minimum fmin of func with x2 bracketed between x1 and x3. More...
 
virtual const char * type ()
 Return string denoting type ("min_quad_golden")
 
- Public Member Functions inherited from o2scl::min_bkt_base< func_t >
virtual int min (double &x, double &fmin, func_t &func)
 Calculate the minimum min of func w.r.t 'x'. More...
 
virtual int min_de (double &x, double &fmin, func_t &func, func_t &df)
 Calculate the minimum min of func with derivative dfunc w.r.t 'x'. More...
 
- Public Member Functions inherited from o2scl::min_base< func_t, func_t >
virtual int print_iter (double x, double y, int iter, double value=0.0, double limit=0.0, std::string comment="")
 Print out iteration information. More...
 
virtual int bracket (double &ax, double &bx, double &cx, double &fa, double &fb, double &fc, func_t &func)
 Given interval (ax,bx), attempt to bracket a minimum for function func. More...
 

Public Attributes

double x_minimum
 Location of minimum.
 
double x_lower
 Lower bound.
 
double x_upper
 Upper bound.
 
double f_minimum
 Minimum value.
 
double f_lower
 Value at lower bound.
 
double f_upper
 Value at upper bound.
 
- Public Attributes inherited from o2scl::min_bkt_base< func_t >
int bracket_iter
 The number of iterations for automatically bracketing a minimum (default 20)
 
- Public Attributes inherited from o2scl::min_base< func_t, func_t >
int verbose
 Output control.
 
int ntrial
 Maximum number of iterations.
 
double tol_rel
 The tolerance for the minimum function value.
 
double tol_abs
 The tolerance for the location of the minimum.
 
int last_ntrial
 The number of iterations used in the most recent minimization.
 
int bracket_iter
 The number of iterations for automatically bracketing a minimum (default 20)
 
bool err_nonconv
 If true, call the error handler if the routine does not "converge".
 

Protected Member Functions

int compute_f_values (func_t &func, double xminimum, double *fminimum, double xlower, double *flower, double xupper, double *fupper)
 Compute the function values at the various points.
 

Protected Attributes

func_t * uf
 The function.
 
double x_prev_small
 
double f_prev_small
 
double x_small
 
double f_small
 
double step_size
 
double stored_step
 
double prev_stored_step
 
size_t num_iter
 
double rel_err_val
 
double abs_err_val
 
double golden_mean
 
double golden_ratio
 

Detailed Description

template<class func_t = funct11>
class o2scl::min_quad_golden< func_t >

This class is unfinished.

Documentation from GSL:

This algorithm performs univariate minimization (i.e., line
search). It requires only objective function values g(x) to
compute the minimum. The algorithm maintains an interval of
uncertainty [a,b] and a point x in the interval [a,b] such that
a < x < b, and g(a) > g(x) and g(x) < g(b). The algorithm also
maintains the three points with the smallest objective values x,
v and w such that g(x) < g(v) < g(w). The algorithm terminates
when max( x-a, b-x ) < 2(r |x| + t) where r and t are small
positive reals. At a given iteration, the algorithm first fits a
quadratic through the three points (x, g(x)), (v, g(v)) and (w,
g(w)) and computes the location of the minimum u of the
resulting quadratic. If u is in the interval [a,b] then g(u) is
computed. If u is not in the interval [a,b], and either v < x
and w < x, or v > x and w > x (i.e., the quadratic is
extrapolating), then a point u' is computed using a safeguarding
procedure and g(u') is computed. If u is not in the interval
[a,b], and the quadratic is not extrapolating, then a point u''
is computed using approximate golden section and g(u'') is
computed. After evaluating g() at the appropriate new point, a,
b, x, v, and w are updated and the next iteration is performed.
The algorithm is based on work presented in the following
references.
                                                                      
Algorithms for Minimization without derivatives
Richard Brent
Prentice-Hall Inc., Englewood Cliffs, NJ, 1973

Safeguarded Steplength Algorithms for Optimization using Descent Methods
Philip E. Gill and Walter Murray
Division of Numerical Analysis and Computing
National Physical Laboratory, Teddington, United Kingdom
NPL Report NAC 37, August 1974
Idea for Future:
Take common elements of this and min_brent and move to a generic GSL minimizer type?

Definition at line 105 of file min_quad_golden.h.

Member Function Documentation

◆ min_bkt()

template<class func_t = funct11>
virtual int o2scl::min_quad_golden< func_t >::min_bkt ( double &  x2,
double  x1,
double  x3,
double &  fmin,
func_t &  func 
)
inlinevirtual

Note that this algorithm requires that the initial guess already brackets the minimum, i.e. $ x_1<x_2<x_3 $, $ f(x_1)>f(x_2) $ and $ f(x_3)>f(x_2) $. This is different from min_cern, where the initial value of the first parameter to min_cern::min_bkt() is ignored.

Implements o2scl::min_bkt_base< func_t >.

Definition at line 406 of file min_quad_golden.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).