24 return 100*tmp1*tmp1+tmp2*tmp2;
28 const char *algoName =
"" ,
55 double step[2] = {0.01,0.01};
58 double variable[2] = { -1.,1.2};
61 variable[0] = r.
Uniform(-20,20);
62 variable[1] = r.
Uniform(-20,20);
74 const double *xs = min->
X();
75 std::cout <<
"Minimum: f(" << xs[0] <<
"," << xs[1] <<
"): "
79 if ( min->
MinValue() < 1.E-4 &&
f(xs) < 1.E-4)
80 std::cout <<
"Minimizer " << minName <<
" - " << algoName
81 <<
" converged to the right minimum" << std::endl;
83 std::cout <<
"Minimizer " << minName <<
" - " << algoName
84 <<
" failed to converge !!!" << std::endl;
85 Error(
"NumericalMinimization",
"fail to converge");
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
int NumericalMinimization(const char *minName="Minuit2", const char *algoName="", int randomSeed=-1)
Documentation for class Functor class.
Random number generator class based on the maximally quidistributed combined Tausworthe generator by ...
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corrisponding Minimizer given the string Supported Minimizers types are: ...
double RosenBrock(const double *xx)
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in's exist in ROOT to be able to instantiate the derived classes like ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the plug-in manager.
virtual double MinValue() const =0
return minimum function value
virtual bool Minimize()=0
method to perform the minimization
virtual const double * X() const =0
return pointer to X values at the minimum
void Error(const char *location, const char *msgfmt,...)
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)=0
set the function to minimize
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetTolerance(double tol)
set the tolerance
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)=0
set a new free variable
void SetPrintLevel(int level)
set print level