Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 1.57 KB

File metadata and controls

64 lines (41 loc) · 1.57 KB

Simple Simplex Solver

A minimal Python implementation of the simplex algorithm, intended for academic and teaching purposes.

Installation

No installation is required beyond cloning this repository.
The solver has no external dependencies. Python 3.11 or later is recommended.

git clone https://github.com/bloa/simplex.git
cd simplex

Usage

To try the solver, run it on the provided example problems:

python3 simplex --program examples/test_solved1

You can choose between the big-M (with bigm, the default) and the Two-Phase (twophase) methods using --solver. You can choose between a tableau-based (with tableau, compact, tableau_alt, or compact_alt) or dictionary-based (with dict, the default) representation using --method. For example:

python3 simplex --program examples/test_solved6 --solver twophase --method tableau

You can construct and solve the dual program using --to_dual, or construct and solve the primal program using --to_dual. In all cases, resolution will always follow the "primal" Simplex algorithm.

Finally, LaTeX formatting is supported through the --latex option:

python3 simplex --program examples/test_solved4 --method compact --latex

In doubt, consult the help message:

python3 simplex --help

Testing

Run the test suite with pytest:

pytest

Contributions

Contributions are welcome via pull requests.

Planned improvements include:

  • interactive mode for selecting pivots
  • integer constraint support through branch and bound