Dantzig: A Rust-powered LP library for Python
Dantzig is a lightweight and concise linear programming solver suitable for small and large-scale problems alike.
Dantzig is implemented in both Rust and Python, meaning you get the expressiveness and flexibility of a Python frontend plus the raw computing speed of a Rust backend.
Dantzig supports
- A solver featuring a parametric self-dual algorithm
- Arbitrarily restricted variables, including completely unrestricted free variables
==,<=, and>=constraints- Both minimization and maximization problems
- A numerically stable LU factorization with partial pivoting routine for robust linear algebra operations
- Memory-efficient sparse matrix representations
- Modern Python type-checking
:warning: Dantzig is under active development. Please help us improve the library by reporting any issues!.
Installation
Dantzig supports Python 3.10+ and can be installed with pip.
pip install dantzig
Design Philosophies
Dantzig prides itself on being both lightweight (zero-dependency) and concise. The API is designed to be extremely expressive and terse, saving you keystrokes without sacrificing clarity. To this end, Dantzig provides several short aliases for common classes and methods.
A few examples are listed below,
Var == VariableMin == MinimizeMax == MaximizeVar.free() == Variable(lb=0.0, ub=0.0)Var.nn() == Var.nonneg() == Variable(lb=0.0, ub=None)Var.np() == Var.nonpos() == Variable(lb=None, ub=0.0)
Examples
import dantzig as dz
x = dz.Variable(lb=0.0, ub=None)
y = dz.Variable(lb=0.0, ub=None)
z = dz.Variable(lb=0.0, ub=None)
soln = dz.Minimize(x + y - z).subject_to(x + y + z == 1).solve()
assert soln.objective_value == -1.0
assert soln[x] == 0.0
assert soln[y] == 0.0
assert soln[z] == 1.0
Using aliases, the previous example can alternately be written
from dantzig import Min, Var
x = Var.nn()
y = Var.nn()
z = Var.nn()
soln = Min(x + y - z).st(x + y + z == 1)
Road Map
- Mixed integer linear programing (MILP)
- SIMD-accelerated linear algebra operations
- General optimizations to make the library competitive with
ortools
Metadata
Release files for dantzig 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dantzig-0.2.0.tar.gz | 2.1 MB | Without provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| dantzig-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| dantzig-0.2.0-cp310-abi3-manylinux_2_34_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| dantzig-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| dantzig-0.2.0-cp310-abi3-macosx_10_7_x86_64.whl | CPython 3.10 | abi3 | macOS 10.7+ x86-64 | Details |
Total release size: 3.1 MB
Release files / dantzig-0.2.0.tar.gz
| Download URL | dantzig-0.2.0.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11eed6f09594754771208039e106f2a6f421fa5359a5a926c3f37ceccd308232
|
|
BLAKE2b-256 checksum How to use checksums |
c99963ea4e074f2ec981c24ca89f0a237030a4097322c2ecbb0ba8e08dc099eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.7
|
Release files / dantzig-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | dantzig-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 190.2 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ef782c7337431c83d7ab7d9f3c7461439a39092d745d929faa579c418c6d7979
|
|
BLAKE2b-256 checksum How to use checksums |
609035fafbac89311ecd94b588a98c585c4652e9eff4a540421c56014a4fa79f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.7
|
Release files / dantzig-0.2.0-cp310-abi3-manylinux_2_34_x86_64.whl
| Download URL | dantzig-0.2.0-cp310-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 263.0 kB |
| Tags | CPython 3.10 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6ee4e1a904c4c7453d3024edd077049b0d717c48c4b40a6831ba18b020ec11cd
|
|
BLAKE2b-256 checksum How to use checksums |
e824268b6613d5c1360fa9212bc5a2ff604ac11b56307a269ccfe24bd7565360
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.7
|
Release files / dantzig-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | dantzig-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 237.9 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
933857a39d6f845507065ff6dc1d726e8814a9277306e65ee44eac5fcdf0161d
|
|
BLAKE2b-256 checksum How to use checksums |
aef8f8d3218f72a3b6eaf86d1a9c06b4de5d5f38a107b261cae796c7ce5daa7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.7
|
Release files / dantzig-0.2.0-cp310-abi3-macosx_10_7_x86_64.whl
| Download URL | dantzig-0.2.0-cp310-abi3-macosx_10_7_x86_64.whl |
|---|---|
| Size | 253.3 kB |
| Tags | CPython 3.10 abi3 macOS 10.7+ x86-64 |
|
SHA-256 checksum How to use checksums |
ced931dd395cf3897ec15f4ada631145adb2d19a253335a4d139b32d22941e79
|
|
BLAKE2b-256 checksum How to use checksums |
8e0aa9072351cb824ac83e49d9f54315f3830e89eb816979cdb56b1f9e51e962
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.7
|
Security for dantzig 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.