-/* 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
unsigned n; /* the dimension of the problem (immutable) */
nlopt_func f; void *f_data; /* objective function to minimize */
+ nlopt_precond pre; /* optional preconditioner for f (NULL if none) */
int maximize; /* nonzero if we are maximizing, not minimizing */
double *lb, *ub; /* lower and upper bounds (length n) */
nlopt_opt local_opt; /* local optimizer */
unsigned stochastic_population; /* population size for stochastic algs */
double *dx; /* initial step sizes (length n) for nonderivative algs */
+ unsigned vector_storage; /* max subspace dimension (0 for default) */
+
+ void *work; /* algorithm-specific workspace during optimization */
+
+ char *errmsg; /* description of most recent error */
};
/*********************************************************************/
/*********************************************************************/
+#define RETURN_ERR(err, opt, msg) do { \
+ nlopt_set_errmsg(opt, msg); \
+ return err; \
+} while (0)
+
+extern const char *nlopt_set_errmsg(nlopt_opt opt, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
+extern void nlopt_unset_errmsg(nlopt_opt opt);
+
+/*********************************************************************/
+
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */