7 #endif /* __cplusplus */
9 typedef double (*nlopt_func)(int n, const double *x,
10 double *gradient, /* NULL if not needed */
14 /* Naming conventions:
17 = global/local derivative/no-derivative optimization,
20 *_RAND algorithms involve some randomization.
22 *_NOSCAL algorithms are *not* scaled to a unit hypercube
23 (i.e. they are sensitive to the units of x)
28 NLOPT_GN_DIRECT_L_RAND,
29 NLOPT_GN_DIRECT_NOSCAL,
30 NLOPT_GN_DIRECT_L_NOSCAL,
31 NLOPT_GN_DIRECT_L_RAND_NOSCAL,
34 NLOPT_GN_ORIG_DIRECT_L,
49 NLOPT_LD_TNEWTON_RESTART,
50 NLOPT_LD_TNEWTON_PRECOND,
51 NLOPT_LD_TNEWTON_PRECOND_RESTART,
60 NLOPT_NUM_ALGORITHMS /* not an algorithm, just the number of them */
63 extern const char *nlopt_algorithm_name(nlopt_algorithm a);
66 NLOPT_FAILURE = -1, /* generic failure code */
67 NLOPT_INVALID_ARGS = -2,
68 NLOPT_OUT_OF_MEMORY = -3,
70 NLOPT_SUCCESS = 1, /* generic success code */
71 NLOPT_MINF_MAX_REACHED = 2,
72 NLOPT_FTOL_REACHED = 3,
73 NLOPT_XTOL_REACHED = 4,
74 NLOPT_MAXEVAL_REACHED = 5,
75 NLOPT_MAXTIME_REACHED = 6
78 extern nlopt_result nlopt_minimize(
79 nlopt_algorithm algorithm,
80 int n, nlopt_func f, void *f_data,
81 const double *lb, const double *ub, /* bounds */
82 double *x, /* in: initial guess, out: minimizer */
83 double *minf, /* out: minimum */
84 double minf_max, double ftol_rel, double ftol_abs,
85 double xtol_rel, const double *xtol_abs,
86 int maxeval, double maxtime);
88 extern void nlopt_srand(unsigned long seed);
89 extern void nlopt_srand_time(void);
91 extern void nlopt_version(int *major, int *minor, int *bugfix);
93 extern void nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
94 nlopt_algorithm *nonderiv,
96 extern void nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
97 nlopt_algorithm nonderiv,
102 #endif /* __cplusplus */