From: stevenj Date: Thu, 13 Nov 2008 20:52:25 +0000 (-0500) Subject: MLSL needs a nonzero default ftol_rel and/or xtol_rel X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1e377a8c7572d9aadfd628bd4db6f0cbfcf6e27d;p=nlopt.git MLSL needs a nonzero default ftol_rel and/or xtol_rel darcs-hash:20081113205225-c8de0-d38cc7ac93ec94d3d479f2776154b4d59b51f876.gz --- diff --git a/api/nlopt.c b/api/nlopt.c index 3fce224..3e49753 100644 --- a/api/nlopt.c +++ b/api/nlopt.c @@ -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)