I am using JuMP to solve a nonlinear optimization problem. If I use ipopt, the solver runs. If I use MAiNGO (GitHub - MAiNGO-github/MAiNGO.jl: A Julia Wrapper to use MAiNGO with JuMP) I get an error:
Minimal (not)working example (rubbish, I don’t even know if it has a solution):
using JuMP, MAiNGO
m = Model(optimizer_with_attributes(MAiNGO.Optimizer, "epsilonA"=> 1e-4))
xL = -100.0
xU = 100.0
AA = [3.0 0.0; 0.0 0.0]
@variable(m, xL.<= x[i=1:2] .<= xU)
# Define nonlinear constraints
@expression(m, e1, AA*x.*x[1])
@expression(m, e2, [x'*e1; 2*transpose(x)*e1] )
@constraint(m, c3, e2.<= 1.0)
# Define nonlinear objective
@objective(m, Min, x[1]^2+x[2]^2)
println(m)
@show c3
# Solve the optimization problem
JuMP.optimize!(m)
The constraint c3 with the problematic (0)
:
Debugging got me to line 190 in MOI_wrapper.jl
and local variables:
where we see that x[2]*(0)
became x[2] *+()
that, I suppose, leads to the error.
It isn’t a problem of MAiNGO installation because if I replace @expression(m, e1, AA*x.*x[1])
with @expression(m, e1, x.*x[1])
the solver runs. Given that ipopt runs with the problematic constraint, I suppose the error is somewhere in between JuMP and MAiNGO (MAiNGO.jl?), but I don’t have enough knowledge to figure it out, much less correct it.