Logo ROOT   6.16/01
Reference Guide
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 for the name given
66 static void PrintDefault(const char * name, std::ostream & os = std::cout);
67
68public:
69
70 // constructor using the default options
72
73 // destructor
75
76 // copy constructor
78
79 /// assignment operators
81
82 /** non-static methods for retrieving options */
83
84 /// set print level
85 int PrintLevel() const { return fLevel; }
86
87 /// max number of function calls
88 unsigned int MaxFunctionCalls() const { return fMaxCalls; }
89
90 /// max iterations
91 unsigned int MaxIterations() const { return fMaxIter; }
92
93 /// strategy
94 int Strategy() const { return fStrategy; }
95
96 /// absolute tolerance
97 double Tolerance() const { return fTolerance; }
98
99 /// precision in the objective funciton calculation (value <=0 means left to default)
100 double Precision() const { return fPrecision; }
101
102 /// error definition
103 double ErrorDef() const { return fErrorDef; }
104
105 /// return extra options (NULL pointer if they are not present)
106 const IOptions * ExtraOptions() const { return fExtraOptions; }
107
108 /// type of minimizer
109 const std::string & MinimizerType() const { return fMinimType; }
110
111 /// type of algorithm
112 const std::string & MinimizerAlgorithm() const { return fAlgoType; }
113
114 /// print all the options
115 void Print(std::ostream & os = std::cout) const;
116
117 /** non-static methods for setting options */
119
120 /// set print level
121 void SetPrintLevel(int level) { fLevel = level; }
122
123 ///set maximum of function calls
124 void SetMaxFunctionCalls(unsigned int maxfcn) { fMaxCalls = maxfcn; }
125
126 /// set maximum iterations (one iteration can have many function calls)
127 void SetMaxIterations(unsigned int maxiter) { fMaxIter = maxiter; }
128
129 /// set the tolerance
130 void SetTolerance(double tol) { fTolerance = tol; }
131
132 /// set the precision
133 void SetPrecision(double prec) { fPrecision = prec; }
134
135 /// set the strategy
136 void SetStrategy(int stra) { fStrategy = stra; }
137
138 /// set error def
139 void SetErrorDef(double err) { fErrorDef = err; }
140
141 /// set minimizer type
142 void SetMinimizerType(const char * type) { fMinimType = type; }
143
144 /// set minimizer algorithm
145 void SetMinimizerAlgorithm(const char *type) { fAlgoType = type; }
146
147 /// set extra options (in this case pointer is cloned)
148 void SetExtraOptions(const IOptions & opt);
149
150
151private:
152
153 int fLevel; // debug print level
154 int fMaxCalls; // maximum number of function calls
155 int fMaxIter; // maximum number of iterations
156 int fStrategy; // minimizer strategy (used by Minuit)
157 double fErrorDef; // error definition (=1. for getting 1 sigma error for chi2 fits)
158 double fTolerance; // minimize tolerance to reach solution
159 double fPrecision; // precision of the objective function evaluation (value <=0 means left to default)
160 std::string fMinimType; // Minimizer type (Minuit, Minuit2, etc..
161 std::string fAlgoType; // Minimizer algorithmic specification (Migrad, Minimize, ...)
162
163 // extra options
165
166};
167
168 } // end namespace Math
169
170} // end namespace ROOT
171
172#endif
int type
Definition: TGX11.cxx:120
Generic interface for defining configuration options of a numerical algorithm.
Definition: IOptions.h:30
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)
int Strategy() const
strategy
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, std::ostream &os=std::cout)
print all the default options for the name given
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.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21