/pylinprog

linprog in python through pyjulia

Primary LanguagePythonMIT LicenseMIT

pylinprog

This is a proof-of-concept implementation of the linprog function in python. If you find it useful, please submit a PR to help document it and turn it into a real Python package.

Wait, doesn't scipy have linprog?

Yes it does, but it currently only provides a textbook implementation of the dense simplex algorithm, capable of up to thousands of variables and constraints. Most linear programming problems in practice are highly sparse and may have millions of variables and constraints. This linprog implementation exposes state-of-the-art open-source and commercial solvers.

How does it work?

The implementation provides a thin wrapper around the MathProgBase library in Julia which provides links to tons of solvers. Consequently, to use pylinprog, you need to have an installation of Julia and the experimental pyjulia package.

How do I use it?

The signature of linprog mostly matches that of scipy's linprog, with a special solver parameter to let you switch solvers. Scipy sparse matrices are accepted as coefficient matrices. See example.py.