Skip to main content

An extension of PuLP, a linear programming problem modeling tool

Project description


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.

License: MIT



pip install ppulp


git clone


  • Variable product
  • If-then constraints
  • Absolute values
  • Piecewise linear approximation of nonlinear functions
  • Logical operations (And, Or, Xor)
  • Reduction (Sum, Prod)


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")

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


from ppulp import *

x = [LpVariable(name=f"x{i}", ini_value=2) for i in range(5)]

# summation

# production

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ppulp-0.1.0.tar.gz (9.9 kB view hashes)

Uploaded source

Built Distribution

ppulp-0.1.0-py3-none-any.whl (12.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page