Hi
I am using NLOPT with two inequality constraints. It can do the optmization when I suppress the second constraint but with two constraints it stops after 1st iteration with forced stop. I also run objective function and constraints out of the Nlopt and they are fine. do you have any idea on this issue? NLopt can handle two constraints or not?
function gf_p_optimize(p_init; r, β, η, TOL=1e-4, MAX_ITER, fem_params)
opt = Opt(:LD_MMA, fem_params.np)
opt.lower_bounds = 1e-5
opt.upper_bounds = 1
opt.xtol_rel = TOL
opt.maxeval = MAX_ITER
iteration_counter = 0
iteration_solutions = Any[]
function objective_fn(p0, grad)
iteration_counter += 1
push!(iteration_solutions, p0)
pf_vec = pf_p0(iteration_solutions[iteration_counter]; r, fem_params)
return gf_p(p0, grad;iteration_counter, r, β, η, fem_params)
end
opt.min_objective = (p0, grad) -> objective_fn(p0, grad)
inequality_constraint!(opt, (p0, gradc) -> cf_p(p0, gradc; r, β, η, fem_params), 1e-8)
inequality_constraint!(opt, (p0, gradw) -> wf_p(p0, gradw; r, β, η, fem_params), 1e-8)
(g_opt, p_opt, ret) = optimize(opt, p_init)
@show numevals = opt.numevals # the number of function evaluations
println("got $g_opt at $p_opt after $numevals iterations (returned $ret)")
return g_opt, p_opt
end