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;
169 if (min.IsAboveMaxEdm() ) {
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;
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");
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()
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;
void Add(const MinimumState &state)
#define MN_INFO_VAL2(loc, x)
double Y() const
Accessor to the y (second) coordinate.
double Estimate(const FunctionGradient &, const MinimumError &) const
Namespace for new ROOT classes and functions.
const MnAlgebraicVector & Vec() const
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
Force the covariance matrix to be positive defined by adding extra terms in the diagonal.
const FumiliErrorUpdator & ErrorUpdator() const
Accessor to the Error updator of the builder.
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
const MnAlgebraicVector & Vec() const
double inner_product(const LAVector &, const LAVector &)
const VariableMetricEDMEstimator & Estimator() const
Accessor to the EDM (expected vertical distance to the Minimum) estimator.
const MnMachinePrecision & Precision() const
determines the relative floating point arithmetic precision.
unsigned int NumOfCalls() const
const MinimumState & State() const
const MinimumParameters & Parameters() const
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 FunctionGradient & Gradient() const
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
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) ...
static void PrintState(std::ostream &os, const MinimumState &state, const char *msg, int iter=-1)
Wrapper class to FCNBase interface used internally by Minuit.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
MnAlgebraicSymMatrix Hessian() const
MnAlgebraicSymMatrix Matrix() const
double X() const
Accessor to the x (first) coordinate.
unsigned int size() const
const MinimumError & Error() const
const MinimumParameters & Parameters() const
const MnAlgebraicVector & Grad() const
double Eps2() const
eps2 returns 2*sqrt(eps)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
MinimumError keeps the inv.
void TraceIteration(int iter, const MinimumState &state) const
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Implements a 1-dimensional minimization along a given direction (i.e.
interface class for gradient calculators
const MnAlgebraicVector & Vec() const
const MnAlgebraicSymMatrix & InvHessian() const