chiark / gitweb /
fix support for maxtime in Luksan algorithms and ORIG_DIRECT; thanks to Jurgen Werner...
[nlopt.git] / newuoa / newuoa.c
index cc352151a64a53172f05f8b278f5740dc33ffdc8..7f5568f74d9b34fc0c98d50b7d797719c9e47f24 100644 (file)
@@ -2100,8 +2100,10 @@ L290:
     ++nf;
 L310:
     if (nlopt_stop_forced(stop)) rc = NLOPT_FORCED_STOP;
-    else if (nlopt_stop_evals(stop)) rc = NLOPT_MAXEVAL_REACHED;
-    else if (nlopt_stop_time(stop)) rc = NLOPT_MAXTIME_REACHED;
+    else if (stop->nevals > 0) {
+        if (nlopt_stop_evals(stop)) rc = NLOPT_MAXEVAL_REACHED;
+        else if (nlopt_stop_time(stop)) rc = NLOPT_MAXTIME_REACHED;
+    }
     if (rc != NLOPT_SUCCESS) goto L530;
 
     stop->nevals++;