sim_anneal Class Template Reference

#include <sim_anneal.h>

Inheritance diagram for sim_anneal:

multi_min gsl_anneal

Detailed Description

template<class param_t, class func_t, class vec_t = ovector_view, class rng_t = gsl_rnga>
class sim_anneal< param_t, func_t, vec_t, rng_t >

Simulated annealing base.

The seed of the generator is not fixed initially by calls to mmin(), so if successive calls should reproduce the same results, then the random seed should be set by the user before each call.

For the algorithms here, it is important that all of the inputs x[i] to the function are scaled similarly relative to the temperature. For example, if the inputs x[i] are all of order 1, one might consider a temperature schedule which begins with $ T=1 $ .

The number of iterations at each temperature is controlled by minimize::ntrial which defaults to 100.

Definition at line 58 of file sim_anneal.h.


Public Member Functions

 sim_anneal ()
virtual ~sim_anneal ()
virtual int mmin (size_t nvar, vec_t &x, double &fmin, param_t &pa, func_t &func)
 Calculate the minimum fmin of func w.r.t the array x of size nvar.
int set_tptr_schedule (tptr_schedule< vec_t > &tr)
 Specify the temperature schedule.
virtual int print_iter (size_t nv, vec_t &x, double y, int iter, double tptr, std::string comment)
 Print out iteration information.
virtual const char * type ()
 Return string denoting type, "sim_anneal".

Data Fields

rng_t def_rng
 The default random number generator.
tptr_geoseries< vec_t > def_schedule
 The default temperature schedule.

Protected Attributes

tptr_schedule< vec_t > * tp
 Pointer to the temperature annealing schedule.

Member Function Documentation

virtual int print_iter ( size_t  nv,
vec_t &  x,
double  y,
int  iter,
double  tptr,
std::string  comment 
) [inline, virtual]

Print out iteration information.

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 103 of file sim_anneal.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.