Jeremy Minton About
Options for Global Optimisation in Python
Posted by Jeremy Minton, ,

Implementing global optimisation is not uncommon but is sufficiently complex to not want too roll your own solution, especially for more complex cases like quadratic or mixed integer programming. Fortunately, there are many packages available that provide this implementation and Python has wrappers for most of them. Unfortunately, there doesn’t seem to be a beginners guid for choosing which package to use. That’s what this article intends to provide.

The Options

Solvers

Package Name Commerical Open Source Free Academic Use LP QP QCP MILP MINLP
Gurobi Yes No Yes Yes Yes Yes Yes Yes
Coin-OR No Yes Yes CLP CBC/SYMPHONY CBC/SYMPHONY
CPLEX Yes No Yes Yes Yes Yes Yes MIQP and MIQCP
XPRESS-MP Yes No No Yes Convex No Yes No

Wrappers

Discussion

Speed

While I haven’t conducted, nor will conduct, benchmark tests or speed comparisons between the solvers, there does seem to be evidence that the commercial solvers are considerably faster than the non-commercial solvers and that this is a growing trend1.

My experiences

I have had no reason to not use local/iterative solvers for continous problems. I have also only needed to solve MIP a handful of times and have taken advantage of Gurobi’s free academic license on these occasions. With an understanding of MIP problem formulation, Gurobi’s Python API was easy to implement. The solve times seemed good for medium sized problems and improvements in constraints sometimes produced considerable speed-ups with no additional work. However, I have had to resort to custom heuristics for some of the larger problems as Gurobi would not solve in feasible time and did not produce an adequate solution with premature termination. Despite these occasions, I would recomend Gurobi for anyone who has access to a license.