Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Math::MinimizerOptions Class Reference

Minimizer options.

Class defining the options for the minimizer. It contains also static methods for setting the default Minimizer option values that will be used by default by all Minimizer instances. To see the current default options do:

 ROOT::Math::MinimizerOptions::PrintDefault();

Definition at line 40 of file MinimizerOptions.h.

Public Member Functions

 MinimizerOptions ()
 
 MinimizerOptions (const MinimizerOptions &opt)
 
 ~MinimizerOptions ()
 
double ErrorDef () const
 error definition
 
const IOptionsExtraOptions () const
 return extra options (NULL pointer if they are not present)
 
unsigned int MaxFunctionCalls () const
 max number of function calls
 
unsigned int MaxIterations () const
 max iterations
 
const std::string & MinimizerAlgorithm () const
 type of algorithm
 
const std::string & MinimizerType () const
 type of minimizer
 
MinimizerOptionsoperator= (const MinimizerOptions &opt)
 assignment operators
 
double Precision () const
 precision in the objective function calculation (value <=0 means left to default)
 
void Print (std::ostream &os=std::cout) const
 print all the options
 
int PrintLevel () const
 non-static methods for retrieving options
 
void ResetToDefaultOptions ()
 non-static methods for setting options
 
void SetErrorDef (double err)
 set error def
 
void SetExtraOptions (const IOptions &opt)
 set extra options (in this case pointer is cloned)
 
void SetMaxFunctionCalls (unsigned int maxfcn)
 set maximum of function calls
 
void SetMaxIterations (unsigned int maxiter)
 set maximum iterations (one iteration can have many function calls)
 
void SetMinimizerAlgorithm (const char *type)
 set minimizer algorithm
 
void SetMinimizerType (const char *type)
 set minimizer type
 
void SetPrecision (double prec)
 set the precision
 
void SetPrintLevel (int level)
 set print level
 
void SetStrategy (int stra)
 set the strategy
 
void SetTolerance (double tol)
 set the tolerance
 
int Strategy () const
 strategy
 
double Tolerance () const
 absolute tolerance
 

Static Public Member Functions

static ROOT::Math::IOptionsDefault (const char *name)
 Retrieve extra options for a given minimizer name.
 
static double DefaultErrorDef ()
 
static IOptionsDefaultExtraOptions ()
 
static int DefaultMaxFunctionCalls ()
 
static int DefaultMaxIterations ()
 
static const std::string & DefaultMinimizerAlgo ()
 
static const std::string & DefaultMinimizerType ()
 
static double DefaultPrecision ()
 
static int DefaultPrintLevel ()
 
static int DefaultStrategy ()
 
static double DefaultTolerance ()
 
static ROOT::Math::IOptionsFindDefault (const char *name)
 Find an extra options and return a nullptr if it is not existing.
 
static void PrintDefault (const char *name=nullptr, std::ostream &os=std::cout)
 Print all the default options including the extra one specific for a given minimizer name.
 
static void SetDefaultErrorDef (double up)
 Set the default level for computing the parameter errors.
 
static void SetDefaultExtraOptions (const IOptions *extraoptions)
 Set additional minimizer options as pair of (string,value).
 
static void SetDefaultMaxFunctionCalls (int maxcall)
 Set the maximum number of function calls.
 
static void SetDefaultMaxIterations (int maxiter)
 Set the maximum number of iterations.
 
static void SetDefaultMinimizer (const char *type, const char *algo=nullptr)
 Set the default Minimizer type and corresponding algorithms.
 
static void SetDefaultPrecision (double prec)
 Set the default Minimizer precision.
 
static void SetDefaultPrintLevel (int level)
 Set the default Print Level.
 
static void SetDefaultStrategy (int strat)
 Set the default strategy.
 
static void SetDefaultTolerance (double tol)
 Set the Minimization tolerance.
 

Private Attributes

std::string fAlgoType
 Minimizer algorithmic specification (Migrad, Minimize, ...)
 
double fErrorDef
 error definition (=1. for getting 1 sigma error for chi2 fits)
 
ROOT::Math::IOptionsfExtraOptions
 
int fLevel
 debug print level
 
int fMaxCalls
 maximum number of function calls
 
int fMaxIter
 maximum number of iterations
 
std::string fMinimType
 Minimizer type (Minuit, Minuit2, etc..
 
double fPrecision
 precision of the objective function evaluation (value <=0 means left to default)
 
int fStrategy
 minimizer strategy (used by Minuit)
 
double fTolerance
 minimize tolerance to reach solution
 

#include <Math/MinimizerOptions.h>

Constructor & Destructor Documentation

◆ MinimizerOptions() [1/2]

ROOT::Math::MinimizerOptions::MinimizerOptions ( )

Definition at line 133 of file MinimizerOptions.cxx.

◆ ~MinimizerOptions()

ROOT::Math::MinimizerOptions::~MinimizerOptions ( )

Definition at line 166 of file MinimizerOptions.cxx.

◆ MinimizerOptions() [2/2]

ROOT::Math::MinimizerOptions::MinimizerOptions ( const MinimizerOptions opt)

Definition at line 142 of file MinimizerOptions.cxx.

Member Function Documentation

◆ Default()

IOptions & ROOT::Math::MinimizerOptions::Default ( const char *  name)
static

Retrieve extra options for a given minimizer name.

If the extra options already exist in a global map of (Minimizer name, options) it will return a reference to that options, otherwise it will create a new one and return the corresponding reference

Definition at line 230 of file MinimizerOptions.cxx.

◆ DefaultErrorDef()

double ROOT::Math::MinimizerOptions::DefaultErrorDef ( )
static

Definition at line 91 of file MinimizerOptions.cxx.

◆ DefaultExtraOptions()

IOptions * ROOT::Math::MinimizerOptions::DefaultExtraOptions ( )
static

Definition at line 98 of file MinimizerOptions.cxx.

◆ DefaultMaxFunctionCalls()

int ROOT::Math::MinimizerOptions::DefaultMaxFunctionCalls ( )
static

Definition at line 94 of file MinimizerOptions.cxx.

◆ DefaultMaxIterations()

int ROOT::Math::MinimizerOptions::DefaultMaxIterations ( )
static

Definition at line 95 of file MinimizerOptions.cxx.

◆ DefaultMinimizerAlgo()

const std::string & ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo ( )
static

Definition at line 85 of file MinimizerOptions.cxx.

◆ DefaultMinimizerType()

const std::string & ROOT::Math::MinimizerOptions::DefaultMinimizerType ( )
static

Definition at line 100 of file MinimizerOptions.cxx.

◆ DefaultPrecision()

double ROOT::Math::MinimizerOptions::DefaultPrecision ( )
static

Definition at line 93 of file MinimizerOptions.cxx.

◆ DefaultPrintLevel()

int ROOT::Math::MinimizerOptions::DefaultPrintLevel ( )
static

Definition at line 97 of file MinimizerOptions.cxx.

◆ DefaultStrategy()

int ROOT::Math::MinimizerOptions::DefaultStrategy ( )
static

Definition at line 96 of file MinimizerOptions.cxx.

◆ DefaultTolerance()

double ROOT::Math::MinimizerOptions::DefaultTolerance ( )
static

Definition at line 92 of file MinimizerOptions.cxx.

◆ ErrorDef()

double ROOT::Math::MinimizerOptions::ErrorDef ( ) const
inline

error definition

Definition at line 192 of file MinimizerOptions.h.

◆ ExtraOptions()

const IOptions * ROOT::Math::MinimizerOptions::ExtraOptions ( ) const
inline

return extra options (NULL pointer if they are not present)

Definition at line 195 of file MinimizerOptions.h.

◆ FindDefault()

IOptions * ROOT::Math::MinimizerOptions::FindDefault ( const char *  name)
static

Find an extra options and return a nullptr if it is not existing.

Same as above but it will not create a new one

Definition at line 235 of file MinimizerOptions.cxx.

◆ MaxFunctionCalls()

unsigned int ROOT::Math::MinimizerOptions::MaxFunctionCalls ( ) const
inline

max number of function calls

Definition at line 177 of file MinimizerOptions.h.

◆ MaxIterations()

unsigned int ROOT::Math::MinimizerOptions::MaxIterations ( ) const
inline

max iterations

Definition at line 180 of file MinimizerOptions.h.

◆ MinimizerAlgorithm()

const std::string & ROOT::Math::MinimizerOptions::MinimizerAlgorithm ( ) const
inline

type of algorithm

Definition at line 201 of file MinimizerOptions.h.

◆ MinimizerType()

const std::string & ROOT::Math::MinimizerOptions::MinimizerType ( ) const
inline

type of minimizer

Definition at line 198 of file MinimizerOptions.h.

◆ operator=()

MinimizerOptions & ROOT::Math::MinimizerOptions::operator= ( const MinimizerOptions opt)

assignment operators

Definition at line 147 of file MinimizerOptions.cxx.

◆ Precision()

double ROOT::Math::MinimizerOptions::Precision ( ) const
inline

precision in the objective function calculation (value <=0 means left to default)

Definition at line 189 of file MinimizerOptions.h.

◆ Print()

void ROOT::Math::MinimizerOptions::Print ( std::ostream &  os = std::cout) const

print all the options

Definition at line 212 of file MinimizerOptions.cxx.

◆ PrintDefault()

void ROOT::Math::MinimizerOptions::PrintDefault ( const char *  name = nullptr,
std::ostream &  os = std::cout 
)
static

Print all the default options including the extra one specific for a given minimizer name.

If no minimizer name is given, all the extra default options, which have been set and configured will be printed

Definition at line 240 of file MinimizerOptions.cxx.

◆ PrintLevel()

int ROOT::Math::MinimizerOptions::PrintLevel ( ) const
inline

non-static methods for retrieving options

set print level

Definition at line 174 of file MinimizerOptions.h.

◆ ResetToDefaultOptions()

void ROOT::Math::MinimizerOptions::ResetToDefaultOptions ( )

non-static methods for setting options

Definition at line 170 of file MinimizerOptions.cxx.

◆ SetDefaultErrorDef()

void ROOT::Math::MinimizerOptions::SetDefaultErrorDef ( double  up)
static

Set the default level for computing the parameter errors.

For example for 1-sigma parameter errors

  • up = 1 for a chi-squared function
  • up = 0.5 for a negative log-likelihood function

The value will be used also by Minos when computing the confidence interval

Definition at line 51 of file MinimizerOptions.cxx.

◆ SetDefaultExtraOptions()

void ROOT::Math::MinimizerOptions::SetDefaultExtraOptions ( const IOptions extraoptions)
static

Set additional minimizer options as pair of (string,value).

Extra option defaults can be configured for a specific algorithm and then if a matching with the correct option name exists it will be used whenever creating a new minimizer instance. For example for changing the default number of steps of the Genetic minimizer from 100 to 500 do

 auto extraOpt = ROOT::Math::MinimizerOptions::Default("Genetic")
 extraOpts.SetValue("Steps",500);

and when creating the Genetic minimizer you will have the new value for the option:

auto gmin = ROOT::Math::Factory::CreateMinimizer("Genetic");
gmin->Options().Print();

Definition at line 79 of file MinimizerOptions.cxx.

◆ SetDefaultMaxFunctionCalls()

void ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls ( int  maxcall)
static

Set the maximum number of function calls.

Definition at line 63 of file MinimizerOptions.cxx.

◆ SetDefaultMaxIterations()

void ROOT::Math::MinimizerOptions::SetDefaultMaxIterations ( int  maxiter)
static

Set the maximum number of iterations.

Used by the GSL minimizers and Genetic. Not used by Minuit,Minuit2.

Definition at line 67 of file MinimizerOptions.cxx.

◆ SetDefaultMinimizer()

void ROOT::Math::MinimizerOptions::SetDefaultMinimizer ( const char *  type,
const char *  algo = nullptr 
)
static

Set the default Minimizer type and corresponding algorithms.

Here is the list of the available minimizers and their corresponding algorithms. For some minimizers (e.g. Fumili) there are no specific algorithms available, then there is no need to specify it.

ROOT Minimizers

  • Minuit Minimizer based on TMinuit, the legacy Minuit implementation. Here are the available algorithms:
    • Migrad default algorithm based on the variable metric minimizer
    • Minimize combination of Simplex and Migrad
    • Simplex minimization algorithm not using the gradient information
    • Scan brute function scan
  • Minuit2 New C++ implementation of Minuit (the recommended one)
    • Migrad (default)
    • Minimize
    • Simplex
    • Fumili2 new implementation of Fumili integrated in Minuit2
  • Fumili Minimizer using an approximation for the Hessian based on first derivatives of the model function (see TFumili). Works only for chi-squared and likelihood functions.
  • Linear Linear minimizer (fitter) working only for linear functions (see TLinearFitter and TLinearMinimizer)
  • GSLMultiMin Minimizer from GSL based on the ROOT::Math::GSLMinimizer. Available algorithms are:
    • BFGS2 (default)
    • BFGS
    • ConjugateFR
    • ConjugatePR
    • SteepestDescent
  • GSLMultiFit Minimizer based on GSL for minimizing only non linear least-squared functions (using an approximation similar to Fumili). See ROOT::Math::GSLMultiFit.
  • GSLSimAn Simulated annealing minimizer from GSL (see ROOT::Math::GSLSimAnMinimizer). It is a stochastic minimization algorithm using only function values and not the gradient.
  • Genetic Genetic minimization algorithms (see TMVA::Genetic)

Definition at line 43 of file MinimizerOptions.cxx.

◆ SetDefaultPrecision()

void ROOT::Math::MinimizerOptions::SetDefaultPrecision ( double  prec)
static

Set the default Minimizer precision.

(used only by MInuit and Minuit2) It is used to specify the numerical precision used for computing the objective function. It should be left to the default value found by the Minimizer (typically double precision)

Definition at line 59 of file MinimizerOptions.cxx.

◆ SetDefaultPrintLevel()

void ROOT::Math::MinimizerOptions::SetDefaultPrintLevel ( int  level)
static

Set the default Print Level.

Possible levels are from 0 (minimal printing) to 3 (maximum printing)

Definition at line 75 of file MinimizerOptions.cxx.

◆ SetDefaultStrategy()

void ROOT::Math::MinimizerOptions::SetDefaultStrategy ( int  strat)
static

Set the default strategy.

The strategy is a parameter used only by Minuit and Minuit2. Possible values are:

  • strat = 0 : rough approximation of Hessian using the gradient. Avoid computing the full Hessian matrix
  • strat = 1 (default and recommended one) - Use Hessian approximation but compute full Hessian at the end of minimization if needed.
  • strat = 2 Perform several full Hessian computations during the minimization. Slower and not always working better than strat=1.

Definition at line 71 of file MinimizerOptions.cxx.

◆ SetDefaultTolerance()

void ROOT::Math::MinimizerOptions::SetDefaultTolerance ( double  tol)
static

Set the Minimization tolerance.

The Default value for Minuit and Minuit2 is 0.01

Definition at line 55 of file MinimizerOptions.cxx.

◆ SetErrorDef()

void ROOT::Math::MinimizerOptions::SetErrorDef ( double  err)
inline

set error def

Definition at line 228 of file MinimizerOptions.h.

◆ SetExtraOptions()

void ROOT::Math::MinimizerOptions::SetExtraOptions ( const IOptions opt)

set extra options (in this case pointer is cloned)

Definition at line 206 of file MinimizerOptions.cxx.

◆ SetMaxFunctionCalls()

void ROOT::Math::MinimizerOptions::SetMaxFunctionCalls ( unsigned int  maxfcn)
inline

set maximum of function calls

Definition at line 213 of file MinimizerOptions.h.

◆ SetMaxIterations()

void ROOT::Math::MinimizerOptions::SetMaxIterations ( unsigned int  maxiter)
inline

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

Definition at line 216 of file MinimizerOptions.h.

◆ SetMinimizerAlgorithm()

void ROOT::Math::MinimizerOptions::SetMinimizerAlgorithm ( const char *  type)
inline

set minimizer algorithm

Definition at line 234 of file MinimizerOptions.h.

◆ SetMinimizerType()

void ROOT::Math::MinimizerOptions::SetMinimizerType ( const char *  type)
inline

set minimizer type

Definition at line 231 of file MinimizerOptions.h.

◆ SetPrecision()

void ROOT::Math::MinimizerOptions::SetPrecision ( double  prec)
inline

set the precision

Definition at line 222 of file MinimizerOptions.h.

◆ SetPrintLevel()

void ROOT::Math::MinimizerOptions::SetPrintLevel ( int  level)
inline

set print level

Definition at line 210 of file MinimizerOptions.h.

◆ SetStrategy()

void ROOT::Math::MinimizerOptions::SetStrategy ( int  stra)
inline

set the strategy

Definition at line 225 of file MinimizerOptions.h.

◆ SetTolerance()

void ROOT::Math::MinimizerOptions::SetTolerance ( double  tol)
inline

set the tolerance

Definition at line 219 of file MinimizerOptions.h.

◆ Strategy()

int ROOT::Math::MinimizerOptions::Strategy ( ) const
inline

strategy

Definition at line 183 of file MinimizerOptions.h.

◆ Tolerance()

double ROOT::Math::MinimizerOptions::Tolerance ( ) const
inline

absolute tolerance

Definition at line 186 of file MinimizerOptions.h.

Member Data Documentation

◆ fAlgoType

std::string ROOT::Math::MinimizerOptions::fAlgoType
private

Minimizer algorithmic specification (Migrad, Minimize, ...)

Definition at line 250 of file MinimizerOptions.h.

◆ fErrorDef

double ROOT::Math::MinimizerOptions::fErrorDef
private

error definition (=1. for getting 1 sigma error for chi2 fits)

Definition at line 246 of file MinimizerOptions.h.

◆ fExtraOptions

ROOT::Math::IOptions* ROOT::Math::MinimizerOptions::fExtraOptions
private

Definition at line 253 of file MinimizerOptions.h.

◆ fLevel

int ROOT::Math::MinimizerOptions::fLevel
private

debug print level

Definition at line 242 of file MinimizerOptions.h.

◆ fMaxCalls

int ROOT::Math::MinimizerOptions::fMaxCalls
private

maximum number of function calls

Definition at line 243 of file MinimizerOptions.h.

◆ fMaxIter

int ROOT::Math::MinimizerOptions::fMaxIter
private

maximum number of iterations

Definition at line 244 of file MinimizerOptions.h.

◆ fMinimType

std::string ROOT::Math::MinimizerOptions::fMinimType
private

Minimizer type (Minuit, Minuit2, etc..

Definition at line 249 of file MinimizerOptions.h.

◆ fPrecision

double ROOT::Math::MinimizerOptions::fPrecision
private

precision of the objective function evaluation (value <=0 means left to default)

Definition at line 248 of file MinimizerOptions.h.

◆ fStrategy

int ROOT::Math::MinimizerOptions::fStrategy
private

minimizer strategy (used by Minuit)

Definition at line 245 of file MinimizerOptions.h.

◆ fTolerance

double ROOT::Math::MinimizerOptions::fTolerance
private

minimize tolerance to reach solution

Definition at line 247 of file MinimizerOptions.h.

Libraries for ROOT::Math::MinimizerOptions:

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