Implementation of simplex algorithm controlled by the primal-dual gap
Project description
Gap controlled Simplex
gsimplex is a lightweight Python package that implements a simplex solver governed by the primal-dual gap.
It integrates directly with pulp and uses numpy for its linear algebra routines.
The current release supports continuous linear programming problems; mixed-integer support may be added in a future version.
Features
pulpcompatible solver backend- Gap-controlled primal/dual simplex algorithms
- Easy installation from PyPI or source
- Built-in benchmark downloader for Plato and Netlib test sets
Installation
Install from PyPI:
python -m pip install gsimplex
Install from source for local development:
git clone https://github.com/Richie314/GapControlledSimplex.git
cd GapControlledSimplex
python -m pip install -e .
python -m pip install -e .[dev]
Run the test suite with:
python -m pytest
Usage
from pulp import LpVariable, LpProblem, LpMaximize
from gsimplex.solvers import PrimalSimplex
x1 = LpVariable("x1", lowBound=0, upBound=1)
x2 = LpVariable("x2", lowBound=0, upBound=3)
problem = LpProblem("Problem", LpMaximize)
problem += x1 + x2
problem += x1 + x2 <= 2
problem += x1 <= 1
problem += x2 <= 3
problem += x1 >= 0
problem += x2 >= 0
solver = PrimalSimplex()
problem.solve(solver)
print("Optimal value:", problem.objective.value()) # 2.0
print("Solution:", [var.varValue for var in problem.variables()]) # [1.0, 1.0]
Download benchmark problems
This package installs a command-line helper called gsimplex-download-benchmarks.
It downloads the Plato and Netlib benchmark sets into a local directory, so you can test the solver on real LP problems.
By default, benchmark files are saved under the benchmark/ directory in the current working directory. Plato files are stored in benchmark/plato/, and Netlib files are stored in benchmark/netlib/.
Download all benchmarks
gsimplex-download-benchmarks
Download only one benchmark set
gsimplex-download-benchmarks --plato True --netlib False
# or
gsimplex-download-benchmarks --plato False --netlib True
Note: the CLI uses boolean flags for
--platoand--netlib, so set the one you want to disable toFalse.
Change the destination directory
gsimplex-download-benchmarks --dir benchmark
Quiet mode
gsimplex-download-benchmarks --quiet
If you installed the package editable with pip install -e ., the command will be available immediately.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gsimplex-0.0.4.tar.gz.
File metadata
- Download URL: gsimplex-0.0.4.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e44c125fb4bfa5c3da8de58cd8ae87009f54d500fd9d02436124a85fff7975e3
|
|
| MD5 |
dd23b7920c3ecfe67aa84c54b8c50fb5
|
|
| BLAKE2b-256 |
36f0b9697e732bf139324a2cecb5a50edcd560c32fad345bb1feebc0342ce31e
|
Provenance
The following attestation bundles were made for gsimplex-0.0.4.tar.gz:
Publisher:
pypi.yml on Richie314/GapControlledSimplex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gsimplex-0.0.4.tar.gz -
Subject digest:
e44c125fb4bfa5c3da8de58cd8ae87009f54d500fd9d02436124a85fff7975e3 - Sigstore transparency entry: 1518827062
- Sigstore integration time:
-
Permalink:
Richie314/GapControlledSimplex@ca218247629fa91952afe3b96ee74a7b7760f85a -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/Richie314
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@ca218247629fa91952afe3b96ee74a7b7760f85a -
Trigger Event:
release
-
Statement type:
File details
Details for the file gsimplex-0.0.4-py3-none-any.whl.
File metadata
- Download URL: gsimplex-0.0.4-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a39fc5fd70c89a9e2a5eb79c34a515224396da4d4a84f4a5d71d952461d9aa0
|
|
| MD5 |
6533cbd85c00a8dc3da04dd064481e8b
|
|
| BLAKE2b-256 |
0dcacc8658f4615d7178fba79cfe4184d1d192997b880db45cd6c2eb88572548
|
Provenance
The following attestation bundles were made for gsimplex-0.0.4-py3-none-any.whl:
Publisher:
pypi.yml on Richie314/GapControlledSimplex
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gsimplex-0.0.4-py3-none-any.whl -
Subject digest:
3a39fc5fd70c89a9e2a5eb79c34a515224396da4d4a84f4a5d71d952461d9aa0 - Sigstore transparency entry: 1518827132
- Sigstore integration time:
-
Permalink:
Richie314/GapControlledSimplex@ca218247629fa91952afe3b96ee74a7b7760f85a -
Branch / Tag:
refs/tags/v0.0.4 - Owner: https://github.com/Richie314
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@ca218247629fa91952afe3b96ee74a7b7760f85a -
Trigger Event:
release
-
Statement type: