A Rust-powered linear programming library for Python.
Project description
Dantzig: A Lightweight, Concise LP Solver
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
- Arbitrarily restricted variables, including completely unrestricted free variables
==
,<=
, and>=
constraints- Both minimization and maximization problems
- SIMD-accelerated linear algebra operations
- Modern Python type-checking
Dantzig is currently beta software. Please help us improve the library by reporting bugs through GitHub issues.
Installation
Dantzig can be installed with pip
pip install dantzig
for Python >=3.10.
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 == Variable
Min == Minimize
Max == Maximize
Var.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
- Built-in support for multidimensional variables and interoperability with
numpy
- More efficient matrix storage, ie. CSR format
- Code profiling to identify and resolve performance bottlenecks
- Support for alternate algorithms beyond simplex
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
Hashes for dantzig-0.1.0-cp310-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09ec8c6d676a1f398d9fc7c8c4ac76ae3b7637c23bc2d832ad684055880479f7 |
|
MD5 | 597e3e1a65ddb7e44819dd8c3f8cfaf8 |
|
BLAKE2b-256 | 548c9b7e5b7c129a811ac0f74de2ac361683b54edaf5b682b429d65640011cf4 |
Hashes for dantzig-0.1.0-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c7fc83c4610491b99584e66f4f90dcb058f65825dcd1647831af312b55f947c |
|
MD5 | 6bc37b537c1ce02726238fd2af1d0318 |
|
BLAKE2b-256 | 590a3dec22ad75e0809e43f090915f4077f3d956e14f930b294bf35c45a98332 |
Hashes for dantzig-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f35998ce2e802960a54e7644ff401d481ccec30f2a3fe1da011aadda64891f84 |
|
MD5 | bba316d448247383e973cfcb305f3d78 |
|
BLAKE2b-256 | 888027b710b067641066e2b9af5c1fb574e6b21a51c3b2f47496ff3842b77462 |
Hashes for dantzig-0.1.0-cp310-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b77353a28bcac12ebca338754be455df5d30861687757e741a9365520807994 |
|
MD5 | b7c75b414639cefe21ed3b2aae75d67f |
|
BLAKE2b-256 | 70fd4b74cae8d685122a7b75cb078eb6890830c2199117e06d83c394ec5f4e0e |