On Jul 15, 2010, at 8:58 AM, Jürgen Werner wrote:
When using the GN_MLSL algorithm and passing a pointer to a class as f_data in
void nlopt::opt::set_min_objective(nlopt::vfunc f, void* f_data)
I receive the following error at program execution:

Unhandled exception at 0xffffffff in test_mlsl.exe: 0xC0000005: Access violation reading location 0xffffffff.
Call Stack:
test_mlsl.exe!nlopt::opt::free_myfunc_data(void * p=0x7c840c5b) Line 157 + 0x23 bytes C++

Jurgen, thanks for the bug report; I can reproduce your problem on Unix.

I believe that this problem is fixed by the following patch to api/ options.c:

--- old-nlopt_0/api/options.c   2010-07-15 12:10:41.000000000 -0400
+++ new-nlopt_0/api/options.c   2010-07-15 12:10:41.000000000 -0400
@@ -576,6 +576,7 @@
               nlopt_remove_inequality_constraints(opt->local_opt);
               nlopt_remove_equality_constraints(opt->local_opt);
               nlopt_set_min_objective(opt->local_opt, NULL, NULL);
+              nlopt_set_munge(opt->local_opt, NULL, NULL);
               opt->local_opt->force_stop = 0;
          }
          return NLOPT_SUCCESS;

This will be in the next release of NLopt, in a day or two.

Steven
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to