Closed Seon82 closed 2 years ago
Hi, the issue that you are finding has to do with your problem, and not inherently with MindtPy itself. Your constraints xy <= 10, and objective xy - y are both nonconvex expressions. When you try to solve these problems using the outer-approximation algorithm, it will generate cuts using the 1st order derivative which might (and in your example do) cut the optimal solution depending on where the cuts are generated. The place where such cuts are generated comes from the solution of a local optimal NLP solver (IPOPT) which as you found out is not guaranteed to find the optimal solution to the continuous relaxation (10,1 instead of 0,0). Having said this, we could certainly do better. The fact that y is binary and x non-negative should allow us to construct linear inequalities (based on McCormick envelopes and known as Glover inequalities) which should make it easier (and guaranteed to solve to optimality) by using MindtPy. Let us know if you need helping with the reformulation :)
That was very clear, thanks a lot!
Summary
I'm trying to solve a simple integer non-linear problem using MindtPy, but the solutions returned are far from optimal (Gurobi does find the optimum correctly).
Steps to reproduce the issue
Error Message
Output:
The optimal solution here is obviously
x=10
andy=1
, and notx=0
andy=0
.Information on your system
Pyomo version: 6.1.2 Python version: 3.9.7 Operating system: Linux How Pyomo was installed (PyPI, conda, source): PyPI Solver (if applicable): MindtPy
Additional information
Bounding
x
to 10 withx = pyo.Var(domain=pyo.NonNegativeIntegers, bounds=(0,10))
allows the solver the correctly find the optimal solution, but any more than that (for instance, 20), and it goes back to settingy
to 0.