From: stevenj Date: Mon, 3 Sep 2007 15:53:55 +0000 (-0400) Subject: rename fmin to minf to avoid conflict with C99 fmin() function X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=43353bee60636b414b574dcbd99f7ffd439cf0d3;p=nlopt.git rename fmin to minf to avoid conflict with C99 fmin() function darcs-hash:20070903155355-c8de0-573f0e3548646f08a7a2c2c2712375ff69307219.gz --- diff --git a/api/nlopt.c b/api/nlopt.c index f3c88de..667a5b1 100644 --- a/api/nlopt.c +++ b/api/nlopt.c @@ -159,8 +159,8 @@ static nlopt_result nlopt_minimize_( int n, nlopt_func f, void *f_data, const double *lb, const double *ub, /* bounds */ double *x, /* in: initial guess, out: minimizer */ - double *fmin, /* out: minimum */ - double fmin_max, double ftol_rel, double ftol_abs, + double *minf, /* out: minimum */ + double minf_max, double ftol_rel, double ftol_abs, double xtol_rel, const double *xtol_abs, int maxeval, double maxtime) { @@ -169,7 +169,7 @@ static nlopt_result nlopt_minimize_( nlopt_stopping stop; /* some basic argument checks */ - if (n <= 0 || !f || !lb || !ub || !x || !fmin) + if (n <= 0 || !f || !lb || !ub || !x || !minf) return NLOPT_INVALID_ARGS; d.f = f; @@ -187,8 +187,8 @@ static nlopt_result nlopt_minimize_( return NLOPT_INVALID_ARGS; stop.n = n; - stop.fmin_max = (isnan(fmin_max) || (my_isinf(fmin_max) && fmin_max < 0)) - ? -MY_INF : fmin_max; + stop.minf_max = (isnan(minf_max) || (my_isinf(minf_max) && minf_max < 0)) + ? -MY_INF : minf_max; stop.ftol_rel = ftol_rel; stop.ftol_abs = ftol_abs; stop.xtol_rel = xtol_rel; @@ -202,7 +202,7 @@ static nlopt_result nlopt_minimize_( case NLOPT_GN_DIRECT: case NLOPT_GN_DIRECT_L: case NLOPT_GN_DIRECT_L_RAND: - return cdirect(n, f, f_data, lb, ub, x, fmin, &stop, 0.0, + return cdirect(n, f, f_data, lb, ub, x, minf, &stop, 0.0, (algorithm != NLOPT_GN_DIRECT) + 3 * (algorithm == NLOPT_GN_DIRECT_L_RAND ? 2 : (algorithm != NLOPT_GN_DIRECT)) + 9 * (algorithm == NLOPT_GN_DIRECT_L_RAND ? 1 : (algorithm != NLOPT_GN_DIRECT))); @@ -210,7 +210,7 @@ static nlopt_result nlopt_minimize_( case NLOPT_GN_DIRECT_NOSCAL: case NLOPT_GN_DIRECT_L_NOSCAL: case NLOPT_GN_DIRECT_L_RAND_NOSCAL: - return cdirect_unscaled(n, f, f_data, lb, ub, x, fmin, + return cdirect_unscaled(n, f, f_data, lb, ub, x, minf, &stop, 0.0, (algorithm != NLOPT_GN_DIRECT) + 3 * (algorithm == NLOPT_GN_DIRECT_L_RAND ? 2 : (algorithm != NLOPT_GN_DIRECT)) @@ -218,10 +218,10 @@ static nlopt_result nlopt_minimize_( case NLOPT_GN_ORIG_DIRECT: case NLOPT_GN_ORIG_DIRECT_L: - switch (direct_optimize(f_direct, &d, n, lb, ub, x, fmin, + switch (direct_optimize(f_direct, &d, n, lb, ub, x, minf, maxeval, -1, 0.0, 0.0, pow(xtol_rel, (double) n), -1.0, - stop.fmin_max, 0.0, + stop.minf_max, 0.0, NULL, algorithm == NLOPT_GN_ORIG_DIRECT ? DIRECT_ORIGINAL @@ -238,7 +238,7 @@ static nlopt_result nlopt_minimize_( case DIRECT_MAXITER_EXCEEDED: return NLOPT_MAXEVAL_REACHED; case DIRECT_GLOBAL_FOUND: - return NLOPT_FMIN_MAX_REACHED; + return NLOPT_MINF_MAX_REACHED; case DIRECT_VOLTOL: case DIRECT_SIGMATOL: return NLOPT_XTOL_REACHED; @@ -249,7 +249,7 @@ static nlopt_result nlopt_minimize_( case NLOPT_GD_STOGO: case NLOPT_GD_STOGO_RAND: - if (!stogo_minimize(n, f, f_data, x, fmin, lb, ub, &stop, + if (!stogo_minimize(n, f, f_data, x, minf, lb, ub, &stop, algorithm == NLOPT_GD_STOGO ? 0 : 2*n)) return NLOPT_FAILURE; @@ -269,7 +269,7 @@ static nlopt_result nlopt_minimize_( else scale[i] = 0.01 * x[i] + 0.0001; } - iret = subplex(f_subplex, fmin, x, n, &d, &stop, scale); + iret = subplex(f_subplex, minf, x, n, &d, &stop, scale); free(scale); switch (iret) { case -2: return NLOPT_INVALID_ARGS; @@ -277,7 +277,7 @@ static nlopt_result nlopt_minimize_( case -1: return NLOPT_MAXEVAL_REACHED; case 0: return NLOPT_XTOL_REACHED; case 1: return NLOPT_SUCCESS; - case 2: return NLOPT_FMIN_MAX_REACHED; + case 2: return NLOPT_MINF_MAX_REACHED; case 20: return NLOPT_FTOL_REACHED; case -200: return NLOPT_OUT_OF_MEMORY; default: return NLOPT_FAILURE; /* unknown return code */ @@ -298,7 +298,7 @@ static nlopt_result nlopt_minimize_( h0 = MIN(h0, 0.01 * x[i] + 0.0001); } return praxis_(0.0, DBL_EPSILON, h0, n, x, f_subplex, &d, - &stop, fmin); + &stop, minf); } case NLOPT_LD_LBFGS: { @@ -321,7 +321,7 @@ static nlopt_result nlopt_minimize_( } } else { - *fmin = f(n, x, NULL, f_data); + *minf = f(n, x, NULL, f_data); switch (iret) { case 5: return NLOPT_MAXEVAL_REACHED; case 2: return NLOPT_XTOL_REACHED; @@ -344,15 +344,15 @@ nlopt_result nlopt_minimize( int n, nlopt_func f, void *f_data, const double *lb, const double *ub, /* bounds */ double *x, /* in: initial guess, out: minimizer */ - double *fmin, /* out: minimum */ - double fmin_max, double ftol_rel, double ftol_abs, + double *minf, /* out: minimum */ + double minf_max, double ftol_rel, double ftol_abs, double xtol_rel, const double *xtol_abs, int maxeval, double maxtime) { nlopt_result ret; if (xtol_abs) ret = nlopt_minimize_(algorithm, n, f, f_data, lb, ub, - x, fmin, fmin_max, ftol_rel, ftol_abs, + x, minf, minf_max, ftol_rel, ftol_abs, xtol_rel, xtol_abs, maxeval, maxtime); else { int i; @@ -360,7 +360,7 @@ nlopt_result nlopt_minimize( if (!xtol) return NLOPT_OUT_OF_MEMORY; for (i = 0; i < n; ++i) xtol[i] = -1; ret = nlopt_minimize_(algorithm, n, f, f_data, lb, ub, - x, fmin, fmin_max, ftol_rel, ftol_abs, + x, minf, minf_max, ftol_rel, ftol_abs, xtol_rel, xtol, maxeval, maxtime); free(xtol); } diff --git a/api/nlopt.h b/api/nlopt.h index 5038062..8045cb6 100644 --- a/api/nlopt.h +++ b/api/nlopt.h @@ -53,7 +53,7 @@ typedef enum { NLOPT_OUT_OF_MEMORY = -3, NLOPT_SUCCESS = 1, /* generic success code */ - NLOPT_FMIN_MAX_REACHED = 2, + NLOPT_MINF_MAX_REACHED = 2, NLOPT_FTOL_REACHED = 3, NLOPT_XTOL_REACHED = 4, NLOPT_MAXEVAL_REACHED = 5, @@ -65,8 +65,8 @@ extern nlopt_result nlopt_minimize( int n, nlopt_func f, void *f_data, const double *lb, const double *ub, /* bounds */ double *x, /* in: initial guess, out: minimizer */ - double *fmin, /* out: minimum */ - double fmin_max, double ftol_rel, double ftol_abs, + double *minf, /* out: minimum */ + double minf_max, double ftol_rel, double ftol_abs, double xtol_rel, const double *xtol_abs, int maxeval, double maxtime); diff --git a/api/nlopt_minimize.3 b/api/nlopt_minimize.3 index a217805..c490f56 100644 --- a/api/nlopt_minimize.3 +++ b/api/nlopt_minimize.3 @@ -20,8 +20,8 @@ nlopt_minimize \- Minimize a multivariate nonlinear function .BI " const double* " "lb" , .BI " const double* " "ub" , .BI " double* " "x" , -.BI " double* " "fmin" , -.BI " double " "fmin_max" , +.BI " double* " "minf" , +.BI " double " "minf_max" , .BI " double " "ftol_rel" , .BI " double " "ftol_abs" , .BI " double " "xtol_rel" , @@ -41,7 +41,7 @@ of design variables using the specified .IR algorithm . The minimum function value found is returned in -.IR fmin , +.IR minf , with the corresponding design variable values returned in the array .I x of length @@ -224,9 +224,9 @@ criterion depends on the optimization algorithm above (although we have tried to make them as consistent as reasonably possible), and some algorithms do not support all of the stopping criteria. .TP -.B fmin_max +.B minf_max Stop when a function value less than or equal to -.I fmin_max +.I minf_max is found. Set to -Inf or NaN (see constraints section above) to disable. .TP .B ftol_rel @@ -293,9 +293,9 @@ The value returned is one of the following enumerated constants. .B NLOPT_SUCCESS Generic success return value. .TP -.B NLOPT_FMIN_MAX_REACHED +.B NLOPT_MINF_MAX_REACHED Optimization stopped because -.I fmin_max +.I minf_max (above) was reached. .TP .B NLOPT_FTOL_REACHED diff --git a/cdirect/cdirect.c b/cdirect/cdirect.c index e1d2636..755429b 100644 --- a/cdirect/cdirect.c +++ b/cdirect/cdirect.c @@ -51,7 +51,7 @@ typedef struct { nlopt_func f; void *f_data; double *work; /* workspace, of length >= 2*n */ int *iwork; /* workspace, length >= n */ - double fmin, *xmin; /* minimum so far */ + double minf, *xmin; /* minimum so far */ /* red-black tree of hyperrects, sorted by (d,f,age) in lexographical order */ @@ -116,14 +116,14 @@ static void sort_fv(int n, double *fv, int *isort) static double function_eval(const double *x, params *p) { double f = p->f(p->n, x, NULL, p->f_data); - if (f < p->fmin) { - p->fmin = f; + if (f < p->minf) { + p->minf = f; memcpy(p->xmin, x, sizeof(double) * p->n); } p->stop->nevals++; return f; } -#define FUNCTION_EVAL(fv,x,p,freeonerr) fv = function_eval(x, p); if (p->fmin < p->stop->fmin_max) { free(freeonerr); return NLOPT_FMIN_MAX_REACHED; } else if (nlopt_stop_evals((p)->stop)) { free(freeonerr); return NLOPT_MAXEVAL_REACHED; } else if (nlopt_stop_time((p)->stop)) { free(freeonerr); return NLOPT_MAXTIME_REACHED; } +#define FUNCTION_EVAL(fv,x,p,freeonerr) fv = function_eval(x, p); if (p->minf < p->stop->minf_max) { free(freeonerr); return NLOPT_MINF_MAX_REACHED; } else if (nlopt_stop_evals((p)->stop)) { free(freeonerr); return NLOPT_MAXEVAL_REACHED; } else if (nlopt_stop_time((p)->stop)) { free(freeonerr); return NLOPT_MAXTIME_REACHED; } #define THIRD (0.3333333333333333333333) @@ -398,7 +398,7 @@ static nlopt_result divide_good_rects(params *p) K1 = (hull[i][1] - hull[ip][1]) / (hull[i][0] - hull[ip][0]); K = MAX(K1, K2); if (hull[i][1] - K * hull[i][0] - <= p->fmin - magic_eps * fabs(p->fmin) || ip == nhull) { + <= p->minf - magic_eps * fabs(p->minf) || ip == nhull) { /* "potentially optimal" rectangle, so subdivide */ nlopt_result ret = divide_rect(hull[i], p); divided_some = 1; @@ -457,7 +457,7 @@ int cdirect_hyperrect_compare(double *a, double *b) nlopt_result cdirect_unscaled(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, double magic_eps, int which_alg) { @@ -477,7 +477,7 @@ nlopt_result cdirect_unscaled(int n, nlopt_func f, void *f_data, p.f = f; p.f_data = f_data; p.xmin = x; - p.fmin = HUGE_VAL; + p.minf = HUGE_VAL; p.work = 0; p.iwork = 0; p.hull = 0; @@ -510,10 +510,10 @@ nlopt_result cdirect_unscaled(int n, nlopt_func f, void *f_data, if (ret != NLOPT_SUCCESS) goto done; while (1) { - double fmin0 = p.fmin; + double minf0 = p.minf; ret = divide_good_rects(&p); if (ret != NLOPT_SUCCESS) goto done; - if (p.fmin < fmin0 && nlopt_stop_f(p.stop, p.fmin, fmin0)) { + if (p.minf < minf0 && nlopt_stop_f(p.stop, p.minf, minf0)) { ret = NLOPT_FTOL_REACHED; goto done; } @@ -525,7 +525,7 @@ nlopt_result cdirect_unscaled(int n, nlopt_func f, void *f_data, free(p.iwork); free(p.work); - *fmin = p.fmin; + *minf = p.minf; return ret; } @@ -550,7 +550,7 @@ double cdirect_uf(int n, const double *xu, double *grad, void *d_) nlopt_result cdirect(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, double magic_eps, int which_alg) { @@ -571,7 +571,7 @@ nlopt_result cdirect(int n, nlopt_func f, void *f_data, } xtol_abs_save = stop->xtol_abs; stop->xtol_abs = d.x + 3*n; - ret = cdirect_unscaled(n, cdirect_uf, &d, d.x+n, d.x+2*n, x, fmin, stop, + ret = cdirect_unscaled(n, cdirect_uf, &d, d.x+n, d.x+2*n, x, minf, stop, magic_eps, which_alg); stop->xtol_abs = xtol_abs_save; for (i = 0; i < n; ++i) diff --git a/cdirect/cdirect.h b/cdirect/cdirect.h index 41148a6..77a0eb6 100644 --- a/cdirect/cdirect.h +++ b/cdirect/cdirect.h @@ -12,21 +12,21 @@ extern "C" extern nlopt_result cdirect_unscaled(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, double magic_eps, int which_alg); extern nlopt_result cdirect(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, double magic_eps, int which_alg); extern nlopt_result cdirect_hybrid(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, nlopt_algorithm local_alg, int local_maxeval, @@ -35,7 +35,7 @@ extern nlopt_result cdirect_hybrid(int n, nlopt_func f, void *f_data, extern nlopt_result cdirect_hybrid_unscaled(int n, nlopt_func f, void *f_data, const double *lb, const double *ub, double *x, - double *fmin, + double *minf, nlopt_stopping *stop, nlopt_algorithm local_alg, int local_maxeval, diff --git a/direct/DIRect.c b/direct/DIRect.c index 970f3f3..3e675e8 100644 --- a/direct/DIRect.c +++ b/direct/DIRect.c @@ -44,7 +44,7 @@ /* | Lipschitz continues. However, DIRECT has proven to be effective on | */ /* | more complex problems than these. | */ /* +-----------------------------------------------------------------------+ */ -/* Subroutine */ void direct_direct_(fp fcn, doublereal *x, integer *n, doublereal *eps, doublereal epsabs, integer *maxf, integer *maxt, doublereal *fmin, doublereal *l, +/* Subroutine */ void direct_direct_(fp fcn, doublereal *x, integer *n, doublereal *eps, doublereal epsabs, integer *maxf, integer *maxt, doublereal *minf, doublereal *l, doublereal *u, integer *algmethod, integer *ierror, FILE *logfile, doublereal *fglobal, doublereal *fglper, doublereal *volper, doublereal *sigmaper, void *fcn_data) @@ -126,7 +126,7 @@ /* | eps -- Exceeding value. If eps > 0, we use the same epsilon for | */ /* | all iterations. If eps < 0, we use the update formula from | */ /* | Jones: | */ -/* | eps = max(1.D-4*abs(fmin),epsfix), | */ +/* | eps = max(1.D-4*abs(minf),epsfix), | */ /* | where epsfix = abs(eps), the absolute value of eps which is| */ /* | passed to the function. | */ /* | maxf -- The maximum number of function evaluations. | */ @@ -147,10 +147,10 @@ /* | fglper -- Terminate the optimization when the percent error | */ /* | 100(f_min - fglobal)/max(1,abs(fglobal)) < fglper. | */ /* | volper -- Terminate the optimization when the volume of the | */ -/* | hyperrectangle S with f(c(S)) = fmin is less then volper | */ +/* | hyperrectangle S with f(c(S)) = minf is less then volper | */ /* | percent of the volume of the original hyperrectangle. | */ /* |sigmaper -- Terminate the optimization when the measure of the | */ -/* | hyperrectangle S with f(c(S)) = fmin is less then sigmaper.| */ +/* | hyperrectangle S with f(c(S)) = minf is less then sigmaper.| */ /* | | */ /* | User data that is passed through without being changed: | */ /* | fcn_data - opaque pointer to any user data | */ @@ -161,7 +161,7 @@ /* | X should be a good approximation to the global minimum | */ /* | for the function within the hyper-box. | */ /* | | */ -/* | fmin -- The value of the function at x. | */ +/* | minf -- The value of the function at x. | */ /* | Ierror -- Error flag. If Ierror is lower 0, an error has occured. The| */ /* | values of Ierror mean | */ /* | Fatal errors : | */ @@ -182,14 +182,14 @@ /* | 2 Number of iterations is equal to maxT. | */ /* | 3 The best function value found is within fglper of | */ /* | the (known) global optimum, that is | */ -/* | 100(fmin - fglobal/max(1,|fglobal|)) < fglper. | */ +/* | 100(minf - fglobal/max(1,|fglobal|)) < fglper. | */ /* | Note that this termination signal only occurs when | */ /* | the global optimal value is known, that is, a test | */ /* | function is optimized. | */ -/* | 4 The volume of the hyperrectangle with fmin at its | */ +/* | 4 The volume of the hyperrectangle with minf at its | */ /* | center is less than volper percent of the volume of | */ /* | the original hyperrectangle. | */ -/* | 5 The measure of the hyperrectangle with fmin at its | */ +/* | 5 The measure of the hyperrectangle with minf at its | */ /* | center is less than sigmaper. | */ /* | | */ /* | SUBROUTINEs used : | */ @@ -404,7 +404,7 @@ /* +-----------------------------------------------------------------------+ */ direct_dirinit_(f, fcn, c__, length, &actdeep, point, anchor, &ifree, logfile, arrayi, &maxi, list2, w, &x[1], &l[1], &u[1], - fmin, &minpos, thirds, levels, &MAXFUNC, &MAXDEEP, n, n, & + minf, &minpos, thirds, levels, &MAXFUNC, &MAXDEEP, n, n, & fmax, &ifeasiblef, &iinfesiblef, ierror, fcn_data, jones); /* +-----------------------------------------------------------------------+ */ /* | Added error checking. | */ @@ -428,7 +428,7 @@ /* +-----------------------------------------------------------------------+ */ /* | If no feasible point has been found, give out the iteration, the | */ /* | number of function evaluations and a warning. Otherwise, give out | */ -/* | the iteration, the number of function evaluations done and fmin. | */ +/* | the iteration, the number of function evaluations done and minf. | */ /* +-----------------------------------------------------------------------+ */ if (ifeasiblef > 0) { if (logfile) @@ -437,7 +437,7 @@ } else { if (logfile) fprintf(logfile, "%d, %d, %g, %g\n", - tstart-1, numfunc, *fmin, fmax); + tstart-1, numfunc, *minf, fmax); } /* +-----------------------------------------------------------------------+ */ /* +-----------------------------------------------------------------------+ */ @@ -451,7 +451,7 @@ /* | in the list S. | */ /* +-----------------------------------------------------------------------+ */ actdeep = actmaxdeep; - direct_dirchoose_(anchor, s, &MAXDEEP, f, fmin, *eps, epsabs, levels, &maxpos, length, + direct_dirchoose_(anchor, s, &MAXDEEP, f, minf, *eps, epsabs, levels, &maxpos, length, &MAXFUNC, &MAXDEEP, &MAXDIV, n, logfile, &cheat, & kmax, &ifeasiblef, jones); /* +-----------------------------------------------------------------------+ */ @@ -528,7 +528,7 @@ /* +-----------------------------------------------------------------------+ */ direct_dirsamplepoints_(c__, arrayi, &delta, &help, &start, length, logfile, f, &ifree, &maxi, point, &x[ - 1], &l[1], fmin, &minpos, &u[1], n, &MAXFUNC, & + 1], &l[1], minf, &minpos, &u[1], n, &MAXFUNC, & MAXDEEP, &oops); if (oops > 0) { if (logfile) @@ -542,7 +542,7 @@ /* +-----------------------------------------------------------------------+ */ direct_dirsamplef_(c__, arrayi, &delta, &help, &start, length, logfile, f, &ifree, &maxi, point, fcn, &x[ - 1], &l[1], fmin, &minpos, &u[1], n, &MAXFUNC, & + 1], &l[1], minf, &minpos, &u[1], n, &MAXFUNC, & MAXDEEP, &oops, &fmax, &ifeasiblef, &iinfesiblef, fcn_data); if (oops > 0) { @@ -579,7 +579,7 @@ if (oldpos < minpos) { if (logfile) fprintf(logfile, "%d, %d, %g, %g\n", - t, numfunc, *fmin, fmax); + t, numfunc, *minf, fmax); } /* +-----------------------------------------------------------------------+ */ /* | If no feasible point has been found, give out the iteration, the | */ @@ -596,7 +596,7 @@ /* +-----------------------------------------------------------------------+ */ /* +-----------------------------------------------------------------------+ */ /* | JG 01/22/01 Calculate the index for the hyperrectangle at which | */ -/* | fmin is assumed. We then calculate the volume of this | */ +/* | minf is assumed. We then calculate the volume of this | */ /* | hyperrectangle and store it in delta. This delta can be | */ /* | used to stop DIRECT once the volume is below a certain | */ /* | percentage of the original volume. Since the original | */ @@ -621,7 +621,7 @@ } /* +-----------------------------------------------------------------------+ */ /* | JG 01/23/01 Calculate the measure for the hyperrectangle at which | */ -/* | fmin is assumed. If this measure is smaller then sigmaper,| */ +/* | minf is assumed. If this measure is smaller then sigmaper,| */ /* | we stop DIRECT. | */ /* +-----------------------------------------------------------------------+ */ actdeep_div__ = direct_dirgetlevel_(&minpos, length, &MAXFUNC, n, jones); @@ -638,10 +638,10 @@ /* | global minimum value, terminate. This only makes sense if this optimal| */ /* | value is known, that is, in test problems. | */ /* +-----------------------------------------------------------------------+ */ - if ((*fmin - *fglobal) * 100 / divfactor <= *fglper) { + if ((*minf - *fglobal) * 100 / divfactor <= *fglper) { *ierror = 3; if (logfile) - fprintf(logfile, "DIRECT stopped: fmin within fglper of global minimum.\n"); + fprintf(logfile, "DIRECT stopped: minf within fglper of global minimum.\n"); goto L100; } /* +-----------------------------------------------------------------------+ */ @@ -661,7 +661,7 @@ /* +-----------------------------------------------------------------------+ */ if (iepschange == 1) { /* Computing MAX */ - d__1 = fabs(*fmin) * 1e-4; + d__1 = fabs(*minf) * 1e-4; *eps = MAX(d__1,epsfix); } /* +-----------------------------------------------------------------------+ */ @@ -734,7 +734,7 @@ L100: /* +-----------------------------------------------------------------------+ */ /* | Give out a summary of the run. | */ /* +-----------------------------------------------------------------------+ */ - direct_dirsummary_(logfile, &x[1], &l[1], &u[1], n, fmin, fglobal, &numfunc, + direct_dirsummary_(logfile, &x[1], &l[1], &u[1], n, minf, fglobal, &numfunc, ierror); /* +-----------------------------------------------------------------------+ */ /* | Format statements. | */ diff --git a/direct/DIRparallel.c b/direct/DIRparallel.c index aba092e..88fb902 100644 --- a/direct/DIRparallel.c +++ b/direct/DIRparallel.c @@ -26,7 +26,7 @@ static integer c_n1 = -1; /* | termination signal. | */ /* +-----------------------------------------------------------------------+ */ /* Subroutine */ int direct_pardirect_(fp fcn, doublereal *x, integer *n, - doublereal *eps, integer *maxf, integer *maxt, doublereal *fmin, + doublereal *eps, integer *maxf, integer *maxt, doublereal *minf, doublereal *l, doublereal *u, integer *algmethod, integer *ierror, FILE *logfile, doublereal *fglobal, doublereal *fglper, doublereal *volper, doublereal *sigmaper, void *fcn_data) @@ -101,7 +101,7 @@ static integer c_n1 = -1; /* | Call Direct main routine. This routine calls DIRSamplef for the | */ /* | function evaluations, which are then done in parallel. | */ /* +-----------------------------------------------------------------------+ */ - direct_direct_(fcn, &x[1], n, eps, maxf, maxt, fmin, &l[1], &u[1], + direct_direct_(fcn, &x[1], n, eps, maxf, maxt, minf, &l[1], &u[1], algmethod, ierror, logfile, fglobal, fglper, volper, sigmaper, fcn_data); /* +-----------------------------------------------------------------------+ */ @@ -151,7 +151,7 @@ static integer c_n1 = -1; *delta, integer *sample, integer *new__, integer *length, FILE *logfile, doublereal *f, integer *free, integer *maxi, integer *point, fp fcn, doublereal *x, doublereal *l, doublereal * - fmin, integer *minpos, doublereal *u, integer *n, integer *maxfunc, + minf, integer *minpos, doublereal *u, integer *n, integer *maxfunc, integer *maxdeep, integer *oops, doublereal *fmax, integer * ifeasiblef, integer *iinfesiblef, void *fcn_data) { @@ -371,8 +371,8 @@ static integer c_n1 = -1; /* +-----------------------------------------------------------------------+ */ i__1 = *maxi + *maxi; for (j = 1; j <= i__1; ++j) { - if (f[pos + f_dim1] < *fmin && f[pos + (f_dim1 << 1)] == 0.) { - *fmin = f[pos + f_dim1]; + if (f[pos + f_dim1] < *minf && f[pos + (f_dim1 << 1)] == 0.) { + *minf = f[pos + f_dim1]; *minpos = pos; } pos = point[pos]; diff --git a/direct/DIRserial.c b/direct/DIRserial.c index 60d0a39..fedd644 100644 --- a/direct/DIRserial.c +++ b/direct/DIRserial.c @@ -18,7 +18,7 @@ *delta, integer *sample, integer *new__, integer *length, FILE *logfile, doublereal *f, integer *free, integer *maxi, integer *point, fp fcn, doublereal *x, doublereal *l, doublereal * - fmin, integer *minpos, doublereal *u, integer *n, integer *maxfunc, + minf, integer *minpos, doublereal *u, integer *n, integer *maxfunc, integer *maxdeep, integer *oops, doublereal *fmax, integer * ifeasiblef, integer *iinfesiblef, void *fcn_data) { @@ -132,8 +132,8 @@ /* +-----------------------------------------------------------------------+ */ i__1 = *maxi + *maxi; for (j = 1; j <= i__1; ++j) { - if (f[(pos << 1) + 1] < *fmin && f[(pos << 1) + 2] == 0.) { - *fmin = f[(pos << 1) + 1]; + if (f[(pos << 1) + 1] < *minf && f[(pos << 1) + 2] == 0.) { + *minf = f[(pos << 1) + 1]; *minpos = pos; } pos = point[pos]; diff --git a/direct/DIRsubrout.c b/direct/DIRsubrout.c index c7743e1..1fa7892 100644 --- a/direct/DIRsubrout.c +++ b/direct/DIRsubrout.c @@ -98,7 +98,7 @@ integer direct_dirgetlevel_(integer *pos, integer *length, integer *maxfunc, int | */ /* +-----------------------------------------------------------------------+ */ /* Subroutine */ void direct_dirchoose_(integer *anchor, integer *s, integer *actdeep, - doublereal *f, doublereal *fmin, doublereal epsrel, doublereal epsabs, doublereal *thirds, + doublereal *f, doublereal *minf, doublereal epsrel, doublereal epsabs, doublereal *thirds, integer *maxpos, integer *length, integer *maxfunc, integer *maxdeep, integer *maxdiv, integer *n, FILE *logfile, integer *cheat, doublereal *kmax, integer *ifeasiblef, integer jones) @@ -237,10 +237,10 @@ L12: helplower = *kmax; } if (f[(j___ << 1) + 1] - helplower * thirds[s[j + (s_dim1 << 1)]] > - MIN(*fmin - epsrel * fabs(*fmin), - *fmin - epsabs)) { + MIN(*minf - epsrel * fabs(*minf), + *minf - epsabs)) { if (logfile) - fprintf(logfile, "> fmin - epslfminl\n"); + fprintf(logfile, "> minf - epslminfl\n"); goto L60; } } else { @@ -866,7 +866,7 @@ L50: doublereal *delta, integer *sample, integer *start, integer *length, FILE *logfile, doublereal *f, integer *free, integer *maxi, integer *point, doublereal *x, doublereal *l, - doublereal *fmin, integer *minpos, doublereal *u, integer *n, + doublereal *minf, integer *minpos, doublereal *u, integer *n, integer *maxfunc, integer *maxdeep, integer *oops) { /* System generated locals */ @@ -1144,7 +1144,7 @@ L50: integer *length, integer *actdeep, integer *point, integer *anchor, integer *free, FILE *logfile, integer *arrayi, integer *maxi, integer *list2, doublereal *w, doublereal *x, - doublereal *l, doublereal *u, doublereal *fmin, integer *minpos, + doublereal *l, doublereal *u, doublereal *minf, integer *minpos, doublereal *thirds, doublereal *levels, integer *maxfunc, integer * maxdeep, integer *n, integer *maxor, doublereal *fmax, integer * ifeasiblef, integer *iinfeasible, integer *ierror, void *fcndata, @@ -1194,8 +1194,8 @@ L50: c__ -= c_offset; /* Function Body */ - *fmin = 1e20; - costmin = *fmin; + *minf = 1e20; + costmin = *minf; /* JG 09/15/00 If Jones way of characterising rectangles is used, */ /* initialise thirds to reflect this. */ if (jones == 0) { @@ -1255,7 +1255,7 @@ L50: *ifeasiblef = 0; } /* JG 09/25/00 Remove IF */ - *fmin = f[3]; + *minf = f[3]; costmin = f[3]; *minpos = 1; *actdeep = 2; @@ -1266,7 +1266,7 @@ L50: new__ = *free; direct_dirsamplepoints_(&c__[c_offset], &arrayi[1], &delta, &c__1, &new__, & length[length_offset], logfile, &f[3], free, maxi, & - point[1], &x[1], &l[1], fmin, minpos, &u[1], n, + point[1], &x[1], &l[1], minf, minpos, &u[1], n, maxfunc, maxdeep, &oops); /* +-----------------------------------------------------------------------+ */ /* | JG 01/23/01 Added error checking. | */ @@ -1281,7 +1281,7 @@ L50: /* +-----------------------------------------------------------------------+ */ direct_dirsamplef_(&c__[c_offset], &arrayi[1], &delta, &c__1, &new__, &length[ length_offset], logfile, &f[3], free, maxi, &point[ - 1], fcn, &x[1], &l[1], fmin, minpos, &u[1], n, maxfunc, + 1], fcn, &x[1], &l[1], minf, minpos, &u[1], n, maxfunc, maxdeep, &oops, fmax, ifeasiblef, iinfeasible, fcndata); /* +-----------------------------------------------------------------------+ */ /* | JG 01/23/01 Added error checking. | */ @@ -1535,13 +1535,13 @@ L50: if (logfile) fprintf(logfile, "----------------------------------\n"); if (*ierror >= 0) { if (logfile) - fprintf(logfile, "Iteration # of f-eval. fmin\n"); + fprintf(logfile, "Iteration # of f-eval. minf\n"); } /* L10005: */ } /* dirheader_ */ /* Subroutine */ void direct_dirsummary_(FILE *logfile, doublereal *x, doublereal * - l, doublereal *u, integer *n, doublereal *fmin, doublereal *fglobal, + l, doublereal *u, integer *n, doublereal *minf, doublereal *fglobal, integer *numfunc, integer *ierror) { /* Local variables */ @@ -1556,9 +1556,9 @@ L50: if (logfile) { fprintf(logfile, "-----------------------Summary------------------\n" "Final function value: %g\n" - "Number of function evaluations: %d\n", *fmin, *numfunc); + "Number of function evaluations: %d\n", *minf, *numfunc); if (*fglobal > -1e99) - fprintf(logfile, "Final function value is within %g%% of global optimum\n", 100*(*fmin - *fglobal) / MAX(1.0, fabs(*fglobal))); + fprintf(logfile, "Final function value is within %g%% of global optimum\n", 100*(*minf - *fglobal) / MAX(1.0, fabs(*fglobal))); fprintf(logfile, "Index, final solution, x(i)-l(i), u(i)-x(i)\n"); for (i__ = 1; i__ <= *n; ++i__) fprintf(logfile, "%d, %g, %g, %g\n", i__, x[i__], diff --git a/direct/direct-internal.h b/direct/direct-internal.h index d5a0e66..c9cb685 100644 --- a/direct/direct-internal.h +++ b/direct/direct-internal.h @@ -35,7 +35,7 @@ extern void direct_dirinit_( integer *length, integer *actdeep, integer *point, integer *anchor, integer *free, FILE *logfile, integer *arrayi, integer *maxi, integer *list2, doublereal *w, doublereal *x, - doublereal *l, doublereal *u, doublereal *fmin, integer *minpos, + doublereal *l, doublereal *u, doublereal *minf, integer *minpos, doublereal *thirds, doublereal *levels, integer *maxfunc, integer * maxdeep, integer *n, integer *maxor, doublereal *fmax, integer * ifeasiblef, integer *iinfeasible, integer *ierror, void *fcndata, @@ -47,7 +47,7 @@ extern void direct_dirpreprc_(doublereal *u, doublereal *l, integer *n, doublereal *xs1, doublereal *xs2, integer *oops); extern void direct_dirchoose_( integer *anchor, integer *s, integer *actdeep, - doublereal *f, doublereal *fmin, doublereal epsrel, doublereal epsabs, doublereal *thirds, + doublereal *f, doublereal *minf, doublereal epsrel, doublereal epsabs, doublereal *thirds, integer *maxpos, integer *length, integer *maxfunc, integer *maxdeep, integer *maxdiv, integer *n, FILE *logfile, integer *cheat, doublereal *kmax, integer *ifeasiblef, integer jones); @@ -65,7 +65,7 @@ extern void direct_dirsamplepoints_( doublereal *delta, integer *sample, integer *start, integer *length, FILE *logfile, doublereal *f, integer *free, integer *maxi, integer *point, doublereal *x, doublereal *l, - doublereal *fmin, integer *minpos, doublereal *u, integer *n, + doublereal *minf, integer *minpos, doublereal *u, integer *n, integer *maxfunc, integer *maxdeep, integer *oops); extern void direct_dirdivide_( integer *new__, integer *currentlength, @@ -84,7 +84,7 @@ extern void direct_dirreplaceinf_( FILE *logfile, doublereal *fmax, integer jones); extern void direct_dirsummary_( FILE *logfile, doublereal *x, doublereal *l, doublereal *u, - integer *n, doublereal *fmin, doublereal *fglobal, + integer *n, doublereal *minf, doublereal *fglobal, integer *numfunc, integer *ierror); extern integer direct_dirgetlevel_( integer *pos, integer *length, @@ -100,14 +100,14 @@ extern void direct_dirsamplef_( *delta, integer *sample, integer *new__, integer *length, FILE *logfile, doublereal *f, integer *free, integer *maxi, integer *point, fp fcn, doublereal *x, doublereal *l, doublereal * - fmin, integer *minpos, doublereal *u, integer *n, integer *maxfunc, + minf, integer *minpos, doublereal *u, integer *n, integer *maxfunc, integer *maxdeep, integer *oops, doublereal *fmax, integer * ifeasiblef, integer *iinfesiblef, void *fcn_data); /* DIRect.c */ extern void direct_direct_( fp fcn, doublereal *x, integer *n, doublereal *eps, doublereal epsabs, - integer *maxf, integer *maxt, doublereal *fmin, doublereal *l, + integer *maxf, integer *maxt, doublereal *minf, doublereal *l, doublereal *u, integer *algmethod, integer *ierror, FILE *logfile, doublereal *fglobal, doublereal *fglper, doublereal *volper, doublereal *sigmaper, void *fcn_data); diff --git a/direct/direct.h b/direct/direct.h index 8b6f916..f357843 100644 --- a/direct/direct.h +++ b/direct/direct.h @@ -41,7 +41,7 @@ extern direct_return_code direct_optimize( int dimension, const double *lower_bounds, const double *upper_bounds, - double *x, double *fmin, + double *x, double *minf, int max_feval, int max_iter, double magic_eps, double magic_eps_abs, diff --git a/direct/direct_wrap.c b/direct/direct_wrap.c index 3a26838..6e857cd 100644 --- a/direct/direct_wrap.c +++ b/direct/direct_wrap.c @@ -18,11 +18,11 @@ lower_bounds, upper_bounds: arrays of length dimension of variable bounds x: an array of length dimension, set to optimum variables upon return - fmin: on return, set to minimum f value + minf: on return, set to minimum f value magic_eps, magic_eps_abs: Jones' "magic" epsilon parameter, and also an absolute version of the same - (not multipled by fmin). Jones suggests + (not multipled by minf). Jones suggests setting this to 1e-4, but 0 also works... max_feval, max_iter: maximum number of function evaluations & DIRECT iters @@ -45,7 +45,7 @@ direct_return_code direct_optimize( int dimension, const double *lower_bounds, const double *upper_bounds, - double *x, double *fmin, + double *x, double *minf, int max_feval, int max_iter, double magic_eps, double magic_eps_abs, @@ -86,7 +86,7 @@ direct_return_code direct_optimize( direct_direct_(f, x, &dimension, &magic_eps, magic_eps_abs, &max_feval, &max_iter, - fmin, + minf, l, u, &algmethod, &ierror, diff --git a/direct/tstc.c b/direct/tstc.c index 23a161a..2d97491 100644 --- a/direct/tstc.c +++ b/direct/tstc.c @@ -22,20 +22,20 @@ int main(int argc, char **argv) double x[2], l[2], u[2]; long int maxits = 0; int info; - double fmin; + double minf; maxits = argc < 2 ? 100 : atoi(argv[1]); l[0] = -3; l[1] = -3; u[0] = 3; u[1] = 3; - info = direct_optimize(tst_obj, NULL, n, l, u, x, &fmin, + info = direct_optimize(tst_obj, NULL, n, l, u, x, &minf, maxits, 500, 0, 0, 0, 0, DIRECT_UNKNOWN_FGLOBAL, 0, stdout, DIRECT_GABLONSKY); printf("min f = %g at (%g,%g) after %d evals, return value %d\n", - fmin, x[0], x[1], cnt, info); + minf, x[0], x[1], cnt, info); return EXIT_SUCCESS; } diff --git a/octave/nlopt_minimize.cc b/octave/nlopt_minimize.cc index cc6fd57..678c74d 100644 --- a/octave/nlopt_minimize.cc +++ b/octave/nlopt_minimize.cc @@ -109,7 +109,7 @@ DEFUN_DLD(nlopt_minimize, args, nargout, NLOPT_MINIMIZE_USAGE) CHECK(args(6).is_map(), "stop must be structure"); Octave_map stop = args(6).map_value(); - double fmin_max = struct_val_default(stop, "fmin_max", -HUGE_VAL); + double minf_max = struct_val_default(stop, "minf_max", -HUGE_VAL); double ftol_rel = struct_val_default(stop, "ftol_rel", 0); double ftol_abs = struct_val_default(stop, "ftol_abs", 0); double xtol_rel = struct_val_default(stop, "xtol_rel", 0); @@ -119,19 +119,19 @@ DEFUN_DLD(nlopt_minimize, args, nargout, NLOPT_MINIMIZE_USAGE) int maxeval = int(struct_val_default(stop, "maxeval", -1)); double maxtime = struct_val_default(stop, "maxtime", -1); - double fmin = HUGE_VAL; + double minf = HUGE_VAL; nlopt_result ret = nlopt_minimize(algorithm, n, user_function, &d, lb.data(), ub.data(), - x.fortran_vec(), &fmin, - fmin_max, ftol_rel, ftol_abs, + x.fortran_vec(), &minf, + minf_max, ftol_rel, ftol_abs, xtol_rel, xtol_abs.data(), maxeval, maxtime); retval(0) = x; if (nargout > 1) - retval(1) = fmin; + retval(1) = minf; if (nargout > 2) retval(2) = int(ret); diff --git a/praxis/praxis.c b/praxis/praxis.c index b366d27..f68e28b 100644 --- a/praxis/praxis.c +++ b/praxis/praxis.c @@ -1243,7 +1243,7 @@ L4: } if (nlopt_stop_evals(stop)) *ret = NLOPT_MAXEVAL_REACHED; else if (nlopt_stop_time(stop)) *ret = NLOPT_MAXTIME_REACHED; - else if (ret_val <= stop->fmin_max) *ret = NLOPT_FMIN_MAX_REACHED; + else if (ret_val <= stop->minf_max) *ret = NLOPT_MINF_MAX_REACHED; return ret_val; } /* flin_ */ diff --git a/stogo/global.cc b/stogo/global.cc index 76fcd14..b27925e 100644 --- a/stogo/global.cc +++ b/stogo/global.cc @@ -134,7 +134,7 @@ double Global::NewtonTest(RTBox box, int axis, RCRVector x_av, int *noutside) { else if (info == LS_New ) { box.AddTrial(tmpTrial) ; - if (tmpTrial.objval<=fbound+mu && tmpTrial.objval<=box.fmin+mu) { + if (tmpTrial.objval<=fbound+mu && tmpTrial.objval<=box.minf+mu) { if (stogo_verbose) { cout << "Found a candidate, x=" << tmpTrial.xvals; cout << " F=" <fmin_max) + if (*fx < stop->minf_max) *iflag = 2; else if (nlopt_stop_evals(stop)) *iflag = -1; @@ -2159,14 +2159,14 @@ L120: f: function f(n,x,fdata) to be optimized n: problem dimension - fmin: (output) value of f at minimum + minf: (output) value of f at minimum x[n]: (input) starting guess position, (output) computed minimum fdata: data pointer passed to f old args: tol: relative error tolerance for x maxnfe: maximum number of function evaluations - fmin_max, use_fmin_max: if use_fmin_max, stop when f <= fmin_max + minf_max, use_minf_max: if use_minf_max, stop when f <= minf_max new args: nlopt_stopping *stop (stopping criteria) @@ -2185,7 +2185,7 @@ L120: = 20 : ftol reached = -200 : out of memory */ -int subplex(subplex_func f, double *fmin, double *x, int n, void *fdata, +int subplex(subplex_func f, double *minf, double *x, int n, void *fdata, nlopt_stopping *stop, const double *scale) { @@ -2206,7 +2206,7 @@ int subplex(subplex_func f, double *fmin, double *x, int n, void *fdata, subplx_(f,fdata, &n, stop, &mode, scale, x, - fmin, &nfe, + minf, &nfe, work, iwork, &errflag); free(iwork); diff --git a/subplex/subplex.h b/subplex/subplex.h index f9f5b2f..f6f79ab 100644 --- a/subplex/subplex.h +++ b/subplex/subplex.h @@ -10,7 +10,7 @@ extern "C" typedef double (*subplex_func)(int n, const double *x, void *func_data); -extern int subplex(subplex_func f, double *fmin, double *x, int n, void *fdata, +extern int subplex(subplex_func f, double *minf, double *x, int n, void *fdata, nlopt_stopping *stop, const double *scale); diff --git a/test/testfuncs.h b/test/testfuncs.h index dd3e0f1..63ea3da 100644 --- a/test/testfuncs.h +++ b/test/testfuncs.h @@ -14,7 +14,7 @@ typedef struct { int has_gradient; int n; const double *lb, *ub, *xmin; - double fmin; + double minf; const char *name; } testfunc; diff --git a/test/testopt.cpp b/test/testopt.cpp index b93cf29..63e0fe4 100644 --- a/test/testopt.cpp +++ b/test/testopt.cpp @@ -16,7 +16,7 @@ #include "testfuncs.h" static nlopt_algorithm algorithm = NLOPT_GN_DIRECT_L; -static double ftol_rel = 0, ftol_abs = 0, xtol_rel = 0, xtol_abs = 0, fmin_max_delta = -HUGE_VAL; +static double ftol_rel = 0, ftol_abs = 0, xtol_rel = 0, xtol_abs = 0, minf_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, fmin_max, f0, *xtabs; + double *x, minf, minf_max, f0, *xtabs; nlopt_result ret; double start = nlopt_seconds(); @@ -56,7 +56,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); + minf_max = minf_max_delta > (-HUGE_VAL) ? minf_max_delta + func.minf : (-HUGE_VAL); printf("-----------------------------------------------------------\n"); printf("Optimizing %s (%d dims) using %s algorithm\n", @@ -107,8 +107,8 @@ static int test_function(int ifunc) ret = nlopt_minimize(algorithm, func.n, func.f, func.f_data, func.lb, func.ub, - x, &fmin, - fmin_max, ftol_rel, ftol_abs, xtol_rel, xtabs, + x, &minf, + minf_max, ftol_rel, ftol_abs, xtol_rel, xtabs, maxeval, maxtime); printf("finished after %g seconds.\n", nlopt_seconds() - start); printf("return code %d from nlopt_minimize\n", ret); @@ -117,14 +117,14 @@ static int test_function(int ifunc) return 0; } printf("Found minimum f = %g after %d evaluations.\n", - fmin, testfuncs_counter); + minf, testfuncs_counter); printf("Minimum at x = ["); for (i = 0; i < func.n; ++i) printf(" %g", x[i]); printf("]\n"); - printf("|f - fmin| = %g, |f - fmin| / |fmin| = %e\n", - fabs(fmin - func.fmin), fabs(fmin - func.fmin) / fabs(func.fmin)); + printf("|f - minf| = %g, |f - minf| / |minf| = %e\n", + fabs(minf - func.minf), fabs(minf - func.minf) / fabs(func.minf)); } - printf("vs. global minimum f = %g at x = [", func.fmin); + printf("vs. global minimum f = %g at x = [", func.minf); for (i = 0; i < func.n; ++i) printf(" %g", func.xmin[i]); printf("]\n"); @@ -149,7 +149,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 : stop when fmin+ is reached (default: disabled)\n" + " -m : stop when minf+ is reached (default: disabled)\n" " -i : iterate optimization times (default: 1)\n" " -r : use random seed for starting guesses\n" , maxeval); @@ -215,7 +215,7 @@ int main(int argc, char **argv) ftol_abs = atof(optarg); break; case 'm': - fmin_max_delta = atof(optarg); + minf_max_delta = atof(optarg); break; case 'c': center_start = 1; diff --git a/util/nlopt-util.h b/util/nlopt-util.h index ed862d5..0061012 100644 --- a/util/nlopt-util.h +++ b/util/nlopt-util.h @@ -18,7 +18,7 @@ extern int nlopt_iurand(int n); /* stopping criteria */ typedef struct { int n; - double fmin_max; + double minf_max; double ftol_rel; double ftol_abs; double xtol_rel; diff --git a/util/stop.c b/util/stop.c index 52a9c78..7c4732e 100644 --- a/util/stop.c +++ b/util/stop.c @@ -16,7 +16,7 @@ int nlopt_stop_ftol(const nlopt_stopping *s, const double f, double oldf) int nlopt_stop_f(const nlopt_stopping *s, const double f, double oldf) { - return (f <= s->fmin_max || nlopt_stop_ftol(s, f, oldf)); + return (f <= s->minf_max || nlopt_stop_ftol(s, f, oldf)); } int nlopt_stop_x(const nlopt_stopping *s, const double *x, const double *oldx)