*/
#include <stdlib.h>
+#include <string.h>
#include "nlopt.h"
#include <math.h>
#include <float.h>
-#include "nlopt.h"
-#include "nlopt-util.h"
+#include "nlopt-internal.h"
/*************************************************************************/
nlopt_init_genrand(seed);
}
-void nlopt_srand_time() {
+void nlopt_srand_time(void) {
nlopt_srand(nlopt_time_seed() + my_gettid() * 314159);
}
-void nlopt_srand_time_default() {
+void nlopt_srand_time_default(void) {
if (!nlopt_srand_called) nlopt_srand_time();
}
};
/*********************************************************************/
-void nlopt_srand_time_default(void); /* init the rand. seed only if unset */
+extern void nlopt_srand_time_default(void); /* init the rand. seed only if unset */
/*********************************************************************/
/* global defaults set by deprecated API: */
nbd[i] = linf && uinf ? 0 : (uinf ? 1 : (linf ? 3 : 2));
}
iret = lbfgsb_minimize(ni, f, f_data, x, nbd, lb, ub,
- MIN(ni, 5), 0.0, stop.ftol_rel,
+ ni < 5 ? ni : 5, 0.0, stop.ftol_rel,
stop.xtol_abs[0] > 0 ? stop.xtol_abs[0]
: stop.xtol_rel,
stop.maxeval);
return LS_Old ;
}
-#ifdef NLOPT_H
+#if 0
if (axis != -1) {
cout << "NLopt code only works with axis == -1, exiting...\n" ;
switch (which) {
case GRADIENT_ONLY:
case OBJECTIVE_AND_GRADIENT:
- return my_func(xy.GetLength(), xy.raw_data_const(), grad.raw_data(), my_data);
+ return my_func((unsigned) xy.GetLength(), xy.raw_data_const(), grad.raw_data(), my_data);
case OBJECTIVE_ONLY:
- return my_func(xy.GetLength(), xy.raw_data_const(), NULL, my_data);
+ return my_func((unsigned) xy.GetLength(), xy.raw_data_const(), NULL, my_data);
}
return 0.0;
}
extern "C" {
#endif
-typedef double (*objective_func)(int n, const double *x, double *grad,
+typedef double (*objective_func)(unsigned n, const double *x, double *grad,
void *data);
/* search for the global minimum of the function fgrad(n, x, grad, data)