-/* Copyright (c) 2007-2010 Massachusetts Institute of Technology
+/* Copyright (c) 2007-2014 Massachusetts Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
nlopt_algorithm nlopt_local_search_alg_nonderiv = NLOPT_LN_COBYLA;
int nlopt_local_search_maxeval = -1; /* no maximum by default */
-NLOPT_STDCALL
-void nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
+void
+NLOPT_STDCALL nlopt_get_local_search_algorithm(nlopt_algorithm *deriv,
nlopt_algorithm *nonderiv,
int *maxeval)
{
*maxeval = nlopt_local_search_maxeval;
}
-NLOPT_STDCALL
-void nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
+void
+NLOPT_STDCALL nlopt_set_local_search_algorithm(nlopt_algorithm deriv,
nlopt_algorithm nonderiv,
int maxeval)
{
int nlopt_stochastic_population = 0;
-NLOPT_STDCALL
-int nlopt_get_stochastic_population(void) {
+int
+NLOPT_STDCALL nlopt_get_stochastic_population(void) {
return nlopt_stochastic_population; }
-NLOPT_STDCALL
-void nlopt_set_stochastic_population(int pop) {
+void
+NLOPT_STDCALL nlopt_set_stochastic_population(int pop) {
nlopt_stochastic_population = pop <= 0 ? 0 : (unsigned) pop; }
/*************************************************************************/
-NLOPT_STDCALL
-nlopt_result nlopt_minimize_econstrained(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize_econstrained(
nlopt_algorithm algorithm,
int n, nlopt_func_old f, void *f_data,
int m, nlopt_func_old fc, void *fc_data_, ptrdiff_t fc_datum_size,
ret = nlopt_set_xtol_rel(opt, xtol_rel);
if (ret != NLOPT_SUCCESS) { nlopt_destroy(opt); return ret; }
- ret = nlopt_set_xtol_abs(opt, xtol_abs);
+ if (xtol_abs) ret = nlopt_set_xtol_abs(opt, xtol_abs);
if (ret != NLOPT_SUCCESS) { nlopt_destroy(opt); return ret; }
ret = nlopt_set_maxeval(opt, maxeval);
return ret;
}
-NLOPT_STDCALL
-nlopt_result nlopt_minimize_constrained(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize_constrained(
nlopt_algorithm algorithm,
int n, nlopt_func_old f, void *f_data,
int m, nlopt_func_old fc, void *fc_data, ptrdiff_t fc_datum_size,
xtol_rel, xtol_abs, ftol_rel, ftol_abs, maxeval, maxtime);
}
-NLOPT_STDCALL
-nlopt_result nlopt_minimize(
+nlopt_result
+NLOPT_STDCALL nlopt_minimize(
nlopt_algorithm algorithm,
int n, nlopt_func_old f, void *f_data,
const double *lb, const double *ub, /* bounds */