gsl_anneal Class Template Reference

#include <gsl_anneal.h>

Inheritance diagram for gsl_anneal:

sim_anneal multi_min< param_t, func_t, func_t, vec_t >

Detailed Description

template<class param_t, class func_t, class vec_t = ovector_view, class alloc_vec_t = ovector, class alloc_t = ovector_alloc, class rng_t = gsl_rnga>
class gsl_anneal< param_t, func_t, vec_t, alloc_vec_t, alloc_t, rng_t >

Multidimensional minimization by simulated annealing (GSL).

This class is a modification of simulated annealing as implemented in GSL in the function gsl_siman_solve(). It acts as a generic multidimensional minimizer for any function given a generic temperature schedule specified by the user.

The simulated annealing algorithm proposes a displacement of one coordinate of the previous point by

\[ x_{i,\mathrm{new}} = \mathrm{step\_size}_i (2 u_i - 1) + x_{i,\mathrm{old}} \]

where the $u_i$ are random numbers between 0 and 1. The displacement is accepted or rejected based on the Metropolis method. The random number generator and temperature schedule are set in the parent, sim_anneal. The variables multi_min::tolx and multi_min::tolf are not used.

The step size for each dimension is specified in set_stepsize(). The number of stepsizes specified need not be the same as the number of dimensions. If nstep is the number of stepsizes, then the stepsize for dimension i is

      step_size[i % nstep]

Idea for future:
Implement a more general simulated annealing routine which would allow the solution of discrete problems like the Traveling Salesman problem.
Idea for future:
Implement a method which automatically minimizes within some specified tolerance?

Definition at line 77 of file gsl_anneal.h.


Public Member Functions

virtual int mmin (size_t nvar, vec_t &x0, double &fmin, param_t &pa, func_t &func)
 Calculate the minimum fmin of func w.r.t the array x0 of size nvar.
virtual const char * type ()
 Return string denoting type ("gsl_anneal").
template<class vec2_t>
int set_stepsize (size_t n, vec2_t &ss)
 Set the step.

Data Fields

double boltz
 Boltzmann factor (default 1.0).

Protected Member Functions

virtual int allocate (size_t n, double boltz_factor=1.0)
 Allocate memory for a minimizer over n dimensions with stepsize step and Boltzmann factor boltz_factor.
virtual int free ()
 Free allocated memory.
virtual int step (vec_t &sx, int nvar)
 Make a step to a new attempted minimum.

Protected Attributes

alloc_t ao
 Allocation object.
size_t nstep
 Number of step sizes.
double * step_sizes
 Step sizes.
Storage for present, next, and best vectors
alloc_vec_t x
alloc_vec_t new_x
alloc_vec_t best_x

The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page