help-glpk
[Top][All Lists]

[Help-glpk] PuLP 1.1: A Python Linear Programming modeler

 From: Jean-Sebastien Roy Subject: [Help-glpk] PuLP 1.1: A Python Linear Programming modeler Date: Thu, 05 May 2005 11:48:15 +0200 User-agent: Mozilla Thunderbird 1.0.2 (X11/20050325)

I would like to announce the release of PuLP v 1.1.

PuLP is an LP modeler written in python. PuLP can generate MPS or LP
files and call GLPK, COIN CLP/SBB, CPLEX and XPRESS 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 below.

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.

While distribution of C sources is not a problem under Unix where a compiler is almost always available, it 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 under Windows ?

You can get it at:
http://www.jeannot.org/~js/code/pulp-1.1.tgz

http://www.jeannot.org/~js/code/index.en.html

Multiple examples are provided.

Thanks,

Jean-Sebastien

References:
 http://www.gnu.org/software/glpk/glpk.html
 http://www.coin-or.org/
 http://www.cplex.com/
 http://www.dashoptimization.com/

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

GLPK().solve(prob)

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

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