Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
FumiliMinimizer.cxx
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#include "Minuit2/MnConfig.h"
18#include "Minuit2/MinimumSeed.h"
24#include "Minuit2/MnFcn.h"
25#include "Minuit2/MnStrategy.h"
26#include "Minuit2/MnPrint.h"
27
28namespace ROOT {
29
30namespace Minuit2 {
31
32// for Fumili implement Minimize here because need downcast
33
35 const MnStrategy &strategy, unsigned int maxfcn, double toler) const
36{
37 MnPrint print("FumiliMinimizer::Minimize");
38
39 // Minimize using Fumili. Create seed and Fumili gradient calculator.
40 // The FCNBase passed must be a FumiliFCNBase type otherwise method will fail !
41
42 MnFcn mfcn{fcn, st.Trafo()};
43
44
45 unsigned int npar = st.VariableParameters();
46 if (maxfcn == 0)
47 maxfcn = 200 + 100 * npar + 5 * npar * npar;
48 // FUMILI needs much less function calls
49 //maxfcn = int(0.1 * maxfcn);
50
51 // Minimize using Fumili - function interface must be a FumiliFCNBase type
52 FumiliFCNBase *fumiliFcn = dynamic_cast<FumiliFCNBase *>(const_cast<FCNBase *>(&fcn));
53 if (!fumiliFcn) {
54 print.Error("Wrong FCN type; try to use default minimizer");
55 return FunctionMinimum(MinimumSeed(MinimumState(0), st.Trafo()), fcn.Up());
56 }
57
59 if (fcn.HasGradient()) {
60 print.Debug("Using FumiliMinimizer with analytical gradients");
61 } else {
62 print.Debug("Using FumiliMinimizer with numerical gradients");
63 }
64
65 // compute initial values;
66 MnAlgebraicVector x{st.IntParameters()};
67 double fcnmin = MnFcnCaller{mfcn}(x);
69 FunctionGradient grad = fgc(pa);
71 MinimumError err = errUpdator.Update(MinimumState(0), pa, fgc, 0.);
72 // set an arbitrary large initial edm (1.E10)
73 MinimumSeed mnseeds(MinimumState(pa, err, grad, 1.E10, 1), st.Trafo());
74
76}
77
78
87
88
89} // namespace Minuit2
90
91} // namespace ROOT
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:49
void SetMethod(FumiliMethodType type)
In the case of the Fumili algorithm the Error matrix (or the Hessian matrix containing the (approxima...
Extension of the FCNBase for the Fumili method.
Fumili gradient calculator using external gradient provided by FCN Note that the computed Hessian and...
FunctionMinimum Minimize(const FCNBase &, const MnUserParameterState &, const MnStrategy &, unsigned int maxfcn=0, double toler=0.1) const override
void SetMethod(const std::string &method)
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
MinimumError keeps the inv.
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Wrapper class to FCNBase interface used internally by Minuit.
Definition MnFcn.h:34
void Debug(const Ts &... args)
Definition MnPrint.h:135
void Error(const Ts &... args)
Definition MnPrint.h:117
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
Definition MnStrategy.h:27
class which holds the external user and/or internal Minuit representation of the parameters and error...
virtual FunctionMinimum Minimize(const FCNBase &, const MnUserParameterState &, const MnStrategy &=MnStrategy{1}, unsigned int maxfcn=0, double toler=0.1) const
Double_t x[n]
Definition legend1.C:17
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...