15#include "gsl/gsl_siman.h" 
   35   fX( std::vector<
double>(
x, 
x + func.NDim() ) ),
 
   36   fScale( std::vector<
double>(func.NDim() )),
 
   44   fX( std::vector<
double>(
x, 
x + func.NDim() ) ),
 
   45   fScale( std::vector<
double>(scale, scale + func.NDim() ) ),
 
   57   unsigned int ndim = 
NDim();
 
   58   for (
unsigned int i = 0; i < ndim; ++i) {
 
   59      double urndm = random();
 
   60      double sstep = maxstep * 
fScale[i];
 
   61      fX[i] +=  2 * sstep * urndm - sstep;
 
   68   const std::vector<double> & 
x = 
fX;
 
   69   const std::vector<double> & 
y = 
f.X();
 
   70   unsigned int n = 
x.size();
 
   71   assert (
n == 
y.size());
 
   74      for (
unsigned int i = 0; i < 
n; ++i)
 
   75         d2 += ( 
x[i] - 
y[i] ) * ( 
x[i] - 
y[i] );
 
   80      return std::abs( 
x[0] - 
y[0] );
 
   86   std::cout << 
"\tx = ( ";
 
   88   for (
unsigned int i = 0; i < 
n-1; ++i) {
 
   89      std::cout << 
fX[i] << 
" , ";
 
   91   std::cout << 
fX.back() << 
" )\t";
 
   93   std::cout << 
"E  / E_best = ";   
 
   99   std::copy(rhs.
fX.begin(), rhs.
fX.end(), 
fX.begin() );
 
  110   double E( 
void * xp) {
 
  113      assert (fx != 
nullptr);
 
  117   void Step( 
const gsl_rng * 
r, 
void * xp, 
double step_size) {
 
  120      assert (fx != 
nullptr);
 
  126      fx->
Step(random, step_size);
 
  129   double Dist( 
void * xp, 
void * yp) {
 
  134      assert (fx != 
nullptr);
 
  135      assert (fy != 
nullptr);
 
  143      assert (fx != 
nullptr);
 
  151      assert (fx != 
nullptr);
 
  153      assert (gx != 
nullptr);
 
  159      assert (fx != 
nullptr);
 
  160      return static_cast<void *
> ( fx->
Clone() );
 
  165      assert (fx != 
nullptr);
 
  190   int iret =  
Solve(fx, debug);
 
  194      std::copy(fx.
X().begin(), fx.
X().end(), 
xmin);
 
  203   gsl_rng * 
r = gsl_rng_alloc(gsl_rng_mt19937);
 
  207   gsl_siman_params_t simanParams;
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
GSLRandomEngine Base class for all GSL random engines, normally user instantiate the derived classes ...
GSLRngWrapper class to wrap gsl_rng structure.
GSLSimAnFunc class description.
double X(unsigned int i) const
virtual double Distance(const GSLSimAnFunc &func) const
calculate the distance (metric) between this one and another configuration Presently a cartesian metr...
virtual void Print()
print the position in the standard output std::ostream GSL prints in addition n iteration,...
GSLSimAnFunc()
derived classes might need to re-define completely the class
unsigned int NDim() const
virtual GSLSimAnFunc & FastCopy(const GSLSimAnFunc &f)
fast copy method called by GSL simulated annealing internally copy only the things which have been ch...
virtual double Energy() const
evaluate the energy ( objective function value) re-implement by derived classes if needed to be modif...
virtual void Step(const GSLRandomEngine &r, double maxstep)
change the x[i] value using a random value urndm generated between [0,1] up to a maximum value maxste...
virtual GSLSimAnFunc * Clone() const
clone method.
std::vector< double > fScale
const ROOT::Math::IMultiGenFunction * fFunc
int Solve(const ROOT::Math::IMultiGenFunction &func, const double *x0, const double *scale, double *xmin, bool debug=false)
solve the simulated annealing given a multi-dim function, the initial vector parameters and a vector ...
GSLSimAnnealing()
Default constructor.
Documentation for the abstract class IBaseFunctionMultiDim.
Namespace for new Math classes and functions.
double Dist(void *xp, void *yp)
void * CopyCtor(void *xp)
void Copy(void *source, void *dest)
void Step(const gsl_rng *r, void *xp, double step_size)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
double k
parameters for the Boltzman distribution
#define dest(otri, vertexptr)