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();
virtual const double * X() const
return pointer to X values at the minimum
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
Namespace for new ROOT classes and functions.
void SetOwnership(bool on=true)
Base Minimizer class, which defines the basic funcionality of various minimizer implementations (apar...
MinimTransformFunction * CreateTransformation(std::vector< double > &startValues, const ROOT::Math::IMultiGradFunction *func=0)
unsigned int NCalls() const
virtual double MinValue() const
return minimum function value
virtual bool Minimize()
method to perform the minimization
virtual std::string VariableName(unsigned int ivar) const
get name of variables (override if minimizer support storing of variable names)
int PrintLevel() const
minimizer configuration parameters
virtual const double * StepSizes() const
accessor methods
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 ...
void SetMinValue(double val)
virtual unsigned int NPar() const
total number of parameter defined
virtual unsigned int NDim() const
number of dimensions
const ROOT::Math::IMultiGenFunction * ObjFunction() const
return pointer to used objective function
#define MATH_ERROR_MSG(loc, str)
Documentation for the abstract class IBaseFunctionMultiDim.
void SetFinalValues(const double *x)
MultiNumGradFunction class to wrap a normal function in a gradient function using numerical gradient ...
GSLSimAnMinimizer(int type=0)
Default constructor.
virtual ~GSLSimAnMinimizer()
Destructor (no operations)
Namespace for new Math classes and functions.
ROOT::Math::GSLSimAnnealing fSolver
unsigned int NCalls() const
number of function calls to reach the minimum
void SetPrintLevel(int level)
set print level