--- trunk/gadget/hooke.cc 2017/04/26 09:06:03 24 +++ trunk/gadget/hooke.cc 2017/05/05 14:38:16 25 @@ -562,6 +562,7 @@ while (1) { if (isZero(bestf)) { + iters = EcoSystem->getFuncEval() - offset; handle.logMessage(LOGINFO, "Error in Hooke & Jeeves optimisation after", iters, "function evaluations, f(x) = 0"); converge = -1; return; @@ -587,6 +588,7 @@ newf = this->bestNearby(delta, trialx, bestf, param); /* if too many function evaluations occur, terminate the algorithm */ + iters = EcoSystem->getFuncEval() - offset; if (iters > hookeiter) { handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); @@ -663,11 +665,12 @@ bestf = newf; for (i = 0; i < nvars; i++) x[i] = trialx[i]; - + newf = this->bestNearby(delta, trialx, bestf, param); if (isEqual(newf, bestf)) break; /* if too many function evaluations occur, terminate the algorithm */ + iters = EcoSystem->getFuncEval() - offset; if (iters > hookeiter) { handle.logMessage(LOGINFO, "\nStopping Hooke & Jeeves optimisation algorithm\n"); handle.logMessage(LOGINFO, "The optimisation stopped after", iters, "function evaluations"); @@ -684,6 +687,7 @@ } } // while (newf < bestf) + iters = EcoSystem->getFuncEval() - offset; if (newf < bestf) { for (i = 0; i < nvars; i++) bestx[i] = x[i] * init[i];