Hi
I am rather new to Julia and I am experimenting with NLopt. I ran the tests on github and they work fine but then I tried my own objective and constraints.
function ps(x,grad)
return x[1]
end
function ps_con(x,grad,w)
f=zeros(2)
f[1]=x[2]^2-1+x[3]
f[2]=-10x[2]^2+0.1x[3]
z=-f+w*x[1]
return z
end
I then followed the same procedure followed in the test examples but with a derivative free optimiser.
opt = Opt(:LN_COBYLA, 3)
opt.lower_bounds = [0, -Inf.-Inf]
opt.upper_bounds = [1,Inf,Inf]
opt.xtol_rel = 1e-4
opt.min_objective = ps
opt.inequality_constraint = (x,g) → ps_con(x,g,[1,1])
(minf,minx,ret) = optimize(opt, [1,1,1])
No error occurs but the optimiser does not do anything and exits with either FORCED_STOP or XTOL_REACHED at the first iteration.
Note that calling the objective and constraint functions individually with random inputs does not produce any error.
What am I doing wrong?
Mx