7 #endif /* __cplusplus */
9 typedef double (*nlopt_func)(int n, const double *x,
10 double *gradient, /* NULL if not needed */
14 /* non-gradient algorithms */
15 NLOPT_GLOBAL_DIRECT = 0,
16 NLOPT_GLOBAL_DIRECT_L,
19 /* gradient-based algorithms */
23 NLOPT_NUM_ALGORITHMS /* not an algorithm, just the number of them */
26 extern const char *nlopt_algorithm_name(nlopt_algorithm a);
29 NLOPT_FAILURE = -1, /* generic failure code */
30 NLOPT_INVALID_ARGS = -2,
31 NLOPT_OUT_OF_MEMORY = -3,
33 NLOPT_SUCCESS = 1, /* generic success code */
34 NLOPT_FMIN_MAX_REACHED = 2,
35 NLOPT_FTOL_REACHED = 3,
36 NLOPT_XTOL_REACHED = 4,
37 NLOPT_MAXEVAL_REACHED = 5,
38 NLOPT_MAXTIME_REACHED = 6
41 extern nlopt_result nlopt_minimize(
42 nlopt_algorithm algorithm,
43 int n, nlopt_func f, void *f_data,
44 const double *lb, const double *ub, /* bounds */
45 double *x, /* in: initial guess, out: minimizer */
46 double *fmin, /* out: minimum */
47 double fmin_max, double ftol_rel, double ftol_abs,
48 double xtol_rel, const double *xtol_abs,
49 int maxeval, double maxtime);
53 #endif /* __cplusplus */