help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-glpk] PuLP: A Python interface for GLPK


From: js
Subject: [Help-glpk] PuLP: A Python interface for GLPK
Date: Sat, 10 Apr 2004 17:36:41 +0200 (CEST)
User-agent: SquirrelMail/1.4.2

I'm currrently trying to complete the second version of a free Python
linear modeler which can use GLPK (among other solvers like COIN, 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(GLPK())

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

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

Attachment: pulp-1.1-BETA2.tgz
Description: Unix tar archive


reply via email to

[Prev in Thread] Current Thread [Next in Thread]