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