https://github.com/nariaki3551/ppulp
An extension PuLP, linear programming modeling tool
https://github.com/nariaki3551/ppulp
constraints mip optimization pulp python solver
Last synced: 8 days ago
JSON representation
An extension PuLP, linear programming modeling tool
- Host: GitHub
- URL: https://github.com/nariaki3551/ppulp
- Owner: nariaki3551
- License: mit
- Created: 2022-09-19T02:13:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-21T12:31:14.000Z (over 1 year ago)
- Last Synced: 2025-07-10T03:13:01.588Z (3 months ago)
- Topics: constraints, mip, optimization, pulp, python, solver
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ppulp
P(retty)PuLP is an extension of PuLP, linear programming problem modeling tool using [flopt](https://github.com/nariaki3551/flopt).
You can use the basic features of pulp and the following useful extensions to make modeling simpler.[document](https://ppulp.readthedocs.io/en/latest/)
[](https://ppulp.readthedocs.io/en/latest/?badge=latest)
[](https://badge.fury.io/py/ppulp)
[](https://opensource.org/licenses/MIT)
## 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
```python
# 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
```python
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
```python
x = LpVariable("x")
y = LpVariable("y")
Abs(x+y)
```### Approximation of nonlinear functions
```python
from ppulp import *
import mathx = 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
```python
from ppulp import *x = [LpVariable(name=f"x{i}", ini_value=2) for i in range(5)]
# summation
lpSum(x)# production
lpProd(x)
```## Learning more
[document](https://ppulp.readthedocs.io/en/latest/)