I'm looking for an existing implementation of the simplex method (simplex method) to solve a linear programming problem for some reason. For those who are weak and don't want to read OSS solvers (COIN-OR CLP, GLPK, etc.) that have been slammed in C / C ++. Write a note that this is a relatively credible Python implementation. It is not a simplex method of Nelder-Mead.
scipy.optimize.linprog https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.optimize.linprog.html scipy is a well-known library for math in Python A relatively recent Python implementation of the simplex method has been added.
Numerical calculation packages in the LL language usually provide methods for solving optimization problems, but I think that the content is often just a binding of an existing solver. It's nice to have a pure Python implementation. It's a library with a lot of users, and there is test code, so when it comes to a pure implementation in the LL language, I think it's probably about this.
cylp https://github.com/coin-or/CyLP This is not a Python implementation of the simplex method, A library that allows you to customize solvers written in C ++ called CLP and CBC with Python. The detailed design is described in this paper.
If you just want to implement the oleore pivot rule, you can use it to achieve both calculation speed and simplicity. Pivot rules can be anything, but even if you have a callback function that you want to call for each iteration of the simplex method, you can do it with cylp.
If you read around Implementation of Dantzig rules, you'll know, PivotPythonBase
You can run the simple method of the oleore pivot rule by implementing some interfaces of.
Also, if you look at https://github.com/coin-or/CyLP/blob/master/cylp/py/pivots/, you will find implementations of various pivot rules, so you can study.
At the time of my confirmation, the transition to Python 3 series has not been done yet, but I'm coming to the pull request, so that branch If you use, you may be able to use cylp with Python3.
Recommended Posts