If I understand your question correctly, the simplest way to do this is to
create a closure via an anonymous function.
function myRealFunc(x::Vector, grad::Vector, param1, param2)
#do something with x, param1 and param2
end
function optimise(param1, param2)
opt = Opt(:LD_MMA, 2)
min_objective!(opt, (x,y)->myRealFunc(x, y, param1, param2)
end
On Tuesday, 24 March 2015 06:34:43 UTC+1, Pooya wrote:
>
> Hi there. In NLopt the method for defining the objective function is
> "function
> myfunc(x::Vector, grad::Vector)", where grad is the gradient. Is there a
> way to pass other inputs to this function so as to use them to evaluate the
> objective function or the gradient? If not, what is the work around
> solution? Thanks.
>