A Rust-powered linear programming library for Python.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 dantzig-0.2.0.tar.gz.
File metadata
- Download URL: dantzig-0.2.0.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11eed6f09594754771208039e106f2a6f421fa5359a5a926c3f37ceccd308232
|
|
| MD5 |
3af458149767871510dda010a0c82eec
|
|
| BLAKE2b-256 |
c99963ea4e074f2ec981c24ca89f0a237030a4097322c2ecbb0ba8e08dc099eb
|
File details
Details for the file dantzig-0.2.0-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: dantzig-0.2.0-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 190.2 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef782c7337431c83d7ab7d9f3c7461439a39092d745d929faa579c418c6d7979
|
|
| MD5 |
dc85d50dc7ab218a6a641099cd6ef941
|
|
| BLAKE2b-256 |
609035fafbac89311ecd94b588a98c585c4652e9eff4a540421c56014a4fa79f
|
File details
Details for the file dantzig-0.2.0-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: dantzig-0.2.0-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 263.0 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ee4e1a904c4c7453d3024edd077049b0d717c48c4b40a6831ba18b020ec11cd
|
|
| MD5 |
4c788d3f3bbdafbfaa31f40914cdc4ba
|
|
| BLAKE2b-256 |
e824268b6613d5c1360fa9212bc5a2ff604ac11b56307a269ccfe24bd7565360
|
File details
Details for the file dantzig-0.2.0-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: dantzig-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 237.9 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
933857a39d6f845507065ff6dc1d726e8814a9277306e65ee44eac5fcdf0161d
|
|
| MD5 |
ee0b004ce6b16c0977db95841bcab578
|
|
| BLAKE2b-256 |
aef8f8d3218f72a3b6eaf86d1a9c06b4de5d5f38a107b261cae796c7ce5daa7c
|
File details
Details for the file dantzig-0.2.0-cp310-abi3-macosx_10_7_x86_64.whl.
File metadata
- Download URL: dantzig-0.2.0-cp310-abi3-macosx_10_7_x86_64.whl
- Upload date:
- Size: 253.3 kB
- Tags: CPython 3.10+, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ced931dd395cf3897ec15f4ada631145adb2d19a253335a4d139b32d22941e79
|
|
| MD5 |
c50c4e1aa9f86072f017123d90acde62
|
|
| BLAKE2b-256 |
8e0aa9072351cb824ac83e49d9f54315f3830e89eb816979cdb56b1f9e51e962
|