gsl_mmin_conf Class Template Reference

#include <gsl_mmin_conf.h>

Inheritance diagram for gsl_mmin_conf:

gsl_mmin_base multi_min< param_t, func_t, func_t, vec_t >

Detailed Description

template<class param_t, class func_t = multi_funct<param_t>, class vec_t = ovector_view, class alloc_vec_t = ovector, class alloc_t = ovector_alloc, class dfunc_t = grad_funct<param_t,ovector_view>, class auto_grad_t = gradient<param_t,func_t,ovector_view>, class def_auto_grad_t = simple_grad<param_t,func_t,ovector_view>>
class gsl_mmin_conf< param_t, func_t, vec_t, alloc_vec_t, alloc_t, dfunc_t, auto_grad_t, def_auto_grad_t >

Multidimensional minimization by the Fletcher-Reeves conjugate gradient algorithm (GSL).

The variable multi_min::tolf is used as the maximum value of the gradient and is $ 10^{-4} $ be default.

The gsl iterate() function for this minimizer chooses to return GSL_ENOPROG if the iteration fails to make progress without calling the error handler. This is presumably because the iterate() function can fail to make progress when the algorithm has succeeded in finding the minimum. I prefer to return a non-zero value from a function only in cases where the error handler will also be called, so the user is clear on what an "error" means in the local context. Thus if iterate() is failing to make progress, instead of returning a non-zero value, it sets the value of it_info to a non-zero value.

Todo:
A bit of needless copying is required in the function wrapper to convert from gsl_vector to the templated vector type. This can be fixed, probably by rewriting take_step to produce a vec_t &x1 rather than a gsl_vector *x1;
Those who look in detail at the code will note that the state variable max_iter has not been included here, because it was not really used in the original GSL code for these minimizers.

Definition at line 362 of file gsl_mmin_conf.h.


Public Member Functions

 gsl_mmin_conf ()
virtual ~gsl_mmin_conf ()
virtual int iterate ()
 Perform an iteration.
virtual const char * type ()
 Return string denoting type("gsl_mmin_conf").
virtual int allocate (size_t n)
 Allocate the memory.
virtual int free ()
 Free the allocated memory.
int restart ()
 Reset the minimizer to use the current point as a new starting point.
virtual int set (vec_t &x, double u_step_size, double tol_u, func_t &ufunc, param_t &pa)
 Set the function and initial guess.
virtual int set_de (vec_t &x, double u_step_size, double tol_u, func_t &ufunc, dfunc_t &udfunc, param_t &pa)
 Set the function and initial guess.
virtual int mmin (size_t nn, vec_t &xx, double &fmin, param_t &pa, func_t &ufunc)
 Calculate the minimum min of func w.r.t the array x of size nvar.
virtual int mmin_de (size_t nn, vec_t &xx, double &fmin, param_t &pa, func_t &ufunc, dfunc_t &udfunc)
 Calculate the minimum min of func w.r.t the array x of size nvar.

Data Fields

double lmin_tol
 Tolerance for the line minimization (default $ 10^{-4} $).
double step_size
 Size of the initial step.
int it_info
 Information from the last call to iterate().

Protected Attributes

alloc_vec_t avt5
 Temporary vector.
alloc_vec_t avt6
 Temporary vector.
alloc_vec_t avt7
 Temporary vector.
alloc_vec_t avt8
 Temporary vector.
The original variables from the GSL state structure
int iter
 Desc.
double step
 Desc.
double tol
 Desc.
gsl_vector * x1
 Desc.
gsl_vector * dx1
 Desc.
gsl_vector * x2
 Desc.
double pnorm
 Desc.
gsl_vector * p
 Desc.
double g0norm
 Desc.
gsl_vector * g0
 Desc.
Store the arguments to set() so we can use them for iterate()
gsl_vector * ugx
 Desc.
gsl_vector * ugg
 Desc.
gsl_vector * udx
 Desc.
double it_min
 Desc.

Member Function Documentation

virtual int set ( vec_t &  x,
double  u_step_size,
double  tol_u,
func_t &  ufunc,
param_t &  pa 
) [inline, virtual]

Set the function and initial guess.

Evaluate the function and its gradient

Definition at line 663 of file gsl_mmin_conf.h.

virtual int set_de ( vec_t &  x,
double  u_step_size,
double  tol_u,
func_t &  ufunc,
dfunc_t &  udfunc,
param_t &  pa 
) [inline, virtual]

Set the function and initial guess.

Evaluate the function and its gradient

Definition at line 699 of file gsl_mmin_conf.h.


Field Documentation

int it_info

Information from the last call to iterate().

This is 1 if pnorm or gnorm are 0 and 2 if stepb is zero.

Todo:
Document this better

Definition at line 442 of file gsl_mmin_conf.h.


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

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

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page