50 if (debugLevel >=1 ) std::cout <<
"Minimize using GSLSimAnMinimizer " << std::endl;
54 MATH_ERROR_MSG(
"GSLSimAnMinimizer::Minimize",
"Function has not been set");
59 unsigned int npar =
NPar();
60 std::vector<double> xvar;
73 steps.resize( trFunc->
NDim() );
76 assert (xvar.size() == steps.size() );
80 for (
unsigned int i = 0; i < npar ; ++i) {
81 std::cout <<
"x = " << xvar[i] <<
" steps " << steps[i] <<
" x " <<
X()[i] << std::endl;
83 std::cout <<
"f(x) = " << (*
ObjFunction())(&xvar.front() ) << std::endl;
84 std::cout <<
"f(x) not transf = " << (*function)(
X() ) << std::endl;
85 if (trFunc) std::cout <<
"ftrans(x) = " << (*trFunc) (&xvar.front() ) << std::endl;
89 std::vector<double>
xmin(xvar.size() );
99 if (debugLevel >=1 ) {
101 std::cout <<
"GSLSimAnMinimizer: Minimum Found" << std::endl;
103 std::cout <<
"GSLSimAnMinimizer: Error in solving" << std::endl;
105 int pr = std::cout.precision(18);
106 std::cout <<
"FVAL = " <<
MinValue() << std::endl;
107 std::cout.precision(pr);
108 for (
unsigned int i = 0; i <
NDim(); ++i)
109 std::cout <<
VariableName(i) <<
"\t = " <<
X()[i] << std::endl;
113 return ( iret == 0) ? true :
false;
124 if (
f)
return f->NCalls();
161 MATH_WARN_MSG(
"GSLSimAnMinimizer::SetOptions",
"No specific sim. annealing minimizer options are provided. No options are set");
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_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)
void SetParameters(const GSLSimAnParams ¶ms)
set new minimizer option parameters using directly the GSLSimAnParams structure
GSLSimAnMinimizer(int type=0)
Default constructor.
const GSLSimAnParams & MinimizerParameters() const
Get current minimizer option parameteres.
virtual void SetOptions(const ROOT::Math::MinimizerOptions &opt)
set new minimizer options
ROOT::Math::GSLSimAnnealing fSolver
unsigned int NCalls() const
number of calls
virtual bool Minimize()
method to perform the minimization
virtual ROOT::Math::MinimizerOptions Options() const
Get current minimizer options.
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 ...
class implementing generic options for a numerical algorithm Just store the options in a map of strin...
Documentation for the abstract class IBaseFunctionMultiDim.
Generic interface for defining configuration options of a numerical algorithm.
void SetValue(const char *name, double val)
generic methods for retrivieng options
bool GetValue(const char *name, T &t) const
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetStrategy(int stra)
set the strategy
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
const IOptions * ExtraOptions() const
return extra options (NULL pointer if they are not present)
void SetMinimizerType(const char *type)
set minimizer type
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
void SetPrecision(double prec)
set the precision
void SetErrorDef(double err)
set error def
void SetPrintLevel(int level)
set print level
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm
void SetTolerance(double tol)
set the tolerance
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)
structure holding the simulated annealing parameters
double k
parameters for the Boltzman distribution