59 std::cout<<
"FumiliBuilder convergence when edm < "<<edmval<<std::endl;
74 MN_INFO_MSG(
"FumiliBuilder: initial matrix not pos.def.");
79 std::vector<MinimumState> result;
83 result.push_back( seed.
State() );
86 std::cout <<
"Fumili: start iterating until Edm is < " << edmval << std::endl;
97 int maxfcn_eff =
int(0.5*maxfcn);
104 min =
Minimum(fcn, gc, seed, result, maxfcn_eff, edmval);
111 MN_INFO_MSG(
"FumiliBuilder: FunctionMinimum is invalid.");
118 edm = result.back().
Edm();
121 std::cout <<
"approximate edm is " << edm << std::endl;
122 std::cout <<
"npass is " << ipass << std::endl;
128 std::cout <<
"FumiliBuilder will verify convergence and Error matrix. " << std::endl;
129 std::cout <<
"dcov is = "<< min.
Error().
Dcovar() << std::endl;
138 result.push_back( st );
140 if (printLevel > 1) {
149 std::cout <<
"edm after Hesse calculation " << edm << std::endl;
150 std::cout <<
"state after Hessian calculation " << st << std::endl;
154 if (ipass > 0 && edm >= edmprev) {
156 MN_INFO_MSG(
"FumiliBuilder: Exit iterations, no improvements after Hesse ");
164 std::cout <<
"FumiliBuilder: Tolerance is not sufficient - edm is " << edm <<
" requested " << edmval
165 <<
" continue the minimization" << std::endl;
184 if (ipass == 0) maxfcn_eff = maxfcn;
188 }
while (edm > edmval );
193 min.
Add( result.back() );
236 double edm = initialState.
Edm();
240 std::cout <<
"\n\nDEBUG FUMILI Builder \nInitial State: "
241 <<
" Parameter " << initialState.
Vec()
244 <<
" edm = " << initialState.
Edm()
245 <<
" maxfcn = " << maxfcn
246 <<
" tolerance = " << edmval
256 double lambda = 0.001;
264 step = -1.*
s0.Error().InvHessian()*
s0.Gradient().Vec();
268 std::cout <<
"\n\n---> Iteration - " << result.size()
269 <<
"\nFval = " <<
s0.Fval() <<
" numOfCall = " << fcn.
NumOfCalls()
270 <<
"\nInternal Parameter values " <<
s0.Vec()
271 <<
" Newton step " << step << std::endl;
277 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def, gdel > 0");
282 step = -1.*
s0.Error().InvHessian()*
s0.Gradient().Vec();
288 result.push_back(
s0);
312 if ( p.
Fval() >=
s0.Fval() ) {
324 std::cout <<
"Before Gradient " << fcn.
NumOfCalls() << std::endl;
330 std::cout <<
"After Gradient " << fcn.
NumOfCalls() << std::endl;
345 std::cout <<
"Updated new point: \n "
346 <<
" FVAL " << p.
Fval()
347 <<
" Parameter " << p.
Vec()
348 <<
" Gradient " <<
g.Vec()
349 <<
" InvHessian " <<
e.Matrix()
350 <<
" Hessian " <<
e.Hessian()
351 <<
" edm = " << edm << std::endl << std::endl;
356 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def., edm < 0");
362 result.push_back(
s0);
369 if ( p.
Fval() <
s0.Fval() )
375 if ( edm < 0.1 )
break;
379 std::cout <<
" finish iteration- " << result.size() <<
" lambda = " << lambda <<
" f1 = " << p.
Fval() <<
" f0 = " <<
s0.Fval() <<
" num of calls = " << fcn.
NumOfCalls() <<
" edm " << edm << std::endl;
385 if (printLevel > 1) {
390 edm *= (1. + 3.*
e.Dcovar());
393 }
while(edm > edmval && fcn.
NumOfCalls() < maxfcn);
399 MN_INFO_MSG(
"FumiliBuilder: call limit exceeded.");
405 if(edm <
fabs(prec.
Eps2()*result.back().Fval())) {
407 MN_INFO_MSG(
"FumiliBuilder: machine accuracy limits further improvement.");
410 }
else if(edm < 10.*edmval) {
414 MN_INFO_MSG(
"FumiliBuilder: finishes without convergence.");
424 std::cout <<
"Exiting successfully FumiliBuilder \n"
426 <<
"\nFval = " << result.back().Fval()
427 <<
"\nedm = " << edm <<
" requested = " << edmval << std::endl;
#define MN_INFO_VAL2(loc, x)
virtual FunctionMinimum Minimum(const MnFcn &fMnFcn, const GradientCalculator &fGradienCalculator, const MinimumSeed &fMinimumSeed, const MnStrategy &fMnStrategy, unsigned int maxfcn, double edmval) const
Class the member function calculating the Minimum and verifies the result depending on the strategy.
const FumiliErrorUpdator & ErrorUpdator() const
Accessor to the Error updator of the builder.
const VariableMetricEDMEstimator & Estimator() const
Accessor to the EDM (expected vertical distance to the Minimum) estimator.
virtual MinimumError Update(const MinimumState &fMinimumState, const MinimumParameters &fMinimumParameters, const GradientCalculator &fGradientCalculator, double lambda) const
Member function that calculates the Error matrix (or the Hessian matrix containing the (approximate) ...
const MnAlgebraicVector & Vec() const
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
void Add(const MinimumState &state)
const std::vector< ROOT::Minuit2::MinimumState > & States() const
const MinimumError & Error() const
const MinimumState & State() const
bool IsAboveMaxEdm() const
const MinimumSeed & Seed() const
interface class for gradient calculators
unsigned int size() const
void TraceIteration(int iter, const MinimumState &state) const
MinimumError keeps the inv.
const MnAlgebraicSymMatrix & InvHessian() const
const MnAlgebraicVector & Vec() const
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
const MnUserTransformation & Trafo() const
const MinimumParameters & Parameters() const
const MnMachinePrecision & Precision() const
const MinimumState & State() const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MinimumError & Error() const
const MnAlgebraicVector & Vec() const
const FunctionGradient & Gradient() const
Wrapper class to FCNBase interface used internally by Minuit.
unsigned int NumOfCalls() const
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
Implements a 1-dimensional minimization along a given direction (i.e.
Sets the relative floating point (double) arithmetic precision.
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
double Eps2() const
eps2 returns 2*sqrt(eps)
double Y() const
Accessor to the y (second) coordinate.
double X() const
Accessor to the x (first) coordinate.
Force the covariance matrix to be positive defined by adding extra terms in the diagonal.
static void PrintState(std::ostream &os, const MinimumState &state, const char *msg, int iter=-1)
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
double Estimate(const FunctionGradient &, const MinimumError &) const
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
double inner_product(const LAVector &, const LAVector &)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...