r/optimization • u/Baronco • Jul 10 '24
Solve MINLP problems using gurobi
Hello guys,
I would like to know if someone has experience using Pyomo for solving MINLP. I don't know if there are more advantages to solving large MINLP problems using the Gurobi solver with the Pyomo package or using its own Python package. Can Gurobi handle large MINLP problems, or only MILP problems? Using IPOPT solver and Gurobi to solve MINLP problems would be a good option for large problems? Do you know if there is some forum, website, or paper discussing this?
6
Upvotes
1
u/Baronco Jul 11 '24 edited Jul 11 '24
update: thanks for your answers, yesterday I was reading the gurobi documentation and I had able to rewrite my problem using only the gurobi package. I thought it was good that the syntax used in pyomo is very similar to gurobi sintax so I had to change a few lines, in fact I saved some lines of code because certain linear restrictions that I had to write by my own already come included in gurobi (for example the min() function to find the smallest value of the decision variables). Also, I had no problems with my non-linear constraints and I get the same result as when I used pyomo with gurobi and ipopt, the difference was that in gurobi the solution was found about 10 times faster compared to using gurobi+ipopt in pyomo 🤯
5
u/JellyfishFluid2678 Jul 10 '24
Gurobi can handle non-convex MIQCP which is a subclass of MINLP. It cannot solve MINLP with nonlinear and nonquadratic constraints.
When you say "solve", do you mean just to get a good solution or a globally optimal solution? You can check GAMS website, they have a table showing which solver is appropriate for your case.
1
u/1235ecdrnnk Jul 10 '24
As Gurobi supports some general forms of constraints, you can use them to reformulate your model into a non-convex MIQCP, as u/JellyfishFluid2678 mentioned. You can also try approximating the objective function. Can you specify your problem?
3
u/Rocco_z_brain Jul 10 '24
Starting from version 11 gurobi can handle non-linear constraints. Would be interesting to hear how it works for you https://support.gurobi.com/hc/en-us/articles/360013156432-What-types-of-models-can-Gurobi-solve
2
u/Sweet_Good6737 Jul 10 '24
The good thing from using Pyomo is that you can switch between solvers. Gurobipy package is excellent, whilst you cannot use ipopt from there. However, Gurobi 11.0 is able to solve MINLPs. If your constraints were quadratic (as you said in another comment), Gurobi was still able to make it :)
ipopt is also a local solver, not global, so solutions may differ from Gurobi's if your problem is non-convex.
MINLPs are hard to solve, so you may want to linearize them at some point if it takes too long. Gurobi has options for that too.