I have been running a python script for a large linear optimization problem, using scipy optimization package (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html).

Unfortunately, the package has proven to be very slow (>45minutes) for large scale problems (15,000 variables, 25,000 constraints). To circumvent the problem, I have used a hybdrid approach where I set up the problem in Python then call Matlab linprog to solve it. Matlab linprog has a preprocessing feature which reduces the problem dimension significantly. This has the advantage of making the solver much faster (<30 seconds).

Using such hybrid approach has been cumbersome though and I want to move to a full Python-based solution. Would you be able to suggest a good linear program library that runs with Python and present performance similar to Matlab linprog?


1 Answer 1


I had very good results using lpsolve (http://lpsolve.sourceforge.net/5.5/) and its Python bindings. I rewrote the interface to the C code in Cython as the one provided is a bit clunky, but overall it’s a very fast solver. My usual linear problems are up to 5,000 rows by 3,000 columns more or less, and I’m able to set them up, presolve and solve them in about 100 ms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.