From: stevenj Date: Thu, 13 Jan 2011 15:14:30 +0000 (-0500) Subject: in slsqp make sure that we count only function evals and not other callback steps X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=29bfe4ca79b8cbfc5b471600081416323391279a;p=nlopt.git in slsqp make sure that we count only function evals and not other callback steps darcs-hash:20110113151430-c8de0-b375418b8ca98ef138ba2e00da22789b62f998f2.gz --- diff --git a/slsqp/slsqp.c b/slsqp/slsqp.c index c9b408a..845fc0b 100644 --- a/slsqp/slsqp.c +++ b/slsqp/slsqp.c @@ -2494,6 +2494,7 @@ nlopt_result nlopt_slsqp(unsigned n, nlopt_func f, void *f_data, eval_f_and_grad: feasible_cur = 1; infeasibility_cur = 0; fcur = f(n, xcur, grad, f_data); + stop->nevals++; if (nlopt_stop_forced(stop)) { fcur = HUGE_VAL; ret = NLOPT_FORCED_STOP; goto done; } ii = 0; @@ -2532,6 +2533,7 @@ nlopt_result nlopt_slsqp(unsigned n, nlopt_func f, void *f_data, case 1: /* objective evaluation only (no gradient) */ feasible_cur = 1; infeasibility_cur = 0; fcur = f(n, xcur, NULL, f_data); + stop->nevals++; if (nlopt_stop_forced(stop)) { fcur = HUGE_VAL; ret = NLOPT_FORCED_STOP; goto done; } ii = 0; @@ -2616,7 +2618,6 @@ nlopt_result nlopt_slsqp(unsigned n, nlopt_func f, void *f_data, } /* do some additional termination tests */ - stop->nevals++; if (nlopt_stop_evals(stop)) ret = NLOPT_MAXEVAL_REACHED; else if (nlopt_stop_time(stop)) ret = NLOPT_MAXTIME_REACHED; else if (feasible && *minf < stop->minf_max) ret = NLOPT_MINF_MAX_REACHED;