62 std::cout <<
"Minimize using GSLSimAnMinimizer " << std::endl;
67 MATH_ERROR_MSG(
"GSLSimAnMinimizer::Minimize",
"Function has not been set");
73 if (debugLevel >= 1) {
74 std::cout <<
"Parameters for simulated annealing: " << std::endl;
79 std::cout <<
"no simulated annealing options available" << std::endl;
83 unsigned int npar =
NPar();
84 std::vector<double> xvar;
97 steps.resize( trFunc->
NDim() );
100 assert (xvar.size() == steps.size() );
104 for (
unsigned int i = 0; i < npar ; ++i) {
105 std::cout <<
"x = " << xvar[i] <<
" steps " << steps[i] <<
" x " <<
X()[i] << std::endl;
107 std::cout <<
"f(x) = " << (*
ObjFunction())(&xvar.front() ) << std::endl;
108 std::cout <<
"f(x) not transf = " << (*function)(
X() ) << std::endl;
109 if (trFunc) std::cout <<
"ftrans(x) = " << (*trFunc) (&xvar.front() ) << std::endl;
113 std::vector<double>
xmin(xvar.size() );
123 if (debugLevel >=1 ) {
125 std::cout <<
"GSLSimAnMinimizer: Minimum Found" << std::endl;
127 std::cout <<
"GSLSimAnMinimizer: Error in solving" << std::endl;
129 int pr = std::cout.precision(18);
130 std::cout <<
"FVAL = " <<
MinValue() << std::endl;
131 std::cout.precision(pr);
132 for (
unsigned int i = 0; i <
NDim(); ++i)
133 std::cout <<
VariableName(i) <<
"\t = " <<
X()[i] << std::endl;
137 return ( iret == 0) ? true :
false;
#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)
void SetParameters(const GSLSimAnParams ¶ms)
set new minimizer option parameters using directly the GSLSimAnParams structure
GSLSimAnMinimizer(int type=0)
Default constructor.
void DoSetSimAnParameters(const MinimizerOptions &opt)
set minimizer option parameters from stored ROOT::Math::MinimizerOptions (fOpt)
const GSLSimAnParams & MinimizerParameters() const
Get current minimizer option parameteres.
ROOT::Math::GSLSimAnnealing fSolver
unsigned int NCalls() const
number of calls
virtual bool Minimize()
method to perform the minimization
void DoSetMinimOptions(const GSLSimAnParams ¶ms)
Set the Minimizer options from the simulated annealing parameters.
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.
virtual void Print(std::ostream &=std::cout) const
print options
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
MinimizerOptions fOptions
int PrintLevel() const
minimizer configuration parameters
MultiNumGradFunction class to wrap a normal function in a gradient function using numerical gradient ...
unsigned int NCalls() const
void SetOwnership(bool on=true)
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
structure holding the simulated annealing parameters
double k
parameters for the Boltzman distribution