chiark / gitweb /
initial checkin
[nlopt.git] / direct / direct.h
1 #ifndef DIRECT_H
2 #define DIRECT_H
3
4 #include <math.h>
5
6 #ifdef __cplusplus
7 extern "C"
8 {
9 #endif /* __cplusplus */
10
11 typedef double (*direct_objective_func)(int n, const double *x,
12                                         int *undefined_flag, 
13                                         void *data);
14
15 typedef enum {
16      DIRECT_ORIGINAL, DIRECT_GABLONSKY
17 } direct_algorithm;
18
19 typedef enum {
20      DIRECT_INVALID_BOUNDS = -1,
21      DIRECT_MAXFEVAL_TOOBIG = -2,
22      DIRECT_INIT_FAILED = -3,
23      DIRECT_SAMPLEPOINTS_FAILED = -4,
24      DIRECT_SAMPLE_FAILED = -5,
25      DIRECT_MAXFEVAL_EXCEEDED = 1,
26      DIRECT_MAXITER_EXCEEDED = 2,
27      DIRECT_GLOBAL_FOUND = 3,
28      DIRECT_VOLTOL = 4,
29      DIRECT_SIGMATOL = 5,
30
31      DIRECT_OUT_OF_MEMORY = -100,
32      DIRECT_INVALID_ARGS = -101
33 } direct_return_code;
34
35 #define DIRECT_UNKNOWN_FGLOBAL (-HUGE_VAL)
36 #define DIRECT_UNKNOWN_FGLOBAL_RELTOL (0.0)
37
38 extern direct_return_code direct_optimize(
39      direct_objective_func f, void *f_data,
40      int dimension,
41      const double *lower_bounds, const double *upper_bounds,
42
43      double *x, double *fmin, 
44
45      int max_feval, int max_iter,
46      double reltol, double abstol,
47      double volume_reltol, double sigma_reltol,
48
49      double fglobal,
50      double fglobal_reltol,
51
52      FILE *logfile,
53      direct_algorithm algorithm);
54
55 #ifdef __cplusplus
56 }  /* extern "C" */
57 #endif /* __cplusplus */
58
59 #endif /* DIRECT_H */