On May 25, 2014, at 11:40 AM, Chong Li <[email protected]> wrote:
>    I am having some difficulties in using NLopt to maximize the likelihood 
> function that takes data as an argument. Only the constraint function in the 
> example in NLopt tutorial has used a data parameter to pass data to the 
> constraint function. Could anyone help me out with some example code on how 
> to deal with this or any general way to do a maximum likelihood estimation 
> with NLopt in C++?

You can use exactly the same technique (passing a pointer to some data 
structure containing your parameters, typecast to/from void*) to pass data to 
the objective function as to the constraints.  (The type signature is the same 
in the two cases.)   This is C style (no fancy functor objects or anything), 
but should work fine in C++ too.

--SGJ


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

Reply via email to