chiark / gitweb /
support both randomized and deterministic versions of StoGO
authorstevenj <stevenj@alum.mit.edu>
Sat, 25 Aug 2007 04:09:43 +0000 (00:09 -0400)
committerstevenj <stevenj@alum.mit.edu>
Sat, 25 Aug 2007 04:09:43 +0000 (00:09 -0400)
darcs-hash:20070825040943-c8de0-dae271fcbf9097b206b94be55369be426b286935.gz

api/nlopt.c
api/nlopt.h
api/nlopt_minimize.3
stogo/stogo.cc
stogo/stogo.h

index bf7ee9f5ffb6b53961505fcdcba9fbc0fdbcf45d..529c9eb2d057a1c6e17ac0e93314f58a0b75a493 100644 (file)
@@ -44,6 +44,7 @@ static const char nlopt_algorithm_names[NLOPT_NUM_ALGORITHMS][128] = {
      "DIRECT-L (global)",
      "Subplex (local)",
      "StoGO (global)",
+     "StoGO with randomized search (global)",
      "Low-storage BFGS (LBFGS) (local)"
 };
 
@@ -180,8 +181,11 @@ static nlopt_result nlopt_minimize_(
              break;
 
         case NLOPT_GLOBAL_STOGO:
+        case NLOPT_GLOBAL_STOGO_RANDOMIZED:
              if (!stogo_minimize(n, f, f_data, x, fmin, lb, ub,
-                                 maxeval, maxtime))
+                                 maxeval, maxtime,
+                                 algorithm == NLOPT_GLOBAL_STOGO
+                                 ? 0 : 2*n))
                   return NLOPT_FAILURE;
              break;
 
index abbe1a4dde9705fdef0d8f0cdeb6281ae5f1942f..2188991d1c640f8d6eebd3170f487850238ce41e 100644 (file)
@@ -18,6 +18,7 @@ typedef enum {
 
      /* gradient-based algorithms */
      NLOPT_GLOBAL_STOGO,
+     NLOPT_GLOBAL_STOGO_RANDOMIZED,
      NLOPT_LOCAL_LBFGS,
 
      NLOPT_NUM_ALGORITHMS /* not an algorithm, just the number of them */
index b8b59c0eb573eed79d2fa27c9f9f628eb9481514..312b658fe14a742029542e3d9c37a86c32729ff2 100644 (file)
@@ -201,8 +201,12 @@ as well as nonlinear constraints as described above).
 Global optimization using the StoGO algorithm by Madsen et al.  StoGO
 exploits gradient information (which must be supplied by the
 objective) for its local searches, and performs the global search by a
-stochastic branch-and-bound technique.  Only bound-constrained optimization
+branch-and-bound technique.  Only bound-constrained optimization
 is supported.
+.TP 
+.B NLOPT_GLOBAL_STOGO_RANDOMIZED
+As above, but uses randomized starting points for the local searches
+(which is sometimes better, often worse than the deterministic version).
 .TP
 .B NLOPT_LOCAL_LBFGS
 Local gradient-based optimization using the low-storage BFGS (L-BFGS)
index 97b0db352d38dea968607a8bfbe5f3939154d9b2..13908376ad5f9a84e14d0774186a08c4ebdfb1a5 100644 (file)
@@ -30,12 +30,14 @@ int stogo_minimize(int n,
                   objective_func fgrad, void *data,
                   double *x, double *fmin,
                   const double *l, const double *u,
-                  long int maxeval, double maxtime)
+                  long int maxeval, double maxtime,
+                  int nrandom)
 {
   GlobalParams params;
 
   // FIXME: WTF do these parameters mean?
-  params.det_pnts=2*n+1; params.rnd_pnts=0;
+  params.rnd_pnts=nrandom;
+  params.det_pnts=2*n+1 - nrandom; 
   params.eps_cl=0.1; params.rshift=0.3;
   params.mu=1.0E-4;
 
index 4ae727e14c7afcda1c4271648ac2c1e072e86f0f..c5cd6d2a6a5540032c87953db7a229c7db12c42f 100644 (file)
@@ -37,6 +37,10 @@ typedef double (*objective_func)(int n, const double *x, double *grad,
 
        maxtime: if nonzero, a maximum time (in seconds)
 
+       nrandom: number of randomized search points to use per box,
+                in addition to 2*n+1 deterministic search points
+               (0 for a deterministic algorithm).
+
    Output:
 
       fmin: the minimum value of the objective function found
@@ -51,7 +55,8 @@ int stogo_minimize(int n,
                    objective_func fgrad, void *data,
                    double *x, double *fmin,
                    const double *l, const double *u,
-                   long int maxeval, double maxtime);
+                   long int maxeval, double maxtime,
+                  int nrandom);
 
 extern int stogo_verbose; /* set to nonzero for verbose output */