49 if (debugLevel >=1 ) std::cout <<
"Minimize using GSLSimAnMinimizer " << std::endl;
53 MATH_ERROR_MSG(
"GSLSimAnMinimizer::Minimize",
"Function has not been set");
58 unsigned int npar =
NPar();
59 std::vector<double> xvar;
72 steps.resize( trFunc->
NDim() );
75 assert (xvar.size() == steps.size() );
79 for (
unsigned int i = 0; i < npar ; ++i) {
80 std::cout <<
"x = " << xvar[i] <<
" steps " << steps[i] <<
" x " <<
X()[i] << std::endl;
82 std::cout <<
"f(x) = " << (*
ObjFunction())(&xvar.front() ) << std::endl;
83 std::cout <<
"f(x) not transf = " << (*function)(
X() ) << std::endl;
84 if (trFunc) std::cout <<
"ftrans(x) = " << (*trFunc) (&xvar.front() ) << std::endl;
88 std::vector<double>
xmin(xvar.size() );
98 if (debugLevel >=1 ) {
100 std::cout <<
"GSLSimAnMinimizer: Minimum Found" << std::endl;
102 std::cout <<
"GSLSimAnMinimizer: Error in solving" << std::endl;
104 int pr = std::cout.precision(18);
105 std::cout <<
"FVAL = " <<
MinValue() << std::endl;
106 std::cout.precision(pr);
107 for (
unsigned int i = 0; i <
NDim(); ++i)
108 std::cout <<
VariableName(i) <<
"\t = " <<
X()[i] << std::endl;
112 return ( iret == 0) ? true :
false;
123 if (
f)
return f->NCalls();
#define MATH_ERROR_MSG(loc, str)
Base Minimizer class, which defines the basic funcionality of various minimizer implementations (apar...
virtual double MinValue() const
return minimum function value
virtual unsigned int NPar() const
total number of parameter defined
void SetMinValue(double val)
virtual const double * StepSizes() const
accessor methods
const ROOT::Math::IMultiGenFunction * ObjFunction() const
return pointer to used objective function
virtual unsigned int NDim() const
number of dimensions
virtual std::string VariableName(unsigned int ivar) const
get name of variables (override if minimizer support storing of variable names)
virtual const double * X() const
return pointer to X values at the minimum
void SetFinalValues(const double *x)
MinimTransformFunction * CreateTransformation(std::vector< double > &startValues, const ROOT::Math::IMultiGradFunction *func=0)
virtual ~GSLSimAnMinimizer()
Destructor (no operations)
GSLSimAnMinimizer(int type=0)
Default constructor.
ROOT::Math::GSLSimAnnealing fSolver
unsigned int NCalls() const
number of function calls to reach the minimum
virtual bool Minimize()
method to perform the minimization
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 ...
Documentation for the abstract class IBaseFunctionMultiDim.
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
void SetPrintLevel(int level)
set print level
int PrintLevel() const
minimizer configuration parameters
MultiNumGradFunction class to wrap a normal function in a gradient function using numerical gradient ...
void SetOwnership(bool on=true)
Namespace for new Math classes and functions.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Namespace for new ROOT classes and functions.