Simulated annealing base. More...
#include <anneal.h>
Public Member Functions | |
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 . | |
virtual int | print_iter (size_t nv, vec_t &x, double y, int iter, double tptr, std::string comment) |
Print out iteration information. More... | |
virtual 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=. | |
![]() | |
mmin_base (const mmin_base< func_t, func_t, vec_t > &mb) | |
Copy constructor. | |
int | set_verbose_stream (std::ostream &out, std::istream &in) |
Set streams for verbose I/O. More... | |
virtual int | mmin_de (size_t nvar, vec_t &x, double &fmin, func_t &func, func_t &dfunc) |
Calculate the minimum min of func w.r.t. the array x of size nvar with gradient dfunc . | |
int | print_iter (size_t nv, vec2_t &x, double y, int iter, double value, double limit, std::string comment) |
Print out iteration information. More... | |
const char * | type () |
Return string denoting type ("mmin_base") | |
mmin_base< func_t, func_t, vec_t > & | operator= (const mmin_base< func_t, func_t, vec_t > &mb) |
Copy constructor from operator=. | |
Public Attributes | |
rng_t | rng |
The default random number generator. | |
o2scl::prob_dens_uniform | dist |
The random distribution object. | |
![]() | |
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". | |
Additional Inherited Members | |
![]() | |
std::ostream * | outs |
Stream for verbose output. | |
std::istream * | ins |
Stream for verbose input. | |
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 .
The number of iterations at each temperature is controlled by o2scl::mmin_base::ntrial which defaults to 100.
|
inlinevirtual |
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.
Reimplemented in o2scl::anneal_mt< func_t, vec_t, rng_t, rng_dist_t >.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).