On Tuesday, June 23, 2015 at 2:06:29 PM UTC-4, Nils Gudat wrote:
>
> function objective(parameters::Array{Float64,1}, obs=observations,
> wgt=weight)
>
As described in the NLopt documentation, this is the wrong form for your
objective function. NLopt expects a function like objective(params, grad),
where it passes an empty array for grad when you use a derivative-free
optimization algorithm (like ESCH) or in general when the gradient is not
needed.
So, NLopt is calling your objective function and passing an empty array for
your second argument (obs), and apparently your function always returns 0.0
when the second argument is empty.
(You can also try just inserting a println statement into your objective
function to see what arguments are being passed.)
Just add a second "grad" argument which is ignored (or throw an exception
if it is nonempty) and you should be okay, I'm guessing.