Class anneal_base (o2scl)¶
-
template<class
func_t
= multi_funct, classvec_t
= boost::numeric::ublas::vector<double>, classrng_t
= rng_gsl>
classo2scl
::
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 inputsx[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.
- Todo:
I’m having trouble with std::uniform_real_distribution on clang at the moment, so this class uses o2scl::prob_dens_uniform for the moment.
Public Functions
-
anneal_base
()¶
-
~anneal_base
()¶
-
int
mmin
(size_t nvar, vec_t &x, double &fmin, func_t &func) = 0¶ Calculate the minimum
fmin
offunc
w.r.t the arrayx
of sizenvar
.
-
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.
-
const char *
type
()¶ Return string denoting type,
"anneal_base"
.
-
anneal_base
(const anneal_base<func_t, vec_t, rng_t> &ab)¶ Copy constructor.
-
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
-
o2scl::prob_dens_uniform
dist
¶ The random distribution object.