Optimising a non-linear user-defined function using NLopt

Make your function accept 2 arguments. Even if the method derivative-free nlopt uses 2 argument objective functions. In your function just ignore the second argument.

function filamentefficiency(A, grad) #Ignore the second argument if method is derivative-free
1 Like