BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::GeneticMinimizer Class Reference

Description

GeneticMinimizer

Minimizer class based on the Gentic algorithm implemented in TMVA

Definition at line 60 of file GeneticMinimizer.h.

Inheritance diagram for ROOT::Math::GeneticMinimizer:
[legend]
Collaboration diagram for ROOT::Math::GeneticMinimizer:
[legend]

Public Member Functions

 GeneticMinimizer (int i=0)
 
virtual ~GeneticMinimizer ()
 
virtual void Clear ()
 reset for consecutive minimizations - implement if needed More...
 
virtual bool Contour (unsigned int ivar, unsigned int jvar, unsigned int &npoints, double *xi, double *xj)
 
virtual double Correlation (unsigned int i, unsigned int j) const
 
virtual double CovMatrix (unsigned int i, unsigned int j) const
 
virtual int CovMatrixStatus () const
 return status of covariance matrix using Minuit convention {0 not calculated 1 approximated 2 made pos def , 3 accurate} Minimizer who implements covariance matrix calculation will re-implement the method More...
 
virtual double Edm () const
 return expected distance reached from the minimum (re-implement if minimizer provides it More...
 
double ErrorDef () const
 return the statistical scale used for calculate the error is typically 1 for Chi2 and 0.5 for likelihood minimization More...
 
virtual const double * Errors () const
 return errors at the minimum More...
 
virtual bool FixVariable (unsigned int ivar)
 fix an existing variable More...
 
virtual bool GetCovMatrix (double *covMat) const
 
virtual bool GetHessianMatrix (double *hMat) const
 
virtual bool GetMinosError (unsigned int ivar, double &errLow, double &errUp, int option=0)
 
virtual bool GetVariableSettings (unsigned int ivar, ROOT::Fit::ParameterSettings &pars) const
 get variable settings in a variable object (like ROOT::Fit::ParamsSettings) More...
 
virtual double GlobalCC (unsigned int ivar) const
 
virtual bool Hesse ()
 
virtual bool IsFixedVariable (unsigned int ivar) const
 query if an existing variable is fixed (i.e. considered constant in the minimization) note that by default all variables are not fixed More...
 
bool IsValidError () const
 return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit) More...
 
unsigned int MaxFunctionCalls () const
 max number of function calls More...
 
unsigned int MaxIterations () const
 max iterations More...
 
virtual const double * MinGradient () const
 return pointer to gradient values at the minimum More...
 
virtual bool Minimize ()
 method to perform the minimization More...
 
const GeneticMinimizerParametersMinimizerParameters () const
 
virtual double MinValue () const
 return minimum function value More...
 
virtual unsigned int NCalls () const
 number of function calls to reach the minimum More...
 
virtual unsigned int NDim () const
 this is <= Function().NDim() which is the total number of variables (free+ constrained ones) More...
 
virtual unsigned int NFree () const
 number of free variables (real dimension of the problem) this is <= Function().NDim() which is the total (re-implement if minimizer supports bounded parameters) More...
 
virtual unsigned int NIterations () const
 number of iterations to reach the minimum More...
 
virtual ROOT::Math::MinimizerOptions Options () const
 retrieve the minimizer options (implement derived class if needed) More...
 
double Precision () const
 precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the let the minimizer choose its default one) More...
 
int PrintLevel () const
 set print level More...
 
virtual void PrintResults ()
 return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const = 0; More...
 
virtual bool ProvidesError () const
 minimizer provides error and error matrix More...
 
virtual bool ReleaseVariable (unsigned int ivar)
 release an existing variable More...
 
virtual bool Scan (unsigned int ivar, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0)
 
void SetDefaultOptions ()
 reset the defaut options (defined in MinimizerOptions) More...
 
void SetErrorDef (double up)
 set scale for calculating the errors More...
 
virtual bool SetFixedVariable (unsigned int ivar, const std::string &name, double val)
 set a new fixed variable (override if minimizer supports them ) More...
 
virtual void SetFunction (const ROOT::Math::IMultiGenFunction &func)
 set the function to minimize More...
 
virtual void SetFunction (const ROOT::Math::IMultiGradFunction &func)
 set a function to minimize using gradient More...
 
virtual bool SetLimitedVariable (unsigned int, const std::string &, double, double, double, double)
 set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default set an unlimited variable More...
 
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 ) More...
 
void SetMaxFunctionCalls (unsigned int maxfcn)
 set maximum of function calls More...
 
void SetMaxIterations (unsigned int maxiter)
 set maximum iterations (one iteration can have many function calls) More...
 
virtual void SetOptions (const ROOT::Math::MinimizerOptions &opt)
 
void SetParameters (const GeneticMinimizerParameters &params)
 
void SetPrecision (double prec)
 set in the minimizer the objective function evaluation precision ( a value <=0 means the minimizer will choose its optimal value automatically, i.e. default case) More...
 
void SetPrintLevel (int level)
 set print level More...
 
void SetRandomSeed (int seed)
 
void SetStrategy (int strategyLevel)
 set the strategy More...
 
void SetTolerance (double tol)
 set the tolerance More...
 
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 ) More...
 
void SetValidError (bool on)
 flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit) More...
 
virtual bool SetVariable (unsigned int ivar, const std::string &name, double val, double step)
 set a new free variable More...
 
virtual bool SetVariableInitialRange (unsigned int, double, double)
 set the initial range of an existing variable More...
 
virtual bool SetVariableLimits (unsigned int ivar, double lower, double upper)
 set the limits of an already existing variable More...
 
virtual bool SetVariableLowerLimit (unsigned int ivar, double lower)
 set the lower-limit of an already existing variable More...
 
template<class VariableIterator >
int SetVariables (const VariableIterator &begin, const VariableIterator &end)
 add variables . Return number of variables successfully added More...
 
virtual bool SetVariableStepSize (unsigned int ivar, double value)
 set the step size of an already existing variable More...
 
virtual bool SetVariableUpperLimit (unsigned int ivar, double upper)
 set the upper-limit of an already existing variable More...
 
virtual bool SetVariableValue (unsigned int ivar, double value)
 set the value of an already existing variable More...
 
virtual bool SetVariableValues (const double *x)
 set the values of all existing variables (array must be dimensioned to the size of the existing parameters) More...
 
int Status () const
 status code of minimizer More...
 
int Strategy () const
 strategy More...
 
double Tolerance () const
 absolute tolerance More...
 
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 More...
 
virtual std::string VariableName (unsigned int ivar) const
 get name of variables (override if minimizer support storing of variable names) return an empty string if variable is not found More...
 
virtual const double * X () const
 return pointer to X values at the minimum More...
 

Protected Member Functions

void GetGeneticOptions (ROOT::Math::MinimizerOptions &opt) const
 

Protected Attributes

TMVA::IFitterTargetfFitness
 
double fMinValue
 
MinimizerOptions fOptions
 
GeneticMinimizerParameters fParameters
 
std::vector< TMVA::Interval * > fRanges
 
std::vector< double > fResult
 
int fStatus
 
bool fValidError
 

Constructor & Destructor Documentation

◆ GeneticMinimizer()

ROOT::Math::GeneticMinimizer::GeneticMinimizer ( int  i = 0)

◆ ~GeneticMinimizer()

virtual ROOT::Math::GeneticMinimizer::~GeneticMinimizer ( )
virtual

Member Function Documentation

◆ Clear()

virtual void ROOT::Math::GeneticMinimizer::Clear ( )
virtual

reset for consecutive minimizations - implement if needed

Reimplemented from ROOT::Math::Minimizer.

◆ Contour()

virtual bool ROOT::Math::Minimizer::Contour ( unsigned int  ivar,
unsigned int  jvar,
unsigned int &  npoints,
double *  xi,
double *  xj 
)
inlinevirtualinherited

find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum The contour will be find for value of the function = Min + ErrorUp();

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 379 of file Minimizer.h.

380  {
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  }
#define MATH_ERROR_MSG(loc, str)
Definition: Error.h:50
#define MATH_UNUSED(var)
Definition: Util.h:26

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ Correlation()

virtual double ROOT::Math::Minimizer::Correlation ( unsigned int  i,
unsigned int  j 
) const
inlinevirtualinherited

return correlation coefficient between variable i and j. If the variable is fixed or const the return value is zero

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 326 of file Minimizer.h.

326  {
327  double tmp = CovMatrix(i,i) * CovMatrix(j,j);
328  return ( tmp < 0) ? 0 : CovMatrix(i,j) / std::sqrt( tmp );
329  }
virtual double CovMatrix(unsigned int ivar, unsigned int jvar) const
Definition: Minimizer.h:284

References ROOT::Math::Minimizer::CovMatrix().

Referenced by MinimizerAdapter::propagateResults().

Here is the call graph for this function:

◆ CovMatrix()

virtual double ROOT::Math::GeneticMinimizer::CovMatrix ( unsigned int  ivar,
unsigned int  jvar 
) const
virtual

return covariance matrices element for variables ivar,jvar if the variable is fixed the return value is zero The ordering of the variables is the same as in the parameter and errors vectors

Reimplemented from ROOT::Math::Minimizer.

◆ CovMatrixStatus()

virtual int ROOT::Math::Minimizer::CovMatrixStatus ( ) const
inlinevirtualinherited

return status of covariance matrix using Minuit convention {0 not calculated 1 approximated 2 made pos def , 3 accurate} Minimizer who implements covariance matrix calculation will re-implement the method

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::GSLNLSMinimizer.

Definition at line 318 of file Minimizer.h.

318  {
319  return 0;
320  }

Referenced by GSLLevenbergMarquardtMinimizer::statusMap(), and Minuit2Minimizer::statusMap().

◆ Edm()

virtual double ROOT::Math::GeneticMinimizer::Edm ( ) const
virtual

return expected distance reached from the minimum (re-implement if minimizer provides it

Reimplemented from ROOT::Math::Minimizer.

◆ ErrorDef()

double ROOT::Math::Minimizer::ErrorDef ( ) const
inlineinherited

return the statistical scale used for calculate the error is typically 1 for Chi2 and 0.5 for likelihood minimization

Definition at line 434 of file Minimizer.h.

434 { return fOptions.ErrorDef(); }
double ErrorDef() const
error definition
MinimizerOptions fOptions
Definition: Minimizer.h:489

References ROOT::Math::MinimizerOptions::ErrorDef(), and ROOT::Math::Minimizer::fOptions.

Here is the call graph for this function:

◆ Errors()

virtual const double* ROOT::Math::GeneticMinimizer::Errors ( ) const
virtual

return errors at the minimum

Reimplemented from ROOT::Math::Minimizer.

◆ FixVariable()

virtual bool ROOT::Math::Minimizer::FixVariable ( unsigned int  ivar)
inlinevirtualinherited

fix an existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 213 of file Minimizer.h.

213  {
214  MATH_ERROR_MSG("Minimizer::FixVariable","Fixing an existing variable not implemented");
215  MATH_UNUSED(ivar);
216  return false;
217  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ GetCovMatrix()

virtual bool ROOT::Math::Minimizer::GetCovMatrix ( double *  covMat) const
inlinevirtualinherited

Fill the passed array with the covariance matrix elements if the variable is fixed or const the value is zero. The array will be filled as cov[i *ndim + j] The ordering of the variables is the same as in errors and parameter value. This is different from the direct interface of Minuit2 or TMinuit where the values were obtained only to variable parameters

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 297 of file Minimizer.h.

297  {
298  MATH_UNUSED(covMat);
299  return false;
300  }

References MATH_UNUSED.

◆ GetGeneticOptions()

void ROOT::Math::GeneticMinimizer::GetGeneticOptions ( ROOT::Math::MinimizerOptions opt) const
protected

◆ GetHessianMatrix()

virtual bool ROOT::Math::Minimizer::GetHessianMatrix ( double *  hMat) const
inlinevirtualinherited

Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second derivatives and is the inverse of the covariance matrix If the variable is fixed or const the values for that variables are zero. The array will be filled as h[i *ndim + j]

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 309 of file Minimizer.h.

309  {
310  MATH_UNUSED(hMat);
311  return false;
312  }

References MATH_UNUSED.

◆ GetMinosError()

virtual bool ROOT::Math::Minimizer::GetMinosError ( unsigned int  ivar,
double &  errLow,
double &  errUp,
int  option = 0 
)
inlinevirtualinherited

minos error for variable i, return false if Minos failed or not supported and the lower and upper errors are returned in errLow and errUp An extra flag specifies if only the lower (option=-1) or the upper (option=+1) error calculation is run (This feature is not yet implemented)

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 349 of file Minimizer.h.

349  {
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  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ GetVariableSettings()

virtual bool ROOT::Math::Minimizer::GetVariableSettings ( unsigned int  ivar,
ROOT::Fit::ParameterSettings pars 
) const
inlinevirtualinherited

get variable settings in a variable object (like ROOT::Fit::ParamsSettings)

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 232 of file Minimizer.h.

232  {
233  MATH_ERROR_MSG("Minimizer::GetVariableSettings","Quering an existing variable not implemented");
234  MATH_UNUSED(ivar); MATH_UNUSED(pars);
235  return false;
236  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ GlobalCC()

virtual double ROOT::Math::Minimizer::GlobalCC ( unsigned int  ivar) const
inlinevirtualinherited

return global correlation coefficient for variable i This is a number between zero and one which gives the correlation between the i-th parameter and that linear combination of all other parameters which is most strongly correlated with i. Minimizer must overload method if implemented

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 338 of file Minimizer.h.

338  {
339  MATH_UNUSED(ivar);
340  return -1;
341  }

References MATH_UNUSED.

◆ Hesse()

virtual bool ROOT::Math::Minimizer::Hesse ( )
inlinevirtualinherited

perform a full calculation of the Hessian matrix for error calculation

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 358 of file Minimizer.h.

358  {
359  MATH_ERROR_MSG("Minimizer::Hesse","Hesse not implemented");
360  return false;
361  }

References MATH_ERROR_MSG.

◆ IsFixedVariable()

virtual bool ROOT::Math::Minimizer::IsFixedVariable ( unsigned int  ivar) const
inlinevirtualinherited

query if an existing variable is fixed (i.e. considered constant in the minimization) note that by default all variables are not fixed

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 226 of file Minimizer.h.

226  {
227  MATH_ERROR_MSG("Minimizer::IsFixedVariable","Quering an existing variable not implemented");
228  MATH_UNUSED(ivar);
229  return false;
230  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ IsValidError()

bool ROOT::Math::Minimizer::IsValidError ( ) const
inlineinherited

return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)

Definition at line 437 of file Minimizer.h.

437 { return fValidError; }

References ROOT::Math::Minimizer::fValidError.

◆ MaxFunctionCalls()

unsigned int ROOT::Math::Minimizer::MaxFunctionCalls ( ) const
inlineinherited

max number of function calls

Definition at line 414 of file Minimizer.h.

414 { return fOptions.MaxFunctionCalls(); }
unsigned int MaxFunctionCalls() const
max number of function calls

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::MaxFunctionCalls().

Here is the call graph for this function:

◆ MaxIterations()

unsigned int ROOT::Math::Minimizer::MaxIterations ( ) const
inlineinherited

max iterations

Definition at line 417 of file Minimizer.h.

417 { return fOptions.MaxIterations(); }
unsigned int MaxIterations() const
max iterations

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::MaxIterations().

Here is the call graph for this function:

◆ MinGradient()

virtual const double* ROOT::Math::GeneticMinimizer::MinGradient ( ) const
virtual

return pointer to gradient values at the minimum

Reimplemented from ROOT::Math::Minimizer.

◆ Minimize()

virtual bool ROOT::Math::GeneticMinimizer::Minimize ( )
virtual

method to perform the minimization

Implements ROOT::Math::Minimizer.

◆ MinimizerParameters()

const GeneticMinimizerParameters& ROOT::Math::GeneticMinimizer::MinimizerParameters ( ) const
inline

Definition at line 95 of file GeneticMinimizer.h.

95 { return fParameters; }
GeneticMinimizerParameters fParameters

References fParameters.

◆ MinValue()

virtual double ROOT::Math::GeneticMinimizer::MinValue ( ) const
virtual

return minimum function value

Implements ROOT::Math::Minimizer.

◆ NCalls()

virtual unsigned int ROOT::Math::GeneticMinimizer::NCalls ( ) const
virtual

number of function calls to reach the minimum

Reimplemented from ROOT::Math::Minimizer.

◆ NDim()

virtual unsigned int ROOT::Math::GeneticMinimizer::NDim ( ) const
virtual

this is <= Function().NDim() which is the total number of variables (free+ constrained ones)

Implements ROOT::Math::Minimizer.

◆ NFree()

virtual unsigned int ROOT::Math::GeneticMinimizer::NFree ( ) const
virtual

number of free variables (real dimension of the problem) this is <= Function().NDim() which is the total (re-implement if minimizer supports bounded parameters)

Reimplemented from ROOT::Math::Minimizer.

◆ NIterations()

virtual unsigned int ROOT::Math::Minimizer::NIterations ( ) const
inlinevirtualinherited

number of iterations to reach the minimum

Definition at line 263 of file Minimizer.h.

263 { return NCalls(); }
virtual unsigned int NCalls() const
number of function calls to reach the minimum
Definition: Minimizer.h:260

References ROOT::Math::Minimizer::NCalls().

Here is the call graph for this function:

◆ Options()

virtual ROOT::Math::MinimizerOptions ROOT::Math::GeneticMinimizer::Options ( ) const
virtual

retrieve the minimizer options (implement derived class if needed)

Reimplemented from ROOT::Math::Minimizer.

◆ Precision()

double ROOT::Math::Minimizer::Precision ( ) const
inlineinherited

precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the let the minimizer choose its default one)

Definition at line 424 of file Minimizer.h.

424 { return fOptions.Precision(); }
double Precision() const
precision in the objective funciton calculation (value <=0 means left to default)

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::Precision().

Here is the call graph for this function:

◆ PrintLevel()

int ROOT::Math::Minimizer::PrintLevel ( ) const
inlineinherited

set print level

minimizer configuration parameters

Definition at line 411 of file Minimizer.h.

411 { return fOptions.PrintLevel(); }
int PrintLevel() const
set print level

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::PrintLevel().

Here is the call graph for this function:

◆ PrintResults()

virtual void ROOT::Math::Minimizer::PrintResults ( )
inlinevirtualinherited

return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const = 0;

print the result according to set level (implemented for TMinuit for mantaining Minuit-style printing)

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 391 of file Minimizer.h.

391 {}

◆ ProvidesError()

virtual bool ROOT::Math::GeneticMinimizer::ProvidesError ( ) const
virtual

minimizer provides error and error matrix

Reimplemented from ROOT::Math::Minimizer.

◆ ReleaseVariable()

virtual bool ROOT::Math::Minimizer::ReleaseVariable ( unsigned int  ivar)
inlinevirtualinherited

release an existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 219 of file Minimizer.h.

219  {
220  MATH_ERROR_MSG("Minimizer::ReleaseVariable","Releasing an existing variable not implemented");
221  MATH_UNUSED(ivar);
222  return false;
223  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ Scan()

virtual bool ROOT::Math::Minimizer::Scan ( unsigned int  ivar,
unsigned int &  nstep,
double *  x,
double *  y,
double  xmin = 0,
double  xmax = 0 
)
inlinevirtualinherited

scan function minimum for variable i. Variable and function must be set before using Scan Return false if an error or if minimizer does not support this functionality

Reimplemented in ROOT::Minuit2::Minuit2Minimizer.

Definition at line 367 of file Minimizer.h.

368  {
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  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ SetDefaultOptions()

void ROOT::Math::Minimizer::SetDefaultOptions ( )
inlineinherited

reset the defaut options (defined in MinimizerOptions)

Definition at line 475 of file Minimizer.h.

475  {
477  }

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::ResetToDefaultOptions().

Here is the call graph for this function:

◆ SetErrorDef()

void ROOT::Math::Minimizer::SetErrorDef ( double  up)
inlineinherited

set scale for calculating the errors

Definition at line 464 of file Minimizer.h.

464 { fOptions.SetErrorDef(up); }
void SetErrorDef(double err)
set error def

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetErrorDef().

Here is the call graph for this function:

◆ SetFixedVariable()

virtual bool ROOT::Math::GeneticMinimizer::SetFixedVariable ( unsigned int  ivar,
const std::string &  name,
double  val 
)
virtual

set a new fixed variable (override if minimizer supports them )

Reimplemented from ROOT::Math::Minimizer.

◆ SetFunction() [1/2]

virtual void ROOT::Math::GeneticMinimizer::SetFunction ( const ROOT::Math::IMultiGenFunction func)
virtual

set the function to minimize

Implements ROOT::Math::Minimizer.

◆ SetFunction() [2/2]

virtual void ROOT::Math::Minimizer::SetFunction ( const ROOT::Math::IMultiGradFunction func)
inlinevirtualinherited

set a function to minimize using gradient

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, ROOT::Math::GSLNLSMinimizer, ROOT::Math::GSLMinimizer, and ROOT::Math::BasicMinimizer.

Definition at line 123 of file Minimizer.h.

124  {
125  SetFunction(static_cast<const ::ROOT::Math::IMultiGenFunction &> (func));
126  }
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)=0
set the function to minimize

References ROOT::Math::Minimizer::SetFunction().

Here is the call graph for this function:

◆ SetLimitedVariable()

virtual bool ROOT::Math::GeneticMinimizer::SetLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  lower,
double  upper 
)
virtual

set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default set an unlimited variable

Reimplemented from ROOT::Math::Minimizer.

◆ SetLowerLimitedVariable()

virtual bool ROOT::Math::Minimizer::SetLowerLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  lower 
)
inlinevirtualinherited

set a new lower limit variable (override if minimizer supports them )

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 155 of file Minimizer.h.

155  {
156  return SetLimitedVariable(ivar, name, val, step, lower, std::numeric_limits<double>::infinity() );
157  }
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

References ROOT::Math::Minimizer::SetLimitedVariable().

Referenced by MinimizerAdapter::setParameter(), and ROOT::Math::Minimizer::SetVariables().

Here is the call graph for this function:

◆ SetMaxFunctionCalls()

void ROOT::Math::Minimizer::SetMaxFunctionCalls ( unsigned int  maxfcn)
inlineinherited

set maximum of function calls

Definition at line 448 of file Minimizer.h.

448 { if (maxfcn > 0) fOptions.SetMaxFunctionCalls(maxfcn); }
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetMaxFunctionCalls().

Here is the call graph for this function:

◆ SetMaxIterations()

void ROOT::Math::Minimizer::SetMaxIterations ( unsigned int  maxiter)
inlineinherited

set maximum iterations (one iteration can have many function calls)

Definition at line 451 of file Minimizer.h.

451 { if (maxiter > 0) fOptions.SetMaxIterations(maxiter); }
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetMaxIterations().

Here is the call graph for this function:

◆ SetOptions()

virtual void ROOT::Math::GeneticMinimizer::SetOptions ( const ROOT::Math::MinimizerOptions opt)
virtual

◆ SetParameters()

void ROOT::Math::GeneticMinimizer::SetParameters ( const GeneticMinimizerParameters params)

◆ SetPrecision()

void ROOT::Math::Minimizer::SetPrecision ( double  prec)
inlineinherited

set in the minimizer the objective function evaluation precision ( a value <=0 means the minimizer will choose its optimal value automatically, i.e. default case)

Definition at line 458 of file Minimizer.h.

458 { fOptions.SetPrecision(prec); }
void SetPrecision(double prec)
set the precision

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetPrecision().

Here is the call graph for this function:

◆ SetPrintLevel()

void ROOT::Math::Minimizer::SetPrintLevel ( int  level)
inlineinherited

set print level

Definition at line 445 of file Minimizer.h.

445 { fOptions.SetPrintLevel(level); }
void SetPrintLevel(int level)
set print level

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetPrintLevel().

Here is the call graph for this function:

◆ SetRandomSeed()

void ROOT::Math::GeneticMinimizer::SetRandomSeed ( int  seed)
inline

◆ SetStrategy()

void ROOT::Math::Minimizer::SetStrategy ( int  strategyLevel)
inlineinherited

set the strategy

Definition at line 461 of file Minimizer.h.

461 { fOptions.SetStrategy(strategyLevel); }
void SetStrategy(int stra)
set the strategy

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetStrategy().

Here is the call graph for this function:

◆ SetTolerance()

void ROOT::Math::Minimizer::SetTolerance ( double  tol)
inlineinherited

set the tolerance

Definition at line 454 of file Minimizer.h.

454 { fOptions.SetTolerance(tol); }
void SetTolerance(double tol)
set the tolerance

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::SetTolerance().

Here is the call graph for this function:

◆ SetUpperLimitedVariable()

virtual bool ROOT::Math::Minimizer::SetUpperLimitedVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step,
double  upper 
)
inlinevirtualinherited

set a new upper limit variable (override if minimizer supports them )

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 159 of file Minimizer.h.

159  {
160  return SetLimitedVariable(ivar, name, val, step, - std::numeric_limits<double>::infinity(), upper );
161  }

References ROOT::Math::Minimizer::SetLimitedVariable().

Referenced by MinimizerAdapter::setParameter(), and ROOT::Math::Minimizer::SetVariables().

Here is the call graph for this function:

◆ SetValidError()

void ROOT::Math::Minimizer::SetValidError ( bool  on)
inlineinherited

flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit)

Definition at line 467 of file Minimizer.h.

467 { fValidError = on; }

References ROOT::Math::Minimizer::fValidError.

◆ SetVariable()

virtual bool ROOT::Math::GeneticMinimizer::SetVariable ( unsigned int  ivar,
const std::string &  name,
double  val,
double  step 
)
virtual

set a new free variable

Implements ROOT::Math::Minimizer.

◆ SetVariableInitialRange()

virtual bool ROOT::Math::Minimizer::SetVariableInitialRange ( unsigned int  ,
double  ,
double   
)
inlinevirtualinherited

set the initial range of an existing variable

Definition at line 240 of file Minimizer.h.

240  {
241  return false;
242  }

◆ SetVariableLimits()

virtual bool ROOT::Math::Minimizer::SetVariableLimits ( unsigned int  ivar,
double  lower,
double  upper 
)
inlinevirtualinherited

set the limits of an already existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 209 of file Minimizer.h.

209  {
210  return SetVariableLowerLimit(ivar,lower) && SetVariableUpperLimit(ivar,upper);
211  }
virtual bool SetVariableLowerLimit(unsigned int ivar, double lower)
set the lower-limit of an already existing variable
Definition: Minimizer.h:197
virtual bool SetVariableUpperLimit(unsigned int ivar, double upper)
set the upper-limit of an already existing variable
Definition: Minimizer.h:203

References ROOT::Math::Minimizer::SetVariableLowerLimit(), and ROOT::Math::Minimizer::SetVariableUpperLimit().

Here is the call graph for this function:

◆ SetVariableLowerLimit()

virtual bool ROOT::Math::Minimizer::SetVariableLowerLimit ( unsigned int  ivar,
double  lower 
)
inlinevirtualinherited

set the lower-limit of an already existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 197 of file Minimizer.h.

197  {
198  MATH_ERROR_MSG("Minimizer::SetVariableLowerLimit","Setting an existing variable limit not implemented");
199  MATH_UNUSED(ivar); MATH_UNUSED(lower);
200  return false;
201  }

References MATH_ERROR_MSG, and MATH_UNUSED.

Referenced by ROOT::Math::Minimizer::SetVariableLimits().

◆ SetVariables()

template<class VariableIterator >
int ROOT::Math::Minimizer::SetVariables ( const VariableIterator &  begin,
const VariableIterator &  end 
)
inlineinherited

add variables . Return number of variables successfully added

Definition at line 131 of file Minimizer.h.

131  {
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  }
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
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
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)=0
set a new free variable
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

References ROOT::Math::Minimizer::SetFixedVariable(), ROOT::Math::Minimizer::SetLimitedVariable(), ROOT::Math::Minimizer::SetLowerLimitedVariable(), ROOT::Math::Minimizer::SetUpperLimitedVariable(), and ROOT::Math::Minimizer::SetVariable().

Here is the call graph for this function:

◆ SetVariableStepSize()

virtual bool ROOT::Math::Minimizer::SetVariableStepSize ( unsigned int  ivar,
double  value 
)
inlinevirtualinherited

set the step size of an already existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 191 of file Minimizer.h.

191  {
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  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ SetVariableUpperLimit()

virtual bool ROOT::Math::Minimizer::SetVariableUpperLimit ( unsigned int  ivar,
double  upper 
)
inlinevirtualinherited

set the upper-limit of an already existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 203 of file Minimizer.h.

203  {
204  MATH_ERROR_MSG("Minimizer::SetVariableUpperLimit","Setting an existing variable limit not implemented");
205  MATH_UNUSED(ivar); MATH_UNUSED(upper);
206  return false;
207  }

References MATH_ERROR_MSG, and MATH_UNUSED.

Referenced by ROOT::Math::Minimizer::SetVariableLimits().

◆ SetVariableValue()

virtual bool ROOT::Math::Minimizer::SetVariableValue ( unsigned int  ivar,
double  value 
)
inlinevirtualinherited

set the value of an already existing variable

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 176 of file Minimizer.h.

176  {
177  MATH_ERROR_MSG("Minimizer::SetVariableValue","Set of a variable value not implemented");
178  MATH_UNUSED(ivar); MATH_UNUSED(value);
179  return false;
180  }

References MATH_ERROR_MSG, and MATH_UNUSED.

Referenced by ROOT::Math::Minimizer::SetVariableValues().

◆ SetVariableValues()

virtual bool ROOT::Math::Minimizer::SetVariableValues ( const double *  x)
inlinevirtualinherited

set the values of all existing variables (array must be dimensioned to the size of the existing parameters)

Reimplemented in ROOT::Math::BasicMinimizer, and ROOT::Minuit2::Minuit2Minimizer.

Definition at line 182 of file Minimizer.h.

182  {
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  }
virtual bool SetVariableValue(unsigned int ivar, double value)
set the value of an already existing variable
Definition: Minimizer.h:176
virtual unsigned int NDim() const =0
this is <= Function().NDim() which is the total number of variables (free+ constrained ones)

References ROOT::Math::Minimizer::NDim(), and ROOT::Math::Minimizer::SetVariableValue().

Here is the call graph for this function:

◆ Status()

int ROOT::Math::Minimizer::Status ( ) const
inlineinherited

status code of minimizer

Definition at line 430 of file Minimizer.h.

430 { return fStatus; }

References ROOT::Math::Minimizer::fStatus.

Referenced by GeneticMinimizer::statusToString(), and Minuit2Minimizer::statusToString().

◆ Strategy()

int ROOT::Math::Minimizer::Strategy ( ) const
inlineinherited

strategy

Definition at line 427 of file Minimizer.h.

427 { return fOptions.Strategy(); }
int Strategy() const
strategy

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::Strategy().

Here is the call graph for this function:

◆ Tolerance()

double ROOT::Math::Minimizer::Tolerance ( ) const
inlineinherited

absolute tolerance

Definition at line 420 of file Minimizer.h.

420 { return fOptions.Tolerance(); }
double Tolerance() const
absolute tolerance

References ROOT::Math::Minimizer::fOptions, and ROOT::Math::MinimizerOptions::Tolerance().

Here is the call graph for this function:

◆ VariableIndex()

virtual int ROOT::Math::Minimizer::VariableIndex ( const std::string &  name) const
inlinevirtualinherited

get index of variable given a variable given a name return -1 if variable is not found

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 402 of file Minimizer.h.

402  {
403  MATH_ERROR_MSG("Minimizer::VariableIndex","Getting variable index from name not implemented");
404  MATH_UNUSED(name);
405  return -1;
406  }

References MATH_ERROR_MSG, and MATH_UNUSED.

◆ VariableName()

virtual std::string ROOT::Math::Minimizer::VariableName ( unsigned int  ivar) const
inlinevirtualinherited

get name of variables (override if minimizer support storing of variable names) return an empty string if variable is not found

Reimplemented in ROOT::Minuit2::Minuit2Minimizer, and ROOT::Math::BasicMinimizer.

Definition at line 395 of file Minimizer.h.

395  {
396  MATH_UNUSED(ivar);
397  return std::string(); // return empty string
398  }

References MATH_UNUSED.

◆ X()

virtual const double* ROOT::Math::GeneticMinimizer::X ( ) const
virtual

return pointer to X values at the minimum

Implements ROOT::Math::Minimizer.

Member Data Documentation

◆ fFitness

TMVA::IFitterTarget* ROOT::Math::GeneticMinimizer::fFitness
protected

Definition at line 106 of file GeneticMinimizer.h.

◆ fMinValue

double ROOT::Math::GeneticMinimizer::fMinValue
protected

Definition at line 107 of file GeneticMinimizer.h.

◆ fOptions

◆ fParameters

GeneticMinimizerParameters ROOT::Math::GeneticMinimizer::fParameters
protected

Definition at line 110 of file GeneticMinimizer.h.

Referenced by MinimizerParameters(), and SetRandomSeed().

◆ fRanges

std::vector<TMVA::Interval*> ROOT::Math::GeneticMinimizer::fRanges
protected

Definition at line 105 of file GeneticMinimizer.h.

◆ fResult

std::vector<double> ROOT::Math::GeneticMinimizer::fResult
protected

Definition at line 108 of file GeneticMinimizer.h.

◆ fStatus

int ROOT::Math::Minimizer::fStatus
protectedinherited

Definition at line 490 of file Minimizer.h.

Referenced by ROOT::Math::Minimizer::Status().

◆ fValidError

bool ROOT::Math::Minimizer::fValidError
protectedinherited

The documentation for this class was generated from the following file: