chiark / gitweb /
rename fmin to minf to avoid conflict with C99 fmin() function
authorstevenj <stevenj@alum.mit.edu>
Mon, 3 Sep 2007 15:53:55 +0000 (11:53 -0400)
committerstevenj <stevenj@alum.mit.edu>
Mon, 3 Sep 2007 15:53:55 +0000 (11:53 -0400)
darcs-hash:20070903155355-c8de0-573f0e3548646f08a7a2c2c2712375ff69307219.gz

28 files changed:
api/nlopt.c
api/nlopt.h
api/nlopt_minimize.3
cdirect/cdirect.c
cdirect/cdirect.h
direct/DIRect.c
direct/DIRparallel.c
direct/DIRserial.c
direct/DIRsubrout.c
direct/direct-internal.h
direct/direct.h
direct/direct_wrap.c
direct/tstc.c
octave/nlopt_minimize.cc
praxis/praxis.c
stogo/global.cc
stogo/local.cc
stogo/stogo.cc
stogo/stogo.h
stogo/tools.cc
stogo/tools.h
stogo/tstc.c
subplex/subplex.c
subplex/subplex.h
test/testfuncs.h
test/testopt.cpp
util/nlopt-util.h
util/stop.c

index f3c88deffb5982985de77a5246dbe8b43a857647..667a5b1bd974449b615408a6602dd1167a70cd68 100644 (file)
@@ -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);
      }
index 50380621f2034f04935fa90e8babd8797a075f83..8045cb651293b60cd8dbdfaab344a2c81a3f0462 100644 (file)
@@ -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);
 
index a217805ebcca80cb56fed18cc9715764b55e2f22..c490f564640a42a42014f1bee17f6948eff5d3e4 100644 (file)
@@ -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
index e1d263657a81de6a63af3912c3ebad6f723749a4..755429b40977cbcea44598b90848140ccea14274 100644 (file)
@@ -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)
index 41148a6d72db402ecb7167868549e43ce74444fd..77a0eb6c23215a4b3c5670482079d5c916577d18 100644 (file)
@@ -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,
index 970f3f3b5da849feac2da0577f73b3c508bfd960..3e675e897bf41b4a822c3bb2a04eb50fcfe8f605 100644 (file)
@@ -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)
 /* |     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.                | */
 /* |  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                           | */
 /* |            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 :                                             | */
 /* |              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 :                                                    | */
 /* +-----------------------------------------------------------------------+ */
     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.                                                 | */
 /* +-----------------------------------------------------------------------+ */
 /* | 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)
     } else {
         if (logfile)
              fprintf(logfile, "%d, %d, %g, %g\n", 
-                     tstart-1, numfunc, *fmin, fmax);
+                     tstart-1, numfunc, *minf, fmax);
     }
 /* +-----------------------------------------------------------------------+ */
 /* +-----------------------------------------------------------------------+ */
 /* | 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);
 /* +-----------------------------------------------------------------------+ */
 /* +-----------------------------------------------------------------------+ */
                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)
 /* +-----------------------------------------------------------------------+ */
                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) {
        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      | */
 /* +-----------------------------------------------------------------------+ */
 /* +-----------------------------------------------------------------------+ */
 /* | 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     | */
        }
 /* +-----------------------------------------------------------------------+ */
 /* | 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);
 /* | 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;
        }
 /* +-----------------------------------------------------------------------+ */
 /* +-----------------------------------------------------------------------+ */
        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.                                                    | */
index aba092efe8e18b9ddd93f22262cd859e6bc90ea4..88fb90240295d4856adbb00724e9dfd5d261444f 100644 (file)
@@ -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];
index 60d0a396c8c11d97cadd9d2d650ac0f5600d3cac..fedd644fb1d561106e66035b165c5fb2b9dd316a 100644 (file)
@@ -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)
 {
 /* +-----------------------------------------------------------------------+ */
     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];
index c7743e138e8e55403661c0201af07ecc1e34f151..1fa7892a7815572062590ca94204d65c7db572a7 100644 (file)
@@ -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__], 
index d5a0e66983352c27978990740389d98438b82eac..c9cb6858c0e56bae3845b66164280a8f3b10d4ba 100644 (file)
@@ -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);
index 8b6f916d8e7fee6cdd9814b6110da54b153dd570..f35784389d7a01c3addf6bf24b044099bb1f9815 100644 (file)
@@ -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,
index 3a26838be4a3e21f04ef6ebae568e8e2debdc97b..6e857cd736eb1e83499fbccf1f32391c7fa2b508 100644 (file)
    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,
index 23a161aba56ae67991c5ab5e5287d6d9551c73e3..2d974911fa0885e35d0aeb05142e77e9a28d958d 100644 (file)
@@ -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;
 }
index cc6fd57fe3fcb3549197d0c15d9044b3e4f438a6..678c74db3fe61dd6f0c9e26728e7031064431217 100644 (file)
@@ -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);
 
index b366d272f88417fc4066f34a35425583a5be5ccc..f68e28bc425f8f13e306c5233216bec91d4cc083 100644 (file)
@@ -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_ */
 
index 76fcd14bc65f6979ab8919c9ee9500cc5dec76d2..b27925e53110ca776b70b4f08613a222da33f6a4 100644 (file)
@@ -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=" <<tmpTrial.objval << " FC=" << FC << endl;
@@ -186,8 +186,8 @@ void Global::ReduceOrSubdivide(RTBox box, int axis, RCRVector x_av) {
       }
 
   // Update fbound
-  if (box.fmin < fbound) {
-    fbound=box.fmin ;
+  if (box.minf < fbound) {
+    fbound=box.minf ;
 #ifdef GS_DEBUG
     cout <<"*** Improving fbound, fbound=" << fbound << endl;
 #endif
index 6f506e23df45f5dab41624f823e18096e1427e8e..ccf58029a72fb84f7cdb2b2433fd821f34b413ee 100644 (file)
@@ -95,7 +95,7 @@ int local(Trial &T, TBox &box, TBox &domain, double eps_cl, double *mgr,
   nlopt_result ret = nlopt_minimize(NLOPT_LOCAL_LBFGS, n, f_local, &data,
                                    box.lb.raw_data(), box.ub.raw_data(),
                                    x.raw_data(), &f, 
-                                   stop->fmin_max,
+                                   stop->minf_max,
                                    stop->ftol_rel, stop->ftol_abs,
                                    stop->xtol_rel, stop->xtol_abs,
                                    stop->maxeval - stop->nevals,
index 10bafa4e48e4797a89ff88be989490fd7b55514a..69a4f8d32427fe8b7814e8e1c803bdc9b2999c19 100644 (file)
@@ -28,7 +28,7 @@ public:
 
 int stogo_minimize(int n,
                   objective_func fgrad, void *data,
-                  double *x, double *fmin,
+                  double *x, double *minf,
                   const double *l, const double *u,
 #ifdef NLOPT_UTIL_H
                   nlopt_stopping *stop,
@@ -59,7 +59,7 @@ int stogo_minimize(int n,
   if (Problem.NoMinimizers())
     return 0;
   
-  *fmin = Problem.OneMinimizer(dummyvec);
+  *minf = Problem.OneMinimizer(dummyvec);
   for (int i = 0; i < n; ++i) x[i] = dummyvec(i);
   return 1;
 }
index 9577b5562f9813b9b5e6a366767c0a310998d579..7ca57f30618ecc0b6451c96973dea7cb4fce54e2 100644 (file)
@@ -45,7 +45,7 @@ typedef double (*objective_func)(int n, const double *x, double *grad,
 
    Output:
 
-      fmin: the minimum value of the objective function found
+      minf: the minimum value of the objective function found
 
       x: pointer to array of length n, giving the location of the minimum
 
@@ -55,7 +55,7 @@ typedef double (*objective_func)(int n, const double *x, double *grad,
 
 int stogo_minimize(int n,
                    objective_func fgrad, void *data,
-                   double *x, double *fmin,
+                   double *x, double *minf,
                    const double *l, const double *u,
 #ifdef NLOPT_UTIL_H
                   nlopt_stopping *stop,
index 3def645ae85caab4063ae26d4d9873b534aa825b..773edcea3d7e003b53188831d57e08bb14b10d7d 100644 (file)
@@ -67,17 +67,17 @@ ostream & operator << (ostream & os, const VBox & B) {
 /************************ Trial Box ***********************/
 TBox::TBox() : VBox() {
   // Constructor
-  fmin=DBL_MAX;
+  minf=DBL_MAX;
 }
 
 TBox::TBox(int n) : VBox(n) {
   // Constructor
-  fmin=DBL_MAX;
+  minf=DBL_MAX;
 }
 
 TBox::TBox(RCTBox box) : VBox(box) {
   // Constructor + Copy
-  fmin=box.fmin;
+  minf=box.minf;
   TList=box.TList ;
 }
 
@@ -86,13 +86,13 @@ RCTBox TBox::operator=(RCTBox box) {
   // NB We should 'somehow' use VBox to copy lb and ub
   // Note that assignment operators are _not_ inherited
   lb=box.lb ; ub=box.ub ;
-  fmin=box.fmin ;
+  minf=box.minf ;
   TList=box.TList ;
   return *this ;
 }
 
 double TBox::GetMin() {
-  return fmin;
+  return minf;
 }
 
 bool TBox::EmptyBox() {
@@ -103,8 +103,8 @@ bool TBox::EmptyBox() {
 void TBox::AddTrial(RCTrial T) {
   // Add a Trial to the (back of) TList
   TList.push_back(T) ;
-  if (T.objval<fmin)
-    fmin=T.objval ;
+  if (T.objval<minf)
+    minf=T.objval ;
 }
 
 void TBox::RemoveTrial(Trial &T) {
@@ -133,7 +133,7 @@ void TBox::GetTrial(list<Trial>::const_iterator itr, Trial &T) {
 
 void TBox::ClearBox() {
   TList.erase(TList.begin(), TList.end());
-  fmin=DBL_MAX;
+  minf=DBL_MAX;
 }
 
 bool TBox::CloseToMin(RVector &vec, double *objval, double eps_cl) {
@@ -225,8 +225,8 @@ void TBox::split(RTBox B1, RTBox B2) {
       fm2=min(fm2,(*itr).objval);
     }
   }
-  // Set fmin of B1 and B2
-  B1.fmin=fm1 ; B2.fmin=fm2;
+  // Set minf of B1 and B2
+  B1.minf=fm1 ; B2.minf=fm2;
 }
 
 void TBox::dispTrials() {
@@ -242,7 +242,7 @@ ostream & operator << (ostream & os, const TBox & B) {
   int n=(B.lb).GetLength() ;
   for (int i=0 ; i<n ;i++)
     os << '[' << B.lb(i) << "," << B.ub(i) << "]";
-  os << "   fmin= " << B.fmin << endl;
+  os << "   minf= " << B.minf << endl;
   return os;
 }
 
@@ -392,7 +392,7 @@ bool TBox::Intersection(RCRVector x, RCRVector h, RCRVector z) {
 
 double TBox::LowerBound(double maxgrad) {
 // Lower bound estimation
-  double lb=fmin ;
+  double lb=minf ;
   double f1,f2,est ;
   list<Trial>::const_iterator itr1,itr2 ;
 
index 81d8dc3d39cda90f21e26ad602246740d0e85320..668a5ee101d387cc5ba7f9870a7942c05c68cf15 100644 (file)
@@ -76,7 +76,7 @@ typedef CTBox& RCTBox;
 
 class TBox: public VBox {
 public:
-  double fmin;   // Smallest function value found so far
+  double minf;   // Smallest function value found so far
   list<Trial> TList; // List of trials
 
   TBox();        // Construct a box
@@ -85,7 +85,7 @@ public:
 
   RCTBox operator=(RCTBox);      // assignment operator
 
-  double GetMin();               // Returns 'fmin'
+  double GetMin();               // Returns 'minf'
   bool EmptyBox();               // Returns TRUE if Box contains no trials
   void AddTrial(RCTrial);        // Add a trial to the (back of) box
   void RemoveTrial(Trial &);     // Remove a trial from the (back of) box
@@ -112,7 +112,7 @@ public:
   bool Intersection(RCRVector, RCRVector, RCRVector);
   double LowerBound(double);
 
-  bool operator<(const TBox & x) const {return (fmin>x.fmin);}
+  bool operator<(const TBox & x) const {return (minf>x.minf);}
   friend ostream & operator << (ostream &, const TBox &);
 };
 
index c321b3e363757d5b33eb0efc93de41c280d341e1..d5c66ad40fb24d0ecc73e995ce0dd50ec095ecef 100644 (file)
@@ -30,17 +30,17 @@ int main(int argc, char **argv)
   double x[2], l[2], u[2];
   long int maxits = 0, maxtim = 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 = stogo_minimize(n, tst_obj, NULL, x, &fmin, l, u, maxits, maxtim);
+  info = stogo_minimize(n, tst_obj, NULL, x, &minf, l, u, maxits, maxtim);
 
   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;
 }
index 17867c6b7225d54064be4ef4615a4f42b2463b07..8695508779ea86261564380f4f910503988aeebf 100644 (file)
@@ -1500,7 +1500,7 @@ L40:
        *fx = isubc_1.sfbest;
     }
 L50:
-    if (*fx < stop->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);
index f9f5b2ff8fa6e0157973ed8e3f081e6955903d4e..f6f79abd96412eb1b9be3a92426b850dc4b98947 100644 (file)
@@ -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);
 
index dd3e0f11439d24ea92c4be927510f9239d4929df..63ea3da01a921a84bb9726ea19d2119292886eee 100644 (file)
@@ -14,7 +14,7 @@ typedef struct {
      int has_gradient;
      int n;
      const double *lb, *ub, *xmin;
-     double fmin;
+     double minf;
      const char *name;
 } testfunc;
 
index b93cf29851dec3f29335b97539b33a48151d26ac..63e0fe4eb396a1242af633c76c05d598ae459d30 100644 (file)
@@ -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 <t> : absolute tolerance <t> on x (default: disabled)\n"
          " -f <t> : relative tolerance <t> on f (default: disabled)\n"
          " -F <t> : absolute tolerance <t> on f (default: disabled)\n"
-         " -m <m> : stop when fmin+<m> is reached (default: disabled)\n"
+         " -m <m> : stop when minf+<m> is reached (default: disabled)\n"
          " -i <n> : iterate optimization <n> times (default: 1)\n"
          " -r <s> : use random seed <s> 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;
index ed862d538b45d7a9f97a60c7853af09d592b5665..0061012d806e6b29f03b916b12fc7efc800feb22 100644 (file)
@@ -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;
index 52a9c7876755787da3fc95bbf772bffba3d17154..7c4732e64ae03dcf28faa9b69d2d998d9ae0e1fa 100644 (file)
@@ -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)