From: stevenj Date: Thu, 30 Aug 2007 01:58:00 +0000 (-0400) Subject: -m option is now relative to exact minimum X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=bf9d153b6c2277b6394a02efe18285ffffe1cfe8;p=nlopt.git -m option is now relative to exact minimum darcs-hash:20070830015800-c8de0-36f49c5b05115ff4316955525f8f2eceb60122e7.gz --- diff --git a/test/testopt.cpp b/test/testopt.cpp index 1b7a754..9bbe9a2 100644 --- a/test/testopt.cpp +++ b/test/testopt.cpp @@ -16,7 +16,7 @@ #include "testfuncs.h" static nlopt_algorithm algorithm = NLOPT_GLOBAL_DIRECT; -static double ftol_rel = 0, ftol_abs = 0, xtol_rel = 0, xtol_abs = 0, fmin_max = -HUGE_VAL; +static double ftol_rel = 0, ftol_abs = 0, xtol_rel = 0, xtol_abs = 0, fmin_max_delta = -HUGE_VAL; static int maxeval = 1000, iterations = 1, center_start = 0; static double maxtime = 0.0; static double xinit_tol = -1; @@ -41,7 +41,7 @@ static int test_function(int ifunc) { testfunc func; int i, iter; - double *x, fmin, f0, *xtabs; + double *x, fmin, fmin_max, f0, *xtabs; nlopt_result ret; double start = nlopt_seconds(); @@ -62,7 +62,7 @@ static int test_function(int ifunc) xtabs = x + func.n * 2; for (i = 0; i < func.n; ++i) xtabs[i] = xtol_abs; - + fmin_max = fmin_max_delta > (-HUGE_VAL) ? fmin_max_delta + func.fmin : (-HUGE_VAL); printf("-----------------------------------------------------------\n"); printf("Optimizing %s (%d dims) using %s algorithm\n", @@ -155,7 +155,7 @@ static void usage(FILE *f) " -X : absolute tolerance on x (default: disabled)\n" " -f : relative tolerance on f (default: disabled)\n" " -F : absolute tolerance on f (default: disabled)\n" - " -m : minimize f until is reached (default: disabled)\n" + " -m : stop when fmin+ is reached (default: disabled)\n" " -i : iterate optimization times (default: 1)\n" " -r : use random seed for starting guesses\n" , maxeval); @@ -221,7 +221,7 @@ int main(int argc, char **argv) ftol_abs = atof(optarg); break; case 'm': - fmin_max = atof(optarg); + fmin_max_delta = atof(optarg); break; case 'c': center_start = 1;