Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::GSLSimAnFunc Class Reference

GSLSimAnFunc class description.

Interface class for the objetive function to be used in simulated annealing If user wants to re-implement some of the methods (like the one defining the metric) which are used by the the simulated annealing algorithm must build a user derived class. NOTE: Derived classes must re-implement the assignment and copy constructor to call them of the parent class

Definition at line 50 of file GSLSimAnnealing.h.

Public Member Functions

 GSLSimAnFunc (const ROOT::Math::IMultiGenFunction &func, const double *x)
 construct from an interface of a multi-dimensional function
 
 GSLSimAnFunc (const ROOT::Math::IMultiGenFunction &func, const double *x, const double *scale)
 construct from an interface of a multi-dimensional function Use optionally a scale factor (for each coordinate) which can be used to scale the step sizes (this is used for example by the minimization algorithm)
 
virtual ~GSLSimAnFunc ()
 virtual destructor (no operations)
 
virtual GSLSimAnFuncClone () const
 clone method.
 
virtual double Distance (const GSLSimAnFunc &func) const
 calculate the distance (metric) between this one and another configuration Presently a cartesian metric is used.
 
virtual double Energy () const
 evaluate the energy ( objective function value) re-implement by derived classes if needed to be modified
 
virtual GSLSimAnFuncFastCopy (const GSLSimAnFunc &f)
 fast copy method called by GSL simulated annealing internally copy only the things which have been changed must be re-implemented by derived classes if needed
 
unsigned int NDim () const
 
virtual void Print ()
 print the position in the standard output std::ostream GSL prints in addition n iteration, n function calls, temperature and energy re-implement by derived classes if necessary
 
double Scale (unsigned int i) const
 
void SetX (const double *x)
 change the x values (used by sim annealing to take a step)
 
template<class IT >
void SetX (IT begin, IT end)
 
void SetX (unsigned int i, double x)
 
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 maxstep re-implement by derived classes if needed to be modified
 
const std::vector< double > & X () const
 
double X (unsigned int i) const
 

Protected Member Functions

 GSLSimAnFunc ()
 derived classes might need to re-define completely the class
 

Private Attributes

const ROOT::Math::IMultiGenFunctionfFunc
 
std::vector< doublefScale
 
std::vector< doublefX
 

#include <Math/GSLSimAnnealing.h>

Constructor & Destructor Documentation

◆ GSLSimAnFunc() [1/3]

ROOT::Math::GSLSimAnFunc::GSLSimAnFunc ( const ROOT::Math::IMultiGenFunction func,
const double x 
)

construct from an interface of a multi-dimensional function

Definition at line 34 of file GSLSimAnnealing.cxx.

◆ GSLSimAnFunc() [2/3]

ROOT::Math::GSLSimAnFunc::GSLSimAnFunc ( const ROOT::Math::IMultiGenFunction func,
const double x,
const double scale 
)

construct from an interface of a multi-dimensional function Use optionally a scale factor (for each coordinate) which can be used to scale the step sizes (this is used for example by the minimization algorithm)

Definition at line 43 of file GSLSimAnnealing.cxx.

◆ GSLSimAnFunc() [3/3]

ROOT::Math::GSLSimAnFunc::GSLSimAnFunc ( )
inlineprotected

derived classes might need to re-define completely the class

Definition at line 70 of file GSLSimAnnealing.h.

◆ ~GSLSimAnFunc()

virtual ROOT::Math::GSLSimAnFunc::~GSLSimAnFunc ( )
inlinevirtual

virtual destructor (no operations)

Definition at line 78 of file GSLSimAnnealing.h.

Member Function Documentation

◆ Clone()

virtual GSLSimAnFunc * ROOT::Math::GSLSimAnFunc::Clone ( ) const
inlinevirtual

clone method.

Needs to be re-implemented by the derived classes for deep copying

Definition at line 92 of file GSLSimAnnealing.h.

◆ Distance()

double ROOT::Math::GSLSimAnFunc::Distance ( const GSLSimAnFunc func) const
virtual

calculate the distance (metric) between this one and another configuration Presently a cartesian metric is used.

re-implement by derived classes if needed to be modified

Definition at line 66 of file GSLSimAnnealing.cxx.

◆ Energy()

double ROOT::Math::GSLSimAnFunc::Energy ( ) const
virtual

evaluate the energy ( objective function value) re-implement by derived classes if needed to be modified

Definition at line 50 of file GSLSimAnnealing.cxx.

◆ FastCopy()

GSLSimAnFunc & ROOT::Math::GSLSimAnFunc::FastCopy ( const GSLSimAnFunc f)
virtual

fast copy method called by GSL simulated annealing internally copy only the things which have been changed must be re-implemented by derived classes if needed

Definition at line 96 of file GSLSimAnnealing.cxx.

◆ NDim()

unsigned int ROOT::Math::GSLSimAnFunc::NDim ( ) const
inline

Definition at line 135 of file GSLSimAnnealing.h.

◆ Print()

void ROOT::Math::GSLSimAnFunc::Print ( )
virtual

print the position in the standard output std::ostream GSL prints in addition n iteration, n function calls, temperature and energy re-implement by derived classes if necessary

Definition at line 83 of file GSLSimAnnealing.cxx.

◆ Scale()

double ROOT::Math::GSLSimAnFunc::Scale ( unsigned int  i) const
inline

Definition at line 141 of file GSLSimAnnealing.h.

◆ SetX() [1/3]

void ROOT::Math::GSLSimAnFunc::SetX ( const double x)
inline

change the x values (used by sim annealing to take a step)

Definition at line 126 of file GSLSimAnnealing.h.

◆ SetX() [2/3]

template<class IT >
void ROOT::Math::GSLSimAnFunc::SetX ( IT  begin,
IT  end 
)
inline

Definition at line 131 of file GSLSimAnnealing.h.

◆ SetX() [3/3]

void ROOT::Math::GSLSimAnFunc::SetX ( unsigned int  i,
double  x 
)
inline

Definition at line 143 of file GSLSimAnnealing.h.

◆ Step()

void ROOT::Math::GSLSimAnFunc::Step ( const GSLRandomEngine r,
double  maxstep 
)
virtual

change the x[i] value using a random value urndm generated between [0,1] up to a maximum value maxstep re-implement by derived classes if needed to be modified

Definition at line 55 of file GSLSimAnnealing.cxx.

◆ X() [1/2]

const std::vector< double > & ROOT::Math::GSLSimAnFunc::X ( ) const
inline

Definition at line 139 of file GSLSimAnnealing.h.

◆ X() [2/2]

double ROOT::Math::GSLSimAnFunc::X ( unsigned int  i) const
inline

Definition at line 137 of file GSLSimAnnealing.h.

Member Data Documentation

◆ fFunc

const ROOT::Math::IMultiGenFunction* ROOT::Math::GSLSimAnFunc::fFunc
private

Definition at line 151 of file GSLSimAnnealing.h.

◆ fScale

std::vector<double> ROOT::Math::GSLSimAnFunc::fScale
private

Definition at line 150 of file GSLSimAnnealing.h.

◆ fX

std::vector<double> ROOT::Math::GSLSimAnFunc::fX
private

Definition at line 149 of file GSLSimAnnealing.h.

Libraries for ROOT::Math::GSLSimAnFunc:

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