simplex_codes is a small Python package that collects a few simplex-based linear programming routines in a cleaner, reusable repository layout.
The project is intentionally lightweight and GitHub-focused: it is installable, tested, and documented, but still close to the original academic implementations.
- Primal simplex
- Dual simplex
- Revised simplex
- Big-M method
Core package:
python -m pip install -e .Optional visualization helpers:
python -m pip install -e ".[viz]"from simplex_codes import simplex
result = simplex(
c=[-8, -5, 0, 0],
A=[
[1, 1, 1, 0],
[9, 5, 0, 1],
],
b=[6, 45],
sense="max",
)
print(result.solution)
print(result.objective_value)
print(result.iterations)The solvers currently expect coefficient arrays in tableau-friendly form.
cmust include every variable coefficient already aligned with the constraint matrix columns.- Slack, surplus, or artificial variable columns should already be present in
Aandc. - For
big_m_method, artificial variables are assumed to be the lastartificial_countcolumns inA.
This keeps the implementations close to the original project and makes the examples easy to compare.
Runnable examples live in examples/:
simplex_example.pydual_simplex_example.pyrevised_simplex_example.pybig_m_example.pysimplex_visualization.py
.
├── .github/workflows/
├── examples/
├── src/simplex_codes/
└── tests/
- Inputs are assumed to already be in a canonical matrix form.
- The implementations are educational and do not yet cover every degeneracy or infeasibility edge case.
- The visualization helper is only designed for 2D simplex paths.
Run the test suite:
python -m pytestIf you are working in an offline environment with the required build tools already installed, use:
python -m pip install --no-build-isolation -e .