diff --git a/api/nlopt.c b/api/nlopt.c index ef3acf959e047088621ac7dede46a8598fcd2e72..5de528219c6d2920d519a69abae0ea927faa78f4 100644 --- a/api/nlopt.c +++ b/api/nlopt.c @@ -135,7 +135,7 @@ nlopt_result nlopt_minimize( } iret = lbfgsb_minimize(n, f, f_data, x, nbd, lb, ub, MIN(n, 5), 0.0, ftol_rel, - xtol_abs ? xtol_rel : *xtol_abs, + xtol_abs ? *xtol_abs : xtol_rel, maxeval); free(nbd); if (iret <= 0) { diff --git a/test/testopt.cpp b/test/testopt.cpp index 3599f51411a3f6f41451935a6b1b4df5b74ef4e9..795a39cf177b02f3103d16be1f79be65c7a836d4 100644 --- a/test/testopt.cpp +++ b/test/testopt.cpp @@ -125,6 +125,9 @@ int main(int argc, char **argv) srand((unsigned) time(NULL)); testfuncs_verbose = 0; + if (argc <= 1) + usage(stdout); + while ((c = getopt(argc, argv, "hvra:o:e:")) != -1) switch (c) { case 'h':