Skip to main content

A Linear Programming modeler

Project description

PuLP is an LP modeler written in python. PuLP can generate MPS or LP
files and call GLPK[1], COIN CLP/SBB[2], CPLEX[3] and XPRESS[4] to solve
linear problems.

PuLP provides a nice syntax for the creation of linear problems, and a
simple way to call the solvers to perform the optimization. See the example

This version adds C modules to use the GLPK, COIN and CPLEX solvers without
using intermediate MPS or LP files. It is faster and more reliable.

Multiple examples are provided.


Example script:

from pulp import *

prob = LpProblem("test1", LpMinimize)

# Variables
x = LpVariable("x", 0, 4)
y = LpVariable("y", -1, 1)
z = LpVariable("z", 0)

# Objective
prob += x + 4*y + 9*z

# Constraints
prob += x+y <= 5
prob += x+z >= 10
prob += -y+z == 7


# Solution
for v in prob.variables():
print, "=", v.varValue

print "objective=", value(prob.objective)

Project details

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page