Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MinimizerOptions.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta Fri Aug 15 2008
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2008 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11#ifndef ROOT_Math_MinimizerOptions
12#define ROOT_Math_MinimizerOptions
13
14#include <string>
15
16#include <iostream>
17
18namespace ROOT {
19
20
21namespace Math {
22
23
24class IOptions;
25
26//_______________________________________________________________________________
27/**
28 Minimizer options
29
30 @ingroup MultiMin
31*/
33
34public:
35
36 // static methods for setting and retrieving the default options
37
38 static void SetDefaultMinimizer(const char * type, const char * algo = 0);
39 static void SetDefaultErrorDef( double up);
40 static void SetDefaultTolerance(double tol);
41 static void SetDefaultPrecision(double prec);
42 static void SetDefaultMaxFunctionCalls(int maxcall);
43 static void SetDefaultMaxIterations(int maxiter);
44 static void SetDefaultStrategy(int strat);
45 static void SetDefaultPrintLevel(int level);
46 static void SetDefaultExtraOptions(const IOptions * extraoptions);
47
48 static const std::string & DefaultMinimizerType();
49 static const std::string & DefaultMinimizerAlgo();
50 static double DefaultErrorDef();
51 static double DefaultTolerance();
52 static double DefaultPrecision();
53 static int DefaultMaxFunctionCalls();
54 static int DefaultMaxIterations();
55 static int DefaultStrategy();
56 static int DefaultPrintLevel();
58
59 /// retrieve extra options - if not existing create a IOptions
60 static ROOT::Math::IOptions & Default(const char * name);
61
62 // find extra options - return 0 if not existing
63 static ROOT::Math::IOptions * FindDefault(const char * name);
64
65 /// Print all the default options including the extra one specific for a given minimizer name.
66 /// If no minimizer name is given, all the extra default options, which have been set and configured will be printed
67 static void PrintDefault(const char * name = nullptr, std::ostream & os = std::cout);
68
69public:
70
71 // constructor using the default options
73
74 // destructor
76
77 // copy constructor
79
80 /// assignment operators
82
83 /** non-static methods for retrieving options */
84
85 /// set print level
86 int PrintLevel() const { return fLevel; }
87
88 /// max number of function calls
89 unsigned int MaxFunctionCalls() const { return fMaxCalls; }
90
91 /// max iterations
92 unsigned int MaxIterations() const { return fMaxIter; }
93
94 /// strategy
95 int Strategy() const { return fStrategy; }
96
97 /// absolute tolerance
98 double Tolerance() const { return fTolerance; }
99
100 /// precision in the objective funciton calculation (value <=0 means left to default)
101 double Precision() const { return fPrecision; }
102
103 /// error definition
104 double ErrorDef() const { return fErrorDef; }
105
106 /// return extra options (NULL pointer if they are not present)
107 const IOptions * ExtraOptions() const { return fExtraOptions; }
108
109 /// type of minimizer
110 const std::string & MinimizerType() const { return fMinimType; }
111
112 /// type of algorithm
113 const std::string & MinimizerAlgorithm() const { return fAlgoType; }
114
115 /// print all the options
116 void Print(std::ostream & os = std::cout) const;
117
118 /** non-static methods for setting options */
120
121 /// set print level
122 void SetPrintLevel(int level) { fLevel = level; }
123
124 ///set maximum of function calls
125 void SetMaxFunctionCalls(unsigned int maxfcn) { fMaxCalls = maxfcn; }
126
127 /// set maximum iterations (one iteration can have many function calls)
128 void SetMaxIterations(unsigned int maxiter) { fMaxIter = maxiter; }
129
130 /// set the tolerance
131 void SetTolerance(double tol) { fTolerance = tol; }
132
133 /// set the precision
134 void SetPrecision(double prec) { fPrecision = prec; }
135
136 /// set the strategy
137 void SetStrategy(int stra) { fStrategy = stra; }
138
139 /// set error def
140 void SetErrorDef(double err) { fErrorDef = err; }
141
142 /// set minimizer type
143 void SetMinimizerType(const char * type) { fMinimType = type; }
144
145 /// set minimizer algorithm
146 void SetMinimizerAlgorithm(const char *type) { fAlgoType = type; }
147
148 /// set extra options (in this case pointer is cloned)
149 void SetExtraOptions(const IOptions & opt);
150
151
152private:
153
154 int fLevel; // debug print level
155 int fMaxCalls; // maximum number of function calls
156 int fMaxIter; // maximum number of iterations
157 int fStrategy; // minimizer strategy (used by Minuit)
158 double fErrorDef; // error definition (=1. for getting 1 sigma error for chi2 fits)
159 double fTolerance; // minimize tolerance to reach solution
160 double fPrecision; // precision of the objective function evaluation (value <=0 means left to default)
161 std::string fMinimType; // Minimizer type (Minuit, Minuit2, etc..
162 std::string fAlgoType; // Minimizer algorithmic specification (Migrad, Minimize, ...)
163
164 // extra options
166
167};
168
169 } // end namespace Math
170
171} // end namespace ROOT
172
173#endif
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
Generic interface for defining configuration options of a numerical algorithm.
Definition IOptions.h:31
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetStrategy(int stra)
set the strategy
MinimizerOptions & operator=(const MinimizerOptions &opt)
assignment operators
static void SetDefaultMinimizer(const char *type, const char *algo=0)
static ROOT::Math::IOptions & Default(const char *name)
retrieve extra options - if not existing create a IOptions
static void SetDefaultMaxFunctionCalls(int maxcall)
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)
static ROOT::Math::IOptions * FindDefault(const char *name)
double Tolerance() const
absolute tolerance
double Precision() const
precision in the objective funciton calculation (value <=0 means left to default)
void SetMinimizerType(const char *type)
set minimizer type
const std::string & MinimizerAlgorithm() const
type of algorithm
double ErrorDef() const
error definition
static void SetDefaultExtraOptions(const IOptions *extraoptions)
static IOptions * DefaultExtraOptions()
static void SetDefaultMaxIterations(int maxiter)
static void SetDefaultErrorDef(double up)
static void SetDefaultStrategy(int strat)
static void SetDefaultPrecision(double prec)
static const std::string & DefaultMinimizerType()
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
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 const std::string & DefaultMinimizerAlgo()
const std::string & MinimizerType() const
type of minimizer
static void SetDefaultPrintLevel(int level)
unsigned int MaxIterations() const
max iterations
ROOT::Math::IOptions * fExtraOptions
void SetPrecision(double prec)
set the precision
unsigned int MaxFunctionCalls() const
max number of function calls
void ResetToDefaultOptions()
non-static methods for setting options
static void SetDefaultTolerance(double tol)
int PrintLevel() const
non-static methods for retrieving options
void SetErrorDef(double err)
set error def
void SetPrintLevel(int level)
set print level
void Print(std::ostream &os=std::cout) const
print all the options
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm
void SetTolerance(double tol)
set the tolerance
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...