chiark / gitweb /
MLSL needs a nonzero default ftol_rel and/or xtol_rel
authorstevenj <stevenj@alum.mit.edu>
Thu, 13 Nov 2008 20:52:25 +0000 (15:52 -0500)
committerstevenj <stevenj@alum.mit.edu>
Thu, 13 Nov 2008 20:52:25 +0000 (15:52 -0500)
darcs-hash:20081113205225-c8de0-d38cc7ac93ec94d3d479f2776154b4d59b51f876.gz

api/nlopt.c

index 3fce22410de03546784fe57ff3e6a8c157c61849..3e497532a31a2cf1743cf161e36c3ea3bc4ca752 100644 (file)
@@ -464,6 +464,14 @@ static nlopt_result nlopt_minimize_(
         case NLOPT_GD_MLSL:
         case NLOPT_GN_MLSL_LDS:
         case NLOPT_GD_MLSL_LDS:
+             for (i = 0; i < n && stop.xtol_abs[i] <= 0; ++i) ;
+             if (stop.ftol_rel <= 0 && stop.ftol_abs <= 0 &&
+                 stop.xtol_rel <= 0 && i == n) {
+                  /* it is not sensible to call MLSL without *some*
+                     nonzero tolerance for the local search */
+                  stop.ftol_rel = 1e-15;
+                  stop.xtol_rel = 1e-7;
+             }
              return mlsl_minimize(n, f, f_data, lb, ub, x, minf, &stop,
                                   (algorithm == NLOPT_GN_MLSL ||
                                    algorithm == NLOPT_GN_MLSL_LDS)