This function performs a simulated annealing search through a given space. The space is specified by providing the functions Ef and distance. The simulated annealing steps are generated using the random number generator r and the function take_step.
The starting configuration of the system should be given by x0_p. The routine offers two modes for updating configurations, a fixed-size mode and a variable-size mode. In the fixed-size mode the configuration is stored as a single block of memory of size element_size. Copies of this configuration are created, copied and destroyed internally using the standard library functions
free. The function pointers copyfunc, copy_constructor and destructor should be null pointers in fixed-size mode. In the variable-size mode the functions copyfunc, copy_constructor and destructor are used to create, copy and destroy configurations internally. The variable element_size should be zero in the variable-size mode.
The params structure (described below) controls the run by providing the temperature schedule and other tunable parameters to the algorithm.
On exit the best result achieved during the search is placed in
*x0_p. If the annealing process has been successful this should be a good approximation to the optimal point in the space.
If the function pointer print_position is not null, a debugging log will be printed to
stdoutwith the following columns:#-iter #-evals temperature position energy best_energy
and the output of the function print_position itself. If print_position is null then no information is printed.
The simulated annealing routines require several user-specified functions to define the configuration space and energy function. The prototypes for these functions are given below.
This function type should return the energy of a configuration xp.double (*gsl_siman_Efunc_t) (void *xp)
This function type should modify the configuration xp using a random step taken from the generator r, up to a maximum distance of step_size.void (*gsl_siman_step_t) (const gsl_rng *r, void *xp, double step_size)
This function type should return the distance between two configurations xp and yp.double (*gsl_siman_metric_t) (void *xp, void *yp)
This function type should print the contents of the configuration xp.void (*gsl_siman_print_t) (void *xp)
This function type should copy the configuration source into dest.void (*gsl_siman_copy_t) (void *source, void *dest)
This function type should create a new copy of the configuration xp.void * (*gsl_siman_copy_construct_t) (void *xp)
This function type should destroy the configuration xp, freeing its memory.void (*gsl_siman_destroy_t) (void *xp)
These are the parameters that control a run of
gsl_siman_solve. This structure contains all the information needed to control the search, beyond the energy function, the step function and the initial guess.
- The number of points to try for each step.
- The number of iterations at each temperature.
- The maximum step size in the random walk.
double k, t_initial, mu_t, t_min
- The parameters of the Boltzmann distribution and cooling schedule.