56 std::cout<<
"FumiliBuilder convergence when edm < "<<edmval<<std::endl;
71 MN_INFO_MSG(
"FumiliBuilder: initial matrix not pos.def.");
76 std::vector<MinimumState> result;
80 result.push_back( seed.
State() );
84 std::cout <<
"Fumili: start iterating until Edm is < " << edmval << std::endl;
95 int maxfcn_eff = int(0.5*maxfcn);
102 min =
Minimum(fcn, gc, seed, result, maxfcn_eff, edmval);
109 MN_INFO_MSG(
"FumiliBuilder: FunctionMinimum is invalid.");
116 edm = result.back().
Edm();
119 std::cout <<
"approximate edm is " << edm << std::endl;
120 std::cout <<
"npass is " << ipass << std::endl;
126 std::cout <<
"FumiliBuilder will verify convergence and Error matrix. " << std::endl;
127 std::cout <<
"dcov is = "<< min.
Error().
Dcovar() << std::endl;
136 result.push_back( st );
138 if (printLevel > 1) {
147 std::cout <<
"edm after Hesse calculation " << edm << std::endl;
148 std::cout <<
"state after Hessian calculation " << st << std::endl;
152 if (ipass > 0 && edm >= edmprev) {
154 MN_INFO_MSG(
"FumiliBuilder: Exit iterations, no improvements after Hesse ");
162 std::cout <<
"FumiliBuilder: Tolerance is not sufficient - edm is " << edm <<
" requested " << edmval
163 <<
" continue the minimization" << std::endl;
182 if (ipass == 0) maxfcn_eff = maxfcn;
186 }
while (edm > edmval );
191 min.
Add( result.back() );
234 double edm = initialState.
Edm();
238 std::cout <<
"\n\nDEBUG FUMILI Builder \nInitial State: "
239 <<
" Parameter " << initialState.
Vec()
242 <<
" edm = " << initialState.
Edm()
243 <<
" maxfcn = " << maxfcn
244 <<
" tolerance = " << edmval
254 double lambda = 0.001;
262 step = -1.*
s0.Error().InvHessian()*
s0.Gradient().Vec();
266 std::cout <<
"\n\n---> Iteration - " << result.size()
267 <<
"\nFval = " <<
s0.Fval() <<
" numOfCall = " << fcn.
NumOfCalls()
268 <<
"\nInternal Parameter values " <<
s0.Vec()
269 <<
" Newton step " << step << std::endl;
275 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def, gdel > 0");
280 step = -1.*
s0.Error().InvHessian()*
s0.Gradient().Vec();
286 result.push_back(
s0);
310 if ( p.
Fval() >=
s0.Fval() ) {
322 std::cout <<
"Before Gradient " << fcn.
NumOfCalls() << std::endl;
328 std::cout <<
"After Gradient " << fcn.
NumOfCalls() << std::endl;
343 std::cout <<
"Updated new point: \n "
344 <<
" FVAL " << p.
Fval()
345 <<
" Parameter " << p.
Vec()
346 <<
" Gradient " <<
g.Vec()
347 <<
" InvHessian " <<
e.Matrix()
348 <<
" Hessian " <<
e.Hessian()
349 <<
" edm = " << edm << std::endl << std::endl;
354 MN_INFO_MSG(
"FumiliBuilder: matrix not pos.def., edm < 0");
360 result.push_back(
s0);
367 if ( p.
Fval() <
s0.Fval() )
373 if ( edm < 0.1 )
break;
377 std::cout <<
" finish iteration- " << result.size() <<
" lambda = " << lambda <<
" f1 = " << p.
Fval() <<
" f0 = " <<
s0.Fval() <<
" num of calls = " << fcn.
NumOfCalls() <<
" edm " << edm << std::endl;
383 if (printLevel > 1) {
388 edm *= (1. + 3.*
e.Dcovar());
391 }
while(edm > edmval && fcn.
NumOfCalls() < maxfcn);
397 MN_INFO_MSG(
"FumiliBuilder: call limit exceeded.");
403 if(edm <
fabs(prec.
Eps2()*result.back().Fval())) {
405 MN_INFO_MSG(
"FumiliBuilder: machine accuracy limits further improvement.");
408 }
else if(edm < 10.*edmval) {
412 MN_INFO_MSG(
"FumiliBuilder: finishes without convergence.");
422 std::cout <<
"Exiting successfully FumiliBuilder \n"
424 <<
"\nFval = " << result.back().Fval()
425 <<
"\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.
determines the relative floating point 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 &)
Namespace for new ROOT classes and functions.