Logo ROOT   6.13/01
Reference Guide
Minimizer.h
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Author: L. Moneta Fri Sep 22 15:06:47 2006
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 
11 // Header file for class Minimizer
12 
13 #ifndef ROOT_Math_Minimizer
14 #define ROOT_Math_Minimizer
15 
16 #include "Math/IFunction.h"
17 
18 #include "Math/MinimizerOptions.h"
19 
20 #include "Math/Util.h"
21 
22 #include "Math/Error.h"
23 
24 
25 
26 #include <vector>
27 #include <string>
28 
29 #include <limits>
30 #include <cmath>
31 
32 
33 namespace ROOT {
34 
35  namespace Fit {
36  class ParameterSettings;
37  }
38 
39 
40  namespace Math {
41 
42 /**
43  @defgroup MultiMin Multi-dimensional Minimization
44  @ingroup NumAlgo
45 
46  Classes implementing algorithms for multi-dimensional minimization
47  */
48 
49 
50 
51 //_______________________________________________________________________________
52 /**
53  Abstract Minimizer class, defining the interface for the various minimizer
54  (like Minuit2, Minuit, GSL, etc..)
55  Plug-in's exist in ROOT to be able to instantiate the derived classes like
56  ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the
57  plug-in manager.
58 
59  Provides interface for setting the function to be minimized.
60  The function must implemente the multi-dimensional generic interface
61  ROOT::Math::IBaseFunctionMultiDim.
62  If the function provides gradient calculation
63  (implements the ROOT::Math::IGradientFunctionMultiDim interface) this will be
64  used by the Minimizer.
65 
66  It Defines also interface for setting the initial values for the function variables (which are the parameters in
67  of the model function in case of solving for fitting) and especifying their limits.
68 
69  It defines the interface to set and retrieve basic minimization parameters
70  (for specific Minimizer parameters one must use the derived classes).
71 
72  Then it defines the interface to retrieve the result of minimization ( minimum X values, function value,
73  gradient, error on the mimnimum, etc...)
74 
75  @ingroup MultiMin
76 */
77 
78 class Minimizer {
79 
80 public:
81 
82  /**
83  Default constructor
84  */
85  Minimizer () :
86  fValidError(false),
87  fStatus(-1)
88  {}
89 
90  /**
91  Destructor (no operations)
92  */
93  virtual ~Minimizer () {}
94 
95 
96 
97 
98 private:
99  // usually copying is non trivial, so we make this unaccessible
100 
101  /**
102  Copy constructor
103  */
104  Minimizer(const Minimizer &) {}
105 
106  /**
107  Assignment operator
108  */
109  Minimizer & operator = (const Minimizer & rhs) {
110  if (this == &rhs) return *this; // time saving self-test
111  return *this;
112  }
113 
114 public:
115 
116  /// reset for consecutive minimizations - implement if needed
117  virtual void Clear() {}
118 
119  /// set the function to minimize
120  virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func) = 0;
121 
122  /// set a function to minimize using gradient
123  virtual void SetFunction(const ROOT::Math::IMultiGradFunction & func)
124  {
125  SetFunction(static_cast<const ::ROOT::Math::IMultiGenFunction &> (func));
126  }
127 
128 
129  /// add variables . Return number of variables successfully added
130  template<class VariableIterator>
131  int SetVariables(const VariableIterator & begin, const VariableIterator & end) {
132  unsigned int ivar = 0;
133  for ( VariableIterator vitr = begin; vitr != end; ++vitr) {
134  bool iret = false;
135  if (vitr->IsFixed() )
136  iret = SetFixedVariable(ivar, vitr->Name(), vitr->Value() );
137  else if (vitr->IsDoubleBound() )
138  iret = SetLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->LowerLimit(), vitr->UpperLimit() );
139  else if (vitr->HasLowerLimit() )
140  iret = SetLowerLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->LowerLimit() );
141  else if (vitr->HasUpperLimit() )
142  iret = SetUpperLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->UpperLimit() );
143  else
144  iret = SetVariable( ivar, vitr->Name(), vitr->Value(), vitr->StepSize() );
145 
146  if (iret) ivar++;
147 
148  // an error message should be eventually be reported in the virtual single SetVariable methods
149  }
150  return ivar;
151  }
152  /// set a new free variable
153  virtual bool SetVariable(unsigned int ivar, const std::string & name, double val, double step) = 0;
154  /// set a new lower limit variable (override if minimizer supports them )
155  virtual bool SetLowerLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower ) {
156  return SetLimitedVariable(ivar, name, val, step, lower, std::numeric_limits<double>::infinity() );
157  }
158  /// set a new upper limit variable (override if minimizer supports them )
159  virtual bool SetUpperLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double upper ) {
160  return SetLimitedVariable(ivar, name, val, step, - std::numeric_limits<double>::infinity(), upper );
161  }
162  /// set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default set an unlimited variable
163  virtual bool SetLimitedVariable(unsigned int ivar , const std::string & name , double val , double step ,
164  double lower , double upper ) {
165  MATH_WARN_MSG("Minimizer::SetLimitedVariable","Setting of limited variable not implemented - set as unlimited");
166  MATH_UNUSED(lower); MATH_UNUSED(upper);
167  return SetVariable(ivar, name, val, step);
168  }
169  /// set a new fixed variable (override if minimizer supports them )
170  virtual bool SetFixedVariable(unsigned int ivar , const std::string & name , double val ) {
171  MATH_ERROR_MSG("Minimizer::SetFixedVariable","Setting of fixed variable not implemented");
172  MATH_UNUSED(ivar); MATH_UNUSED(name); MATH_UNUSED(val);
173  return false;
174  }
175  /// set the value of an already existing variable
176  virtual bool SetVariableValue(unsigned int ivar , double value) {
177  MATH_ERROR_MSG("Minimizer::SetVariableValue","Set of a variable value not implemented");
178  MATH_UNUSED(ivar); MATH_UNUSED(value);
179  return false;
180  }
181  /// set the values of all existing variables (array must be dimensioned to the size of the existing parameters)
182  virtual bool SetVariableValues(const double * x) {
183  bool ret = true;
184  unsigned int i = 0;
185  while ( i <= NDim() && ret) {
186  ret &= SetVariableValue(i,x[i] ); i++;
187  }
188  return ret;
189  }
190  /// set the step size of an already existing variable
191  virtual bool SetVariableStepSize(unsigned int ivar, double value ) {
192  MATH_ERROR_MSG("Minimizer::SetVariableStepSize","Setting an existing variable step size not implemented");
193  MATH_UNUSED(ivar); MATH_UNUSED(value);
194  return false;
195  }
196  /// set the lower-limit of an already existing variable
197  virtual bool SetVariableLowerLimit(unsigned int ivar, double lower) {
198  MATH_ERROR_MSG("Minimizer::SetVariableLowerLimit","Setting an existing variable limit not implemented");
199  MATH_UNUSED(ivar); MATH_UNUSED(lower);
200  return false;
201  }
202  /// set the upper-limit of an already existing variable
203  virtual bool SetVariableUpperLimit(unsigned int ivar, double upper) {
204  MATH_ERROR_MSG("Minimizer::SetVariableUpperLimit","Setting an existing variable limit not implemented");
205  MATH_UNUSED(ivar); MATH_UNUSED(upper);
206  return false;
207  }
208  /// set the limits of an already existing variable
209  virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper) {
210  return SetVariableLowerLimit(ivar,lower) && SetVariableUpperLimit(ivar,upper);
211  }
212  /// fix an existing variable
213  virtual bool FixVariable(unsigned int ivar) {
214  MATH_ERROR_MSG("Minimizer::FixVariable","Fixing an existing variable not implemented");
215  MATH_UNUSED(ivar);
216  return false;
217  }
218  /// release an existing variable
219  virtual bool ReleaseVariable(unsigned int ivar) {
220  MATH_ERROR_MSG("Minimizer::ReleaseVariable","Releasing an existing variable not implemented");
221  MATH_UNUSED(ivar);
222  return false;
223  }
224  /// query if an existing variable is fixed (i.e. considered constant in the minimization)
225  /// note that by default all variables are not fixed
226  virtual bool IsFixedVariable(unsigned int ivar) const {
227  MATH_ERROR_MSG("Minimizer::IsFixedVariable","Quering an existing variable not implemented");
228  MATH_UNUSED(ivar);
229  return false;
230  }
231  /// get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
232  virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings & pars) const {
233  MATH_ERROR_MSG("Minimizer::GetVariableSettings","Quering an existing variable not implemented");
234  MATH_UNUSED(ivar); MATH_UNUSED(pars);
235  return false;
236  }
237 
238 
239  /// set the initial range of an existing variable
240  virtual bool SetVariableInitialRange(unsigned int /* ivar */, double /* mininitial */, double /* maxinitial */) {
241  return false;
242  }
243 
244  /// method to perform the minimization
245  virtual bool Minimize() = 0;
246 
247  /// return minimum function value
248  virtual double MinValue() const = 0;
249 
250  /// return pointer to X values at the minimum
251  virtual const double * X() const = 0;
252 
253  /// return expected distance reached from the minimum (re-implement if minimizer provides it
254  virtual double Edm() const { return -1; }
255 
256  /// return pointer to gradient values at the minimum
257  virtual const double * MinGradient() const { return NULL; }
258 
259  /// number of function calls to reach the minimum
260  virtual unsigned int NCalls() const { return 0; }
261 
262  /// number of iterations to reach the minimum
263  virtual unsigned int NIterations() const { return NCalls(); }
264 
265  /// this is <= Function().NDim() which is the total
266  /// number of variables (free+ constrained ones)
267  virtual unsigned int NDim() const = 0;
268 
269  /// number of free variables (real dimension of the problem)
270  /// this is <= Function().NDim() which is the total
271  /// (re-implement if minimizer supports bounded parameters)
272  virtual unsigned int NFree() const { return NDim(); }
273 
274  /// minimizer provides error and error matrix
275  virtual bool ProvidesError() const { return false; }
276 
277  /// return errors at the minimum
278  virtual const double * Errors() const { return NULL; }
279 
280  /** return covariance matrices element for variables ivar,jvar
281  if the variable is fixed the return value is zero
282  The ordering of the variables is the same as in the parameter and errors vectors
283  */
284  virtual double CovMatrix(unsigned int ivar , unsigned int jvar ) const {
285  MATH_UNUSED(ivar); MATH_UNUSED(jvar);
286  return 0;
287  }
288 
289  /**
290  Fill the passed array with the covariance matrix elements
291  if the variable is fixed or const the value is zero.
292  The array will be filled as cov[i *ndim + j]
293  The ordering of the variables is the same as in errors and parameter value.
294  This is different from the direct interface of Minuit2 or TMinuit where the
295  values were obtained only to variable parameters
296  */
297  virtual bool GetCovMatrix(double * covMat) const {
298  MATH_UNUSED(covMat);
299  return false;
300  }
301 
302  /**
303  Fill the passed array with the Hessian matrix elements
304  The Hessian matrix is the matrix of the second derivatives
305  and is the inverse of the covariance matrix
306  If the variable is fixed or const the values for that variables are zero.
307  The array will be filled as h[i *ndim + j]
308  */
309  virtual bool GetHessianMatrix(double * hMat) const {
310  MATH_UNUSED(hMat);
311  return false;
312  }
313 
314 
315  ///return status of covariance matrix
316  /// using Minuit convention {0 not calculated 1 approximated 2 made pos def , 3 accurate}
317  /// Minimizer who implements covariance matrix calculation will re-implement the method
318  virtual int CovMatrixStatus() const {
319  return 0;
320  }
321 
322  /**
323  return correlation coefficient between variable i and j.
324  If the variable is fixed or const the return value is zero
325  */
326  virtual double Correlation(unsigned int i, unsigned int j ) const {
327  double tmp = CovMatrix(i,i) * CovMatrix(j,j);
328  return ( tmp < 0) ? 0 : CovMatrix(i,j) / std::sqrt( tmp );
329  }
330 
331  /**
332  return global correlation coefficient for variable i
333  This is a number between zero and one which gives
334  the correlation between the i-th parameter and that linear combination of all
335  other parameters which is most strongly correlated with i.
336  Minimizer must overload method if implemented
337  */
338  virtual double GlobalCC(unsigned int ivar) const {
339  MATH_UNUSED(ivar);
340  return -1;
341  }
342 
343  /**
344  minos error for variable i, return false if Minos failed or not supported
345  and the lower and upper errors are returned in errLow and errUp
346  An extra flag specifies if only the lower (option=-1) or the upper (option=+1) error calculation is run
347  (This feature is not yet implemented)
348  */
349  virtual bool GetMinosError(unsigned int ivar , double & errLow, double & errUp, int option = 0) {
350  MATH_ERROR_MSG("Minimizer::GetMinosError","Minos Error not implemented");
351  MATH_UNUSED(ivar); MATH_UNUSED(errLow); MATH_UNUSED(errUp); MATH_UNUSED(option);
352  return false;
353  }
354 
355  /**
356  perform a full calculation of the Hessian matrix for error calculation
357  */
358  virtual bool Hesse() {
359  MATH_ERROR_MSG("Minimizer::Hesse","Hesse not implemented");
360  return false;
361  }
362 
363  /**
364  scan function minimum for variable i. Variable and function must be set before using Scan
365  Return false if an error or if minimizer does not support this functionality
366  */
367  virtual bool Scan(unsigned int ivar , unsigned int & nstep , double * x , double * y ,
368  double xmin = 0, double xmax = 0) {
369  MATH_ERROR_MSG("Minimizer::Scan","Scan not implemented");
370  MATH_UNUSED(ivar); MATH_UNUSED(nstep); MATH_UNUSED(x); MATH_UNUSED(y);
371  MATH_UNUSED(xmin); MATH_UNUSED(xmax);
372  return false;
373  }
374 
375  /**
376  find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum
377  The contour will be find for value of the function = Min + ErrorUp();
378  */
379  virtual bool Contour(unsigned int ivar , unsigned int jvar, unsigned int & npoints,
380  double * xi , double * xj ) {
381  MATH_ERROR_MSG("Minimizer::Contour","Contour not implemented");
382  MATH_UNUSED(ivar); MATH_UNUSED(jvar); MATH_UNUSED(npoints);
383  MATH_UNUSED(xi); MATH_UNUSED(xj);
384  return false;
385  }
386 
387  /// return reference to the objective function
388  ///virtual const ROOT::Math::IGenFunction & Function() const = 0;
389 
390  /// print the result according to set level (implemented for TMinuit for mantaining Minuit-style printing)
391  virtual void PrintResults() {}
392 
393  /// get name of variables (override if minimizer support storing of variable names)
394  /// return an empty string if variable is not found
395  virtual std::string VariableName(unsigned int ivar) const {
396  MATH_UNUSED(ivar);
397  return std::string(); // return empty string
398  }
399 
400  /// get index of variable given a variable given a name
401  /// return -1 if variable is not found
402  virtual int VariableIndex(const std::string & name) const {
403  MATH_ERROR_MSG("Minimizer::VariableIndex","Getting variable index from name not implemented");
404  MATH_UNUSED(name);
405  return -1;
406  }
407 
408  /** minimizer configuration parameters **/
409 
410  /// set print level
411  int PrintLevel() const { return fOptions.PrintLevel(); }
412 
413  /// max number of function calls
414  unsigned int MaxFunctionCalls() const { return fOptions.MaxFunctionCalls(); }
415 
416  /// max iterations
417  unsigned int MaxIterations() const { return fOptions.MaxIterations(); }
418 
419  /// absolute tolerance
420  double Tolerance() const { return fOptions.Tolerance(); }
421 
422  /// precision of minimizer in the evaluation of the objective function
423  /// ( a value <=0 corresponds to the let the minimizer choose its default one)
424  double Precision() const { return fOptions.Precision(); }
425 
426  /// strategy
427  int Strategy() const { return fOptions.Strategy(); }
428 
429  /// status code of minimizer
430  int Status() const { return fStatus; }
431 
432  /// return the statistical scale used for calculate the error
433  /// is typically 1 for Chi2 and 0.5 for likelihood minimization
434  double ErrorDef() const { return fOptions.ErrorDef(); }
435 
436  ///return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)
437  bool IsValidError() const { return fValidError; }
438 
439  /// retrieve the minimizer options (implement derived class if needed)
440  virtual MinimizerOptions Options() const {
441  return fOptions;
442  }
443 
444  /// set print level
445  void SetPrintLevel(int level) { fOptions.SetPrintLevel(level); }
446 
447  ///set maximum of function calls
448  void SetMaxFunctionCalls(unsigned int maxfcn) { if (maxfcn > 0) fOptions.SetMaxFunctionCalls(maxfcn); }
449 
450  /// set maximum iterations (one iteration can have many function calls)
451  void SetMaxIterations(unsigned int maxiter) { if (maxiter > 0) fOptions.SetMaxIterations(maxiter); }
452 
453  /// set the tolerance
454  void SetTolerance(double tol) { fOptions.SetTolerance(tol); }
455 
456  /// set in the minimizer the objective function evaluation precision
457  /// ( a value <=0 means the minimizer will choose its optimal value automatically, i.e. default case)
458  void SetPrecision(double prec) { fOptions.SetPrecision(prec); }
459 
460  ///set the strategy
461  void SetStrategy(int strategyLevel) { fOptions.SetStrategy(strategyLevel); }
462 
463  /// set scale for calculating the errors
464  void SetErrorDef(double up) { fOptions.SetErrorDef(up); }
465 
466  /// flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit)
467  void SetValidError(bool on) { fValidError = on; }
468 
469  /// set all options in one go
470  void SetOptions(const MinimizerOptions & opt) {
471  fOptions = opt;
472  }
473 
474  /// reset the defaut options (defined in MinimizerOptions)
476  fOptions.ResetToDefaultOptions();
477  }
478 
479 protected:
480 
481 
482 //private:
483 
484 
485  // keep protected to be accessible by the derived classes
486 
487 
488  bool fValidError; // flag to control if errors have been validated (Hesse has been run in case of Minuit)
489  MinimizerOptions fOptions; // minimizer options
490  int fStatus; // status of minimizer
491 };
492 
493  } // end namespace Math
494 
495 } // end namespace ROOT
496 
497 
498 #endif /* ROOT_Math_Minimizer */
void SetDefaultOptions()
reset the defaut options (defined in MinimizerOptions)
Definition: Minimizer.h:475
double ErrorDef() const
return the statistical scale used for calculate the error is typically 1 for Chi2 and 0...
Definition: Minimizer.h:434
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
Definition: Minimizer.h:451
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:326
void SetErrorDef(double up)
set scale for calculating the errors
Definition: Minimizer.h:464
Namespace for new ROOT classes and functions.
Definition: TFoamSampler.h:19
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
virtual bool ReleaseVariable(unsigned int ivar)
release an existing variable
Definition: Minimizer.h:219
virtual void SetFunction(const ROOT::Math::IMultiGradFunction &func)
set a function to minimize using gradient
Definition: Minimizer.h:123
virtual int VariableIndex(const std::string &name) const
get index of variable given a variable given a name return -1 if variable is not found ...
Definition: Minimizer.h:402
int SetVariables(const VariableIterator &begin, const VariableIterator &end)
add variables . Return number of variables successfully added
Definition: Minimizer.h:131
void SetOptions(const MinimizerOptions &opt)
set all options in one go
Definition: Minimizer.h:470
virtual bool ProvidesError() const
minimizer provides error and error matrix
Definition: Minimizer.h:275
virtual void PrintResults()
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const ...
Definition: Minimizer.h:391
void SetValidError(bool on)
flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit) ...
Definition: Minimizer.h:467
virtual bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower)
set a new lower limit variable (override if minimizer supports them )
Definition: Minimizer.h:155
Minimizer()
Default constructor.
Definition: Minimizer.h:85
virtual MinimizerOptions Options() const
retrieve the minimizer options (implement derived class if needed)
Definition: Minimizer.h:440
#define MATH_WARN_MSG(loc, str)
Definition: Error.h:47
you should not use this method at all Int_t y
Definition: TRolke.cxx:630
int Status() const
status code of minimizer
Definition: Minimizer.h:430
int PrintLevel() const
minimizer configuration parameters
Definition: Minimizer.h:411
virtual bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower, double upper)
set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default se...
Definition: Minimizer.h:163
virtual void Clear()
reset for consecutive minimizations - implement if needed
Definition: Minimizer.h:117
virtual bool GetHessianMatrix(double *hMat) const
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
Definition: Minimizer.h:309
virtual const double * Errors() const
return errors at the minimum
Definition: Minimizer.h:278
double sqrt(double)
virtual int CovMatrixStatus() const
return status of covariance matrix using Minuit convention {0 not calculated 1 approximated 2 made po...
Definition: Minimizer.h:318
virtual bool IsFixedVariable(unsigned int ivar) const
query if an existing variable is fixed (i.e.
Definition: Minimizer.h:226
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in&#39;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.
Definition: Minimizer.h:78
virtual bool SetVariableValues(const double *x)
set the values of all existing variables (array must be dimensioned to the size of the existing param...
Definition: Minimizer.h:182
bool IsValidError() const
return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit) ...
Definition: Minimizer.h:437
virtual std::string VariableName(unsigned int ivar) const
get name of variables (override if minimizer support storing of variable names) return an empty strin...
Definition: Minimizer.h:395
virtual bool Contour(unsigned int ivar, unsigned int jvar, unsigned int &npoints, double *xi, double *xj)
find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum The c...
Definition: Minimizer.h:379
virtual bool SetVariableInitialRange(unsigned int, double, double)
set the initial range of an existing variable
Definition: Minimizer.h:240
unsigned int MaxIterations() const
max iterations
Definition: Minimizer.h:417
virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings &pars) const
get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
Definition: Minimizer.h:232
#define MATH_ERROR_MSG(loc, str)
Definition: Error.h:50
virtual unsigned int NIterations() const
number of iterations to reach the minimum
Definition: Minimizer.h:263
virtual bool SetVariableValue(unsigned int ivar, double value)
set the value of an already existing variable
Definition: Minimizer.h:176
double Tolerance() const
absolute tolerance
Definition: Minimizer.h:420
virtual double GlobalCC(unsigned int ivar) const
return global correlation coefficient for variable i This is a number between zero and one which give...
Definition: Minimizer.h:338
virtual unsigned int NCalls() const
number of function calls to reach the minimum
Definition: Minimizer.h:260
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
int Strategy() const
strategy
Definition: Minimizer.h:427
Minimizer(const Minimizer &)
Copy constructor.
Definition: Minimizer.h:104
virtual bool SetFixedVariable(unsigned int ivar, const std::string &name, double val)
set a new fixed variable (override if minimizer supports them )
Definition: Minimizer.h:170
virtual bool SetVariableUpperLimit(unsigned int ivar, double upper)
set the upper-limit of an already existing variable
Definition: Minimizer.h:203
virtual double Edm() const
return expected distance reached from the minimum (re-implement if minimizer provides it ...
Definition: Minimizer.h:254
double Precision() const
precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the l...
Definition: Minimizer.h:424
virtual ~Minimizer()
Destructor (no operations)
Definition: Minimizer.h:93
* x
Deprecated and error prone model selection interface.
Definition: TRolke.cxx:630
virtual bool FixVariable(unsigned int ivar)
fix an existing variable
Definition: Minimizer.h:213
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
Definition: Minimizer.h:448
virtual double Correlation(unsigned int i, unsigned int j) const
return correlation coefficient between variable i and j.
Definition: Minimizer.h:326
virtual bool SetUpperLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double upper)
set a new upper limit variable (override if minimizer supports them )
Definition: Minimizer.h:159
void SetTolerance(double tol)
set the tolerance
Definition: Minimizer.h:454
virtual unsigned int NFree() const
number of free variables (real dimension of the problem) this is <= Function().NDim() which is the to...
Definition: Minimizer.h:272
virtual bool GetMinosError(unsigned int ivar, double &errLow, double &errUp, int option=0)
minos error for variable i, return false if Minos failed or not supported and the lower and upper err...
Definition: Minimizer.h:349
virtual double CovMatrix(unsigned int ivar, unsigned int jvar) const
return covariance matrices element for variables ivar,jvar if the variable is fixed the return value ...
Definition: Minimizer.h:284
MinimizerOptions fOptions
Definition: Minimizer.h:489
void SetStrategy(int strategyLevel)
set the strategy
Definition: Minimizer.h:461
Namespace for new Math classes and functions.
unsigned int MaxFunctionCalls() const
max number of function calls
Definition: Minimizer.h:414
virtual bool SetVariableLowerLimit(unsigned int ivar, double lower)
set the lower-limit of an already existing variable
Definition: Minimizer.h:197
virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper)
set the limits of an already existing variable
Definition: Minimizer.h:209
#define MATH_UNUSED(var)
Definition: Util.h:26
virtual bool Scan(unsigned int ivar, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0)
scan function minimum for variable i.
Definition: Minimizer.h:367
void SetPrecision(double prec)
set in the minimizer the objective function evaluation precision ( a value <=0 means the minimizer wi...
Definition: Minimizer.h:458
void SetPrintLevel(int level)
set print level
Definition: Minimizer.h:445
virtual const double * MinGradient() const
return pointer to gradient values at the minimum
Definition: Minimizer.h:257
virtual bool SetVariableStepSize(unsigned int ivar, double value)
set the step size of an already existing variable
Definition: Minimizer.h:191
virtual bool Hesse()
perform a full calculation of the Hessian matrix for error calculation
Definition: Minimizer.h:358
virtual bool GetCovMatrix(double *covMat) const
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
Definition: Minimizer.h:297