chiark / gitweb /
fixes to nlopt stop cases in BOBYQA
authorstevenj <stevenj@alum.mit.edu>
Tue, 17 Nov 2009 21:17:11 +0000 (16:17 -0500)
committerstevenj <stevenj@alum.mit.edu>
Tue, 17 Nov 2009 21:17:11 +0000 (16:17 -0500)
darcs-hash:20091117211711-c8de0-f08774fcd3cfefe2d33029d6561b60d51b5cae6a.gz

bobyqa/bobyqa.c

index 51f5ddb650a91c1d187ef1dd73f58dea4ca659ca..01616211793799016df95ca45bf26ec0cd335e7b 100644 (file)
@@ -2578,10 +2578,12 @@ L360:
     if (ntrits == -1) {
        fsave = f;
        rc = NLOPT_XTOL_REACHED;
+       if (fsave < fval[kopt]) { *minf = f; return rc; }
        goto L720;
     }
 
     if (f < stop->minf_max) {
+      *minf = f;
       return NLOPT_MINF_MAX_REACHED;
     }
 
@@ -2809,6 +2811,10 @@ L360:
                gopt[i__] += temp * xpt[k + i__ * xpt_dim1];
            }
        }
+       if (nlopt_stop_ftol(stop, f, fopt)) {
+             rc = NLOPT_FTOL_REACHED;
+            goto L720;
+        }
     }
 
 /*     Calculate the parameters of the least Frobenius norm interpolant to */