https://github.com/jli0108/simplex
An Implementation of Simplex Method
https://github.com/jli0108/simplex
linear-programming python
Last synced: about 1 year ago
JSON representation
An Implementation of Simplex Method
- Host: GitHub
- URL: https://github.com/jli0108/simplex
- Owner: jli0108
- License: mit
- Created: 2021-09-15T21:12:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-12-04T16:32:49.000Z (over 4 years ago)
- Last Synced: 2025-02-16T17:57:02.461Z (over 1 year ago)
- Topics: linear-programming, python
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simplex
Implementation of Simplex Method in Python
## Notes
This implementation can be used for [canonical or standard form](https://en.wikipedia.org/wiki/Linear_programming).
For now, this implementation avoids degeneracy (by using [Bland's rule](https://en.wikipedia.org/wiki/Bland%27s_rule)). I might later modify the implementation to choose the entering variable to be the one with the largest coefficient, then resort to Bland's rule after multiple iterations of degeneracy.
The revised simplex method avoids tableaus but is a bit less readable.
## Requirements
This implementation uses Python and requires [numpy](https://numpy.org/install/).
## Usage
Clone the repository and change into it.
```
$ git clone https://github.com/jli0108/simplex.git
$ cd simplex
```
Modify either `simplex.py` or `revised_simplex.py`.
Modify `maximize` depending on whether you want to solve a maximization or minimiation problem.
Modify the arrays `c`, `A_B`, and `b` with your favorite editor, i.e.
```
$ code simplex.py
```
Run `simplex.py` or `revised_simplex.py` with either `python` or `python3`.