Logo ROOT  
Reference Guide
CombinedMinimumBuilder.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
13#include "Minuit2/MnStrategy.h"
14#include "Minuit2/MnPrint.h"
15
16namespace ROOT {
17
18namespace Minuit2 {
19
21 const MnStrategy &strategy, unsigned int maxfcn, double edmval) const
22{
23 // find minimum using combined method
24 // (Migrad then if fails try Simplex and then Migrad again)
25
26 MnPrint print("CombinedMinimumBuilder");
27
28 FunctionMinimum min = fVMMinimizer.Builder().Minimum(fcn, gc, seed, strategy, maxfcn, edmval);
29
30 if (!min.IsValid()) {
31 print.Warn("Migrad method fails, will try with simplex method first");
32
33 MnStrategy str(2);
34 FunctionMinimum min1 = fSimplexMinimizer.Builder().Minimum(fcn, gc, seed, str, maxfcn, edmval);
35 if (!min1.IsValid()) {
36 print.Warn("Both Migrad and Simplex methods failed");
37
38 return min1;
39 }
40 // check if gradient calculator is analytical
41 auto agc = dynamic_cast<const AnalyticalGradientCalculator *>(&gc);
42 MinimumSeed seed1 = (agc) ?
43 fVMMinimizer.SeedGenerator()(fcn, *agc, min1.UserState(), str) : fVMMinimizer.SeedGenerator()(fcn, gc, min1.UserState(), str);
44
45 FunctionMinimum min2 = fVMMinimizer.Builder().Minimum(fcn, gc, seed1, str, maxfcn, edmval);
46 if (!min2.IsValid()) {
47
48 print.Warn("Both migrad and method failed also at 2nd attempt; return simplex Minimum");
49 return min1;
50 }
51
52 return min2;
53 }
54
55 return min;
56}
57
58} // namespace Minuit2
59
60} // namespace ROOT
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, const MnStrategy &, unsigned int, double) const override
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
const MnUserParameterState & UserState() const
interface class for gradient calculators
virtual FunctionMinimum Minimum(const MnFcn &, const GradientCalculator &, const MinimumSeed &, const MnStrategy &, unsigned int, double) const =0
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:30
void Warn(const Ts &... args)
Definition: MnPrint.h:135
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
const MinimumBuilder & Builder() const override
const MinimumBuilder & Builder() const override
const MinimumSeedGenerator & SeedGenerator() const override
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.