Class anneal_base (o2scl)

O2scl : Class List

template<class func_t = multi_funct, class vec_t = boost::numeric::ublas::vector<double>, class rng_t = o2scl::rng<>>
class anneal_base : public o2scl::mmin_base<multi_funct, multi_funct, boost::numeric::ublas::vector<double>>

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 o2scl::mmin_base::ntrial which defaults to 100.

Subclassed by o2scl::anneal_gsl< multi_funct, boost::numeric::ublas::vector< double > >, o2scl::anneal_gsl< func_t, vec_t, rng_t >, o2scl::anneal_mt< func_t, vec_t, rng_t, rng_dist_t >

Public Functions

inline anneal_base()
inline virtual ~anneal_base()
virtual int mmin(size_t nvar, vec_t &x, double &fmin, func_t &func) = 0

Calculate the minimum fmin of func w.r.t the array x of size nvar.

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

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.

inline virtual const char *type()

Return string denoting type, "anneal_base".

inline anneal_base(const anneal_base<func_t, vec_t, rng_t> &ab)

Copy constructor.

inline anneal_base<func_t, vec_t, rng_t> &operator=(const anneal_base<func_t, vec_t, rng_t> &ab)

Copy constructor from operator=.

Public Members

rng_t local_rng

The default random number generator.