[Coin-lpsolver] PuLP: A Python interface for COIN LP

js at jeannot.org js at jeannot.org
Sat Apr 10 11:39:09 EDT 2004


I'm currrently trying to complete the second version of a free Python
linear modeler which can use COIN (among other solvers like GLPK, CPLEX or
XPRESS) to perform the optimization.

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 below.

The software can write LP files and call the various solvers binaries
(like glpsol) but it's more efficient and more reliable to use the
included C modules and avoid writting files.

Distribution of the sources only is not a problem under Unix where a
compiler is almost always available, but is a problem under Windows, so I
would like to provide compiled modules for this platform. The problem is,
I do not have access to a computer running Windows (much less Visual C++).
Would someone be interested in compiling and testing these modules (at
least for GLPK and COIN) ?

I've attached the latest 1.1 beta version which include all the sources.

Thank you very much in advance,

King regards,

js

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

prob.solve(COIN())

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

print "objective=", value(prob.objective)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pulp-1.1-BETA2.tgz
Type: application/x-tar
Size: 35679 bytes
Desc: not available
URL: <http://list.coin-or.org/pipermail/clp/attachments/20040410/b6c6a808/attachment.tar>


More information about the Clp mailing list