Skip to main content

A JAX-compatible, simplex method-based linear program solver

Project description

linrax

JAX-compatible, simplex method-based linear program solver. As part of the JAX ecosystem, linrax supports

  • JIT compilation,
  • Automatic Differentiability (forward mode only, currently), and
  • GPU parallelization.

linrax is designed for use as a subroutine in a larger JAX pipeline. Its performance excels on smaller problems ($<50$ input variables), and is fully tracable in any of JAX's main transformations. In particular, linrax can solve problems that are specified with linearly dependent constraints, an area where other JAX-based solvers struggle.

Installation

linrax is available on PyPI:

pip install linrax

Hardware Acceleration

linrax supports hardware acceleration via JAX. This package's optional extras cuda12 and cuda13 will enable the use of an nvidia GPU. Alternatively, you may install a JAX acceleration library directly.

# CUDA 12
pip install "jax[cuda12]"

# CUDA 13
pip install "jax[cuda13]"

See the JAX installation guide for further details.

Usage

The interface of linrax is designed to closely mimic that of scipy.linprog. The public function is

import jax
import jax.numpy as jnp
@partial(jax.jit, static_argnames=[ "unbounded"])
def linprog(
    c: jax.Array,
    A_ub: jax.Array = jnp.empty((0, 0)),
    b_ub: jax.Array = jnp.empty((0,)),
    A_eq: jax.Array = jnp.empty((0, 0)),
    b_eq: jax.Array = jnp.empty((0,)),
    unbounded: bool = False,
) -> Tuple[SimplexStep, SimplexSolutionType]:
    ...

The SimplexSolutionType contains fields indicating if the problem is feasible or bounded, and a success property to check both simultaneously. Assuming the problem has solutions, the SimplexStep object describes this solution. In particular, the fields x and fun retrieve the optimal point and objective value, respectively.

Citing

If linrax is useful or relevant to your work, please cite the corresponding paper with this bibtex entry.

@misc{gould2025linraxjaxcompatiblesimplex,
      title={linrax: A JAX Compatible, Simplex Method Linear Program Solver},
      author={Brendan Gould and Akash Harapanahalli and Samuel Coogan},
      year={2025},
      eprint={2509.19484},
      archivePrefix={arXiv},
      primaryClass={eess.SY},
      url={https://arxiv.org/abs/2509.19484},
}

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

linrax-0.3.0.tar.gz (105.9 kB view details)

Uploaded Source

Built Distribution

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

linrax-0.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file linrax-0.3.0.tar.gz.

File metadata

  • Download URL: linrax-0.3.0.tar.gz
  • Upload date:
  • Size: 105.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for linrax-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7c36334ae28ea59afffc6de03470c66c335d7a1f7ee5ac9a1ab8d73558a4bb62
MD5 76a79ae69a7e6b7027d6b35a8cffb90a
BLAKE2b-256 8b2a001d6ecf4993d6cc47792e22d31a6ea0e72b7abb04899dd84c411c9624dd

See more details on using hashes here.

File details

Details for the file linrax-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: linrax-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for linrax-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0185c8a561153e4f9f3d8e2e5ba1e6c9304442f4aaeee4e15558052e8cb3dc04
MD5 3345ce1cc055f928d0ca73f214030864
BLAKE2b-256 e4590fa70ea13c29bb675b324e1cf506c3123d76719715a1e851ad007d7dc9c8

See more details on using hashes here.

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