chiark / gitweb /
got MIT-license permission from K. Madsen, author of StooGO
[nlopt.git] / stogo / stogo.h
1 /* A C-callable front-end to the StoGO global-optimization library.
2    -- Steven G. Johnson   */
3
4 #ifndef STOGO_H
5 #define STOGO_H
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 typedef double (*objective_func)(int n, const double *x, double *grad,
12                                  void *data);
13
14 /* search for the global minimum of the function fgrad(n, x, grad, data)
15    inside a simple n-dimensional hyperrectangle.
16
17    Input:
18
19        n: dimension of search space (number of decision variables)
20
21        fgrad: the objective function of the form fgrad(n, x, grad, data),
22               returning the objective function at x, where
23                  n: dimension of search space
24                  x: pointer to array of length n, point to evaluate
25                  grad: if non-NULL, an array of length n which
26                        should on return be the gradient d(fgrad)/dx
27                        [ if NULL, grad should be ignored ]
28                  data: arbitrary data pointer, whose value is the
29                        data argument of stogo_minimize
30
31        data: arbitrary pointer to any auxiliary data needed by fgrad
32
33        l, u: arrays of length n giving the lower and upper bounds of the
34              search space
35
36        maxeval: if nonzero, a maximum number of fgrad evaluations
37
38        maxtime: if nonzero, a maximum time (in seconds)
39
40    Output:
41
42       fmin: the minimum value of the objective function found
43
44       x: pointer to array of length n, giving the location of the minimum
45
46    Return value: 0 if no minimum found, 1 otherwise.
47
48  */
49
50 int stogo_minimize(int n,
51                    objective_func fgrad, void *data,
52                    double *x, double *fmin,
53                    const double *l, const double *u,
54                    long int maxeval, double maxtime);
55
56 extern int stogo_verbose; /* set to nonzero for verbose output */
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif