-/* 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
#include <stddef.h> /* for ptrdiff_t and size_t */
-/* use stdcall convention under Windows, since this seems to
- be more standard there and is important for calling from .NET */
-#if defined(_WIN32) || defined(__WIN32__)
+/* Change 0 to 1 to use stdcall convention under Win32 */
+#if 0 && (defined(_WIN32) || defined(__WIN32__))
# if defined(__GNUC__)
# define NLOPT_STDCALL __attribute__((stdcall))
# elif defined(_MSC_VER) || defined(_ICC) || defined(_STDCALL_SUPPORTED)
double *gradient, /* NULL if not needed */
void *func_data);
+/* A preconditioner, which preconditions v at x to return vpre.
+ (The meaning of "preconditioning" is algorithm-dependent.) */
+typedef void (*nlopt_precond)(unsigned n, const double *x, const double *v,
+ double *vpre, void *data);
+
typedef enum {
/* Naming conventions:
NLOPT_LD_SLSQP,
+ NLOPT_LD_CCSAQ,
+
+ NLOPT_GN_ESCH,
+
NLOPT_NUM_ALGORITHMS /* not an algorithm, just the number of them */
} nlopt_algorithm;
NLOPT_EXTERN(nlopt_result) nlopt_set_max_objective(nlopt_opt opt, nlopt_func f,
void *f_data);
+NLOPT_EXTERN(nlopt_result) nlopt_set_precond_min_objective(nlopt_opt opt, nlopt_func f, nlopt_precond pre, void *f_data);
+NLOPT_EXTERN(nlopt_result) nlopt_set_precond_max_objective(nlopt_opt opt, nlopt_func f, nlopt_precond pre, void *f_data);
+
NLOPT_EXTERN(nlopt_algorithm) nlopt_get_algorithm(const nlopt_opt opt);
NLOPT_EXTERN(unsigned) nlopt_get_dimension(const nlopt_opt opt);
+NLOPT_EXTERN(const char*) nlopt_get_errmsg(nlopt_opt opt);
+
/* constraints: */
NLOPT_EXTERN(nlopt_result) nlopt_set_lower_bounds(nlopt_opt opt,
nlopt_func fc,
void *fc_data,
double tol);
+NLOPT_EXTERN(nlopt_result) nlopt_add_precond_inequality_constraint(
+ nlopt_opt opt, nlopt_func fc, nlopt_precond pre, void *fc_data,
+ double tol);
NLOPT_EXTERN(nlopt_result) nlopt_add_inequality_mconstraint(nlopt_opt opt,
unsigned m,
nlopt_mfunc fc,
nlopt_func h,
void *h_data,
double tol);
+NLOPT_EXTERN(nlopt_result) nlopt_add_precond_equality_constraint(
+ nlopt_opt opt, nlopt_func h, nlopt_precond pre, void *h_data,
+ double tol);
NLOPT_EXTERN(nlopt_result) nlopt_add_equality_mconstraint(nlopt_opt opt,
unsigned m,
nlopt_mfunc h,
NLOPT_EXTERN(nlopt_result) nlopt_set_population(nlopt_opt opt, unsigned pop);
NLOPT_EXTERN(unsigned) nlopt_get_population(const nlopt_opt opt);
-NLOPT_EXTERN(nlopt_result) nlopt_set_subspace_dim(nlopt_opt opt, unsigned dim);
-NLOPT_EXTERN(unsigned) nlopt_get_subspace_dim(const nlopt_opt opt);
+NLOPT_EXTERN(nlopt_result) nlopt_set_vector_storage(nlopt_opt opt, unsigned dim);
+NLOPT_EXTERN(unsigned) nlopt_get_vector_storage(const nlopt_opt opt);
NLOPT_EXTERN(nlopt_result) nlopt_set_default_initial_step(nlopt_opt opt,
const double *x);
NLOPT_EXTERN(void) nlopt_set_munge(nlopt_opt opt,
nlopt_munge munge_on_destroy,
nlopt_munge munge_on_copy);
+typedef void* (*nlopt_munge2)(void *p, void *data);
+NLOPT_EXTERN(void) nlopt_munge_data(nlopt_opt opt,
+ nlopt_munge2 munge, void *data);
/*************************** DEPRECATED API **************************/
/* The new "object-oriented" API is preferred, since it allows us to