chiark / gitweb /
in slsqp make sure that we count only function evals and not other callback steps
authorstevenj <stevenj@alum.mit.edu>
Thu, 13 Jan 2011 15:14:30 +0000 (10:14 -0500)
committerstevenj <stevenj@alum.mit.edu>
Thu, 13 Jan 2011 15:14:30 +0000 (10:14 -0500)
darcs-hash:20110113151430-c8de0-b375418b8ca98ef138ba2e00da22789b62f998f2.gz

slsqp/slsqp.c

index c9b408aa970af5d51d9dd8465d61d840c98dbdfc..845fc0b97b9cf68402bcc1e1d0f5005c5b0f8253 100644 (file)
@@ -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;