I am working on an optimization problem and build a model using Gurobi Optimizer with JuMP. It has some nonlinear constraints: @constraint(model, f[i] + func(qe[i])<= M1 * (1 - x[(i, j)]) + f[j])
where f, qe, x are nonnegative variables, and func is a function:
function func(q)
return (10 + q)^(3 / 2)
end
The weird thing is that it worked before today. I reinstalled julia, ran it and got an error:
Constraints of type MathOptInterface.ScalarNonlinearFunction-in-MathOptInterface.LessThan{Float64} are not supported by the solver.
Test with the solver to Ipopt.Optimizer, got this:
ERROR: MathOptInterface.UnsupportedConstraint{MathOptInterface.VariableIndex, MathOptInterface.ZeroOne}(“”)
Ipopt does not support binary variables (x[(i, j)]). Why do you not write the polynomial function func within the constraint instead of defining a function?
It works! Thank you!
(However, it did work several days ago with Gurobi 9.5.2, after I reinstalled julia and JuMP, it failed. Maybe because of version incompatibility, but I forgot the old version.)