|
| typedef double(* | Efunc_t) (XP &xp) |
| | Function returning then energy of a configuration. More...
|
| |
| typedef void(* | step_t) (rng &r, XP &xp, double step_size) |
| | Function to modify configuration with random number up to maximum step size. More...
|
| |
| typedef double(* | metric_t) (XP &xp, XP &yp) |
| | Function to find distance between two configurations. More...
|
| |
| typedef void(* | print_t) (XP &xp) |
| | Function to print a configuration. More...
|
| |
| typedef void(* | copy_t) (XP &source, XP &dest) |
| | Function to copy configuration contents from source to dest. More...
|
| |
| typedef XP *(* | copy_construct_t) (XP &xp) |
| | Function to construct a configuration. More...
|
| |
| typedef void(* | destroy_t) (XP *xp) |
| | Function to destruct a configuration. More...
|
| |
| typedef gsl_siman_params_t | params_t |
| | Parameters: same as gsl_siman_params_t. More...
|
| |
template<typename XP>
struct gsl::siman< XP >
Simulated annealing.
Use this class as siman<XP>, where XP is the class whose objects represent configurations.
Ideally these functions would wrap the GSL functions as almost all of ccgsl does. However, gsl_siman_solve() uses as arguments pointers to functions with void pointer arguments. In C++ we want to avoid creating such functions explicitly, currently (2012) I know of no way to create them inside a class in such a way that they can be generically constructed as required. It is not possible to substitute a pointer to a function object for a pointer to a function and, while it is possible to create a lambda function in C++11, it is not legal to pass its address as a function pointer.
The compromise here is to wrap the original code from gsl_siman.c in template functions with suitable template arguments. It has the desired effect but means that if gsl_siman.c is updated, the code for ccgsl/siman.hpp must be updated separately to take advantage of any changes.
Definition at line 50 of file siman.hpp.
C++ version of gsl_siman_solve().
If configurations are C++ objects, typically you should provide copyfunc, copy_construct and destructor as non-null pointers and element_size will not be used. Otherwise, element_size must be the size of an object and the object will be copied directly, which is unwise if a configuration object contains pointers.
- Parameters
-
| r | A random number generator |
| x0_p | The initial configuration (also final configuration on return) |
| Ef | The Energy fiunction: gives energy of configuration |
| take_step | The step function |
| distance | The distance function |
| print_position | Function to print position |
| copyfunc | Function to copy a configuration |
| copy_constructor | Function to copy-construct a configuration |
| destructor | Function to delete a configuration |
| params | Parameters of the Simulated Annealing heuristic |
Definition at line 101 of file siman.hpp.
References gsl::math::E, gsl::cpx::exp(), gsl::cheb::size(), and gsl::rng::uniform().