Skip to content

bloa/simplex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple simplex solver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages