Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Data Fields | Protected Attributes
multi_min< func_t, dfunc_t, vec_t > Class Template Reference

Multidimensional minimization [abstract base]. More...

#include <multi_min.h>

Inheritance diagram for multi_min< func_t, dfunc_t, vec_t >:
gsl_mmin_simp< func_t, vec_t, alloc_vec_t, alloc_t > gsl_mmin_simp2< func_t, vec_t, alloc_vec_t, alloc_t > multi_min_fix< bool_vec_t > ool_constr_mmin< func_t, dfunc_t, hfunc_t, vec_t, alloc_vec_t, alloc_t > ool_constr_mmin< func_t, dfunc_t, ool_hfunct< int >, vec_t, alloc_vec_t, alloc_t > sim_anneal< func_t, vec_t, rng_t > ool_mmin_pgrad< func_t, dfunc_t, vec_t, alloc_vec_t, alloc_t > ool_mmin_spg< func_t, dfunc_t, vec_t, alloc_vec_t, alloc_t > gsl_anneal< func_t, vec_t, alloc_vec_t, alloc_t, rng_t >

Detailed Description

template<class func_t, class dfunc_t = func_t, class vec_t = ovector_base>
class multi_min< func_t, dfunc_t, vec_t >

The template parameters: The template parameter func_t specifies the function to minimize and should be a class containing a definition

      func_t::operator()(size_t nv, const vec_t &x, double &f);

where f is the value of the function at x , where x is a array-like class defining operator[] of size nv. The parameter dfunc_t (if used) should provide the gradient with

      func_t::operator()(size_t nv, vec_t &x, vec_t &g);

where g is the gradient of the function at x.

Verbose I/O is sent through std::cout and std::cin by default, but this can be modified using set_verbose_stream().

Definition at line 463 of file multi_min.h.

Public Member Functions

int set_verbose_stream (std::ostream &out, std::istream &in)
 Set streams for verbose I/O.
virtual int mmin (size_t nvar, vec_t &x, double &fmin, func_t &func)=0
 Calculate the minimum min of func w.r.t. the array x of size nvar.
virtual int mmin_de (size_t nvar, vec_t &x, double &fmin, func_t &func, dfunc_t &dfunc)
 Calculate the minimum min of func w.r.t. the array x of size nvar with gradient dfunc.
template<class vec2_t >
int print_iter (size_t nv, vec2_t &x, double y, int iter, double value, double limit, std::string comment)
 Print out iteration information.
const char * type ()
 Return string denoting type ("multi_min")

Data Fields

int verbose
 Output control.
int ntrial
 Maximum number of iterations.
double tol_rel
 Function value tolerance.
double tol_abs
 The independent variable tolerance.
int last_ntrial
 The number of iterations for in the most recent minimization.
bool err_nonconv
 If true, call the error handler if the routine does not "converge".
int last_conv
 Zero if last call to mmin() or mmin_de() converged.

Protected Attributes

std::ostream * outs
 Stream for verbose output.
std::istream * ins
 Stream for verbose input.

Member Function Documentation

template<class func_t, class dfunc_t = func_t, class vec_t = ovector_base>
template<class vec2_t >
int multi_min< func_t, dfunc_t, vec_t >::print_iter ( size_t  nv,
vec2_t &  x,
double  y,
int  iter,
double  value,
double  limit,
std::string  comment 
) [inline]

Depending on the value of the variable verbose, this prints out the iteration information. If verbose=0, then no information is printed, while if verbose>1, then after each iteration, the present values of x and y are output to std::cout along with the iteration number. If verbose>=2 then each iteration waits for a character.

Definition at line 551 of file multi_min.h.


Field Documentation

template<class func_t, class dfunc_t = func_t, class vec_t = ovector_base>
int multi_min< func_t, dfunc_t, vec_t >::last_conv

This is particularly useful if err_nonconv is false to test if the last call to mmin() or mmin_de() converged.

Definition at line 516 of file multi_min.h.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.