ppulp
P(retty)PuLP is an extension of PuLP, linear programming problem modeling tool.
You can use the basic features of pulp plus the following useful extensions to make modeling simpler.
Install
PyPI
pip install ppulp
GitHub
git clone https://github.com/nariaki3551/ppulp.git
Features
- Variable product
- If-then constraints
- Absolute values
- Piecewise linear approximation of nonlinear functions
- Logical operations (And, Or, Xor)
- Reduction (Sum, Prod)
Examples
Variables productions
# from pulp import *
from ppulp import *
# create variables
x = LpVariable("x", cat="Binary")
y = LpVariable("y", cat="Binary")
# create variable production
z = x * y
If-then constriant
from ppulp import *
x = LpVariable("x", lowBound=-1)
y = LpVariable("y", lowBound=-1)
prob = LpProblem(sense="Minimize")
# add if-then constraints
prob += (x <= 0) >> (y >= 0) # if (x <= 0) then (y >= 0)
prob += (y <= 0) >> (x >= 0) # if (y <= 0) then (x >= 0)
Absolution value
x = LpVariable("x")
y = LpVariable("y")
Abs(x+y)
Approximation of nonlinear functions
from ppulp import *
import math
x = LpVariable("x", lowBound=3)
y = LpVariable("y", lowBound=4)
# create non-linear function
f = PiecewiseLinear(math.log, xl=7, xu=100, num=3)
prob = LpProblem()
prob += f(x + y)
prob += f(x) >= 10
Reduction
from ppulp import *
x = [LpVariable(name=f"x{i}", ini_value=2) for i in range(5)]
# summation
lpSum(x)
# production
lpProd(x)
Metadata
Release files for ppulp 0.1.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 | |
|---|---|---|---|---|
| ppulp-0.1.0.tar.gz | 9.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ppulp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / ppulp-0.1.0.tar.gz
| Download URL | ppulp-0.1.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faa4cc7a38da5b5b5b7ef8e9acf9c988f666b6fabe4da9d981d163c8b19db01a
|
|
BLAKE2b-256 checksum How to use checksums |
84060aaaf36c6825671db0ff646b3566eefb5b857fc516c5e9f58cddaee5c4aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / ppulp-0.1.0-py3-none-any.whl
| Download URL | ppulp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
829935731aa7e46fd3c1a5750bfb4c51480f5f94667bcf22dc519d75760d6ab6
|
|
BLAKE2b-256 checksum How to use checksums |
81f65c9e9f69f223d7cda9a7619c21bb93ba1e48552f4080d687a098d27d32a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Security for ppulp 0.1.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.