Skip to main content

Implementation of simplex algorithm controlled by the primal-dual gap

Project description

Gap controlled Simplex

Test and publish package PyPI - Version PyPI - Python Version PyPI - Downloads License

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

  • pulp compatible 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 --plato and --netlib, so set the one you want to disable to False.

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

gsimplex-0.0.4.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsimplex-0.0.4-py3-none-any.whl (34.6 kB view details)

Uploaded Python 3

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

Hashes for gsimplex-0.0.4.tar.gz
Algorithm Hash digest
SHA256 e44c125fb4bfa5c3da8de58cd8ae87009f54d500fd9d02436124a85fff7975e3
MD5 dd23b7920c3ecfe67aa84c54b8c50fb5
BLAKE2b-256 36f0b9697e732bf139324a2cecb5a50edcd560c32fad345bb1feebc0342ce31e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsimplex-0.0.4.tar.gz:

Publisher: pypi.yml on Richie314/GapControlledSimplex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for gsimplex-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3a39fc5fd70c89a9e2a5eb79c34a515224396da4d4a84f4a5d71d952461d9aa0
MD5 6533cbd85c00a8dc3da04dd064481e8b
BLAKE2b-256 0dcacc8658f4615d7178fba79cfe4184d1d192997b880db45cd6c2eb88572548

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsimplex-0.0.4-py3-none-any.whl:

Publisher: pypi.yml on Richie314/GapControlledSimplex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page