Git Product home page Git Product logo

pulp's Introduction

pulp

https://travis-ci.org/coin-or/pulp.svg?branch=master PyPI PyPI - Downloads

PuLP is an LP modeler written in Python. PuLP can generate MPS or LP files and call GLPK, COIN-OR CLP/CBC, CPLEX, GUROBI, MOSEK, XPRESS, CHOCO, MIPCL, HiGHS, SCIP/FSCIP to solve linear problems.

Installation

The easiest way to install pulp is via PyPi

If pip is available on your system:

python -m pip install pulp

Otherwise follow the download instructions on the PyPi page.

If you want to install the latest version from github you can run the following:

python -m pip install -U git+https://github.com/coin-or/pulp

On Linux and OSX systems the tests must be run to make the default solver executable.

sudo pulptest

Examples

See the examples directory for examples.

PuLP requires Python 3.7 or newer.

The examples use the default solver (CBC). To use other solvers they must be available (installed and accessible). For more information on how to do that, see the guide on configuring solvers.

Documentation

Documentation is found on https://coin-or.github.io/pulp/.

Use LpVariable() to create new variables. To create a variable 0 <= x <= 3:

x = LpVariable("x", 0, 3)

To create a variable 0 <= y <= 1:

y = LpVariable("y", 0, 1)

Use LpProblem() to create new problems. Create "myProblem":

prob = LpProblem("myProblem", LpMinimize)

Combine variables to create expressions and constraints, then add them to the problem:

prob += x + y <= 2

If you add an expression (not a constraint), it will become the objective:

prob += -4*x + y

To solve with the default included solver:

status = prob.solve()

To use another sovler to solve the problem:

status = prob.solve(GLPK(msg = 0))

Display the status of the solution:

LpStatus[status]
> 'Optimal'

You can get the value of the variables using value(). ex:

value(x)
> 2.0

Exported Classes:

  • LpProblem -- Container class for a Linear programming problem

  • LpVariable -- Variables that are added to constraints in the LP

  • LpConstraint -- A constraint of the general form

    a1x1+a2x2 ...anxn (<=, =, >=) b

  • LpConstraintVar -- Used to construct a column of the model in column-wise modelling

Exported Functions:

  • value() -- Finds the value of a variable or expression
  • lpSum() -- given a list of the form [a1*x1, a2x2, ..., anxn] will construct a linear expression to be used as a constraint or variable
  • lpDot() --given two lists of the form [a1, a2, ..., an] and [ x1, x2, ..., xn] will construct a linear expression to be used as a constraint or variable

Building the documentation

The PuLP documentation is built with Sphinx. We recommended using a virtual environment to build the documentation locally.

To build, run the following in a terminal window, in the PuLP root directory

cd pulp
python -m pip install -r requirements-dev.txt
cd doc
make html

A folder named html will be created inside the build/ directory. The home page for the documentation is doc/build/html/index.html which can be opened in a browser.

Comments, bug reports, patches and suggestions are welcome.

pulp's People

Contributors

aphi avatar behrisch avatar bryant1410 avatar chmduquesne avatar chriswasser avatar davidggphy avatar dependabot[bot] avatar djunglas avatar ewouth avatar fangop avatar fmars avatar ggsdc avatar oprypin avatar pchtsp avatar ppecheux avatar rimaddo avatar rkersh avatar rutger-van-beek-cqm avatar ryanjoneil avatar saitotsutomu avatar samiit avatar siwy avatar stumitchell avatar svigerske avatar tkorvola avatar tkralphs avatar tmaarse avatar utkarsh-detha avatar willu47 avatar wookenny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pulp's Issues

Namespace issues

Perhaps the name space should be changed to look something like this.

import pulp as lp

prob = lp.Problem()

instead of 

from pulp import *

prob = LpProblem()


Original issue reported on code.google.com by [email protected] on 28 Apr 2008 at 11:11

Option to supress glpsolve output when ran through actualSolve()

Glpsolve writes a lot of output to stdout, with no apparent option to hide it. 
This makes it difficult to produce neat output with pulp-or.  Since there does 
not seem to be a neat way to keep glpk quiet, an option to capture stdout from 
the glpsolve process would be much appreciated (e.g. through stdout=None passed 
to popen.subprocess).

Original issue reported on code.google.com by [email protected] on 20 Sep 2010 at 3:36

Joining to project

I'd like to join the project.

We gets in contact few weeks ago.

Regards,
Luigi Poderico

Original issue reported on code.google.com by [email protected] on 24 Apr 2008 at 7:44

Problems with __repr__ in column-wise formulation

What steps will reproduce the problem?
1. instantiate the class below: 
import Scheduler
s = Scheduler.Scheduler(10) # 10 is the number of sensors.

2. solve with a column of ones
s.newCover([1 for i in range(10)])

3. try 's.lp.writeLP', or 's.lp.variables', etc.

What is the expected output? What do you see instead?
We should be able to inspect the problem.

What version of the product are you using? On what operating system?
Latest, Windows Vista, active python.

Please provide any additional information below.
-----

# $Id: Scheduler.py 15 2008-06-04 14:41:57Z leolopes $

import pulp

class Scheduler:
    """This class implements a scheduler that determines how long to run
each cover to maximize sensing lifetime given that each sensor
has lifetime 1."""
    def __init__(s,nSensors):
        s.nSensors = nSensors
        s.lp = pulp.LpProblem("Schedule",pulp.LpMaximize)
        s.obj = pulp.LpConstraintVar("obj")
        s.lp.setObjective(s.obj)
        s.Lifetime = [\
            pulp.LpConstraintVar("LifeOfSensor%d" % i,pulp.LpConstraintLE,1) \
            for i in range(nSensors)\
        ]
        for c in s.Lifetime: s.lp += c
        s.Cover = [] # variables to be added later.

    def newCover(s,cover):
        """A new cover is a 0-indexed list of the sensors in the cover.
The method returns an n-list of dual prices."""
        s.Cover.append(pulp.LpVariable(name = "Cover%d" % len(s.Cover), \
            lowBound = 0, upBound = 1, cat = pulp.LpContinuous, \
            e=sum([s.obj]+[s.Lifetime[i] for i in cover])))
        s.lp.solve()
        return [s.lp.constraints["LifeOfSensor%d" % i].pi for i in
range(s.nSensors)]        

Original issue reported on code.google.com by [email protected] on 6 Jun 2008 at 8:38

Variables don't get updated after running simple model with cplex

What steps will reproduce the problem?
1. import the module below
2. instantiate a SetCovering model, say scp41, by:
import beasleySetCovering as bsc
import SetCovering as sc
costs, matrix = bsc.readBeasley('scp41.txt')
s = sc.SetCovering(costs,matrix)

3. look at s.Use 

What is the expected output? What do you see instead?

The expected output is a list of 0s and 1s. This is the output we get (and
it is the documented optimal) using cbc. But using cplex all we get is None
for each element of the array.

What version of the product are you using? On what operating system?
The svn version from after issue#6 was fixed.

Please provide any additional information below.

I have attached the instance file in addition to the pulp model and a small
routine to read the file. 

Original issue reported on code.google.com by [email protected] on 4 Jul 2008 at 1:15

Attachments:

Cplex 12.2, Ubunut 64, Pulp 1.4.9 CPLEX_DLL Causing a Crash

What steps will reproduce the problem?
1. Using Ubuntu 10.04 LTS
2. Using Python 2.6.5
2. Install Cplex 12.2 
2. Install pulp 1.4.9 (which is the first distribution to work on Ubuntu 64 bit 
- which is excellent so thank you!)

Please provide any additional information below.

Without changing anything (i.e. not changing my path or the pulp.cfg.linux 
file) I get...
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.PULP_CBC_CMD unavailable.
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.CPLEX_CMD unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.COIN_CMD passed.
Solver pulp.solvers.COINMP_DLL unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.GLPK_CMD passed.
Solver pulp.solvers.XPRESS unavailable.
Solver pulp.solvers.GUROBI unavailable.
Solver pulp.solvers.PYGLPK unavailable.
Solver pulp.solvers.YAPOSIB unavailable.

If I add the location of the cplex executable installed with cplex to the path 
(add these lines to my /.bashrc file which pertain the specific place on my box 
where the file was installed)
export CPLEX_EXECUTABLE="/opt/ILOG/CPLEX_Studio122/cplex/bin/x86-64_sles10_4.1/"
export PATH="${PATH}:${CPLEX_EXECUTABLE}"
I get (running python from a bash)
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.PULP_CBC_CMD unavailable.
Solver pulp.solvers.CPLEX_DLL unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing column based modelling with empty constraints
     Testing dual variables and slacks reporting
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.CPLEX_CMD passed.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.COIN_CMD passed.
Solver pulp.solvers.COINMP_DLL unavailable.
     Testing zero subtraction
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing Long Names
     Testing repeated Names
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem
     Testing column based modelling
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.GLPK_CMD passed.
Solver pulp.solvers.XPRESS unavailable.
Solver pulp.solvers.GUROBI unavailable.
Solver pulp.solvers.PYGLPK unavailable.
Solver pulp.solvers.YAPOSIB unavailable.


Looking at the pulp.cfg.linux file that came with pulp (and stepping through 
some code on solvers.py which I recommend you do if you can, you learn a lot) I 
see that the config variable
CplexPath = /usr/ilog/cplex/bin/x86_rhel4.0_3.4/libcplex110.so
So I change this to what it should be for my box
CplexPath = /opt/ILOG/CPLEX_Studio122/cplex/bin/x86-64_sles10_4.1/libcplex122.so
I now get
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.PULP_CBC_CMD unavailable.
Segmentation fault

So to drill down deeper as this description will not help anyone...
Creating a python file with the following contents

from pulp import *
pulp.pulpTestAll()

I start debugging using Eric looking at solvers.py
Inside 
class CPLEX_DLL(LpSolver):
inside the method
def grabLicence(self):
on line 677
This line 
self.env = CPLEX_DLL.lib.CPXopenCPLEX(ctypes.byref(status))
executes fine and returns the correct value for status which is good...

The first place where self.env is used inside 
def setMemoryEmphasis(self, yesOrNo = False): 
I get a crash
i.e.
CPLEX_DLL.lib.CPXsetintparam(self.env,
                            CPLEX_DLL.CPX_PARAM_MEMORYEMPHASIS,yesOrNo)
crashes

Thinking that perhaps there is only something wrong with CPXsetintparam, I 
comment this line out and see what happens 
It crashes on the next line that want to use the env variable
status=CPLEX_DLL.lib.CPXcloseCPLEX(self.env)

I do recall reading in one of the pulp files I was looking at the it had only 
been tested up to cplex 11.
Thanks for releasing a version that worked out of the box on Ubuntu 64, it 
would be great to be able to use the CPLEX_DLL solve, I am not sure what 
functionality I lose by using CPLEX_CMD() solve (perhaps setting some of the 
more esoteric cplex parameters for a particular solve by interacting myself 
with the env variable)

Cheers





Original issue reported on code.google.com by [email protected] on 5 Oct 2011 at 4:31

Pulp generates too long names for COIN_CMD

What steps will reproduce the problem?
1) a variable has a lot of indexes
2) the lp file generated by pulp makes variables with names bigger than 100 
caracters
3) cbc refuses to solve the generated problem (but pulp ignores that and does 
not advertise the user that it is because of columns names).

See attached example.

What is the expected output? What do you see instead?
Pulp should at least tell the user the names choosen for the columns are too 
long.



Original issue reported on code.google.com by chm.duquesne on 9 May 2011 at 2:42

Attachments:

pulp does not respect the (msg = 0) hint with COINMP_DLL as a solver

What steps will reproduce the problem?

Attached is a small example showing that coin prints garbage on stdout even 
though it has been told not to. Just run it.

What is the expected output? What do you see instead?

Running the attached python script should not print anything. Instead, it 
prints the usual stuff for solvers.

What version of the product are you using? On what operating system?

Running on linux x86_64 (ubuntu maverick) 

Please provide any additional information below.

I fixed the issue in my own code using the trick provided here:

http://stackoverflow.com/questions/5081657/how-do-i-prevent-a-c-shared-library-t
o-print-on-stdout-in-python

Maybe pulp could directly use the same trick...

Original issue reported on code.google.com by chm.duquesne on 24 Feb 2011 at 12:45

tests fail with latest version of CoinMP - Linux

I just installed pulp on ubuntu 8.04 with CoinMP installed and the tests
fail as follows:

laurent@laurent-predictix:~/src/pulp/PuLP-1.21.03$ python
Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.CPLEX_MEM unavailable.
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.COIN_MEM unavailable.
     Testing continuous LP solution
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/pulp.py", line
1896, in pulpTestAll
    pulpTestSolver(s)
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/pulp.py", line
1886, in pulpTestSolver
    t(solver(msg=0))
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/pulp.py", line
1686, in pulpTest1
    pulpTestCheck(prob, solver, [LpStatusOptimal], {x:4, y:-1, z:6, w:0})
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/pulp.py", line
1635, in pulpTestCheck
    status = prob.solve(solver)
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/pulp.py", line
1340, in solve
    status = solver.actualSolve(self)
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/solvers.py",
line 950, in actualSolve
    else: return self.solve_CLP(lp)
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/solvers.py",
line 1044, in solve_CLP
    lp.status, values = self.readsol_CLP(tmpSol, lp, vs, variablesNames,
constraintsNames, objectiveName)
  File
"/home/laurent/python/sains/lib/python2.5/site-packages/pulp/solvers.py",
line 1072, in readsol_CLP
    vn = l[1]
IndexError: list index out of range
>>> 

the version of Clp I am using is the latest from Coin-MP

laurent@laurent-predictix:~/src/pulp/PuLP-1.21.03$ clp
Coin LP version 1.06.00, build Oct 17 2008
Clp takes input from arguments ( - switches to stdin)
Enter ? for list of commands or help
Clp:

It looks like the output format is not the one expected. Do I have the
wrong version of CLP?

Laurent Oget
[email protected]

Original issue reported on code.google.com by [email protected] on 17 Oct 2008 at 9:23

LP output to glpk does not strip the correct letters

Hi Dr Mitchell

I have been using pulp and came across a problem. I am calling the solver
using self.problem.solve()

The output looks as :
glp_read_lp: reading problem data from `/tmp/642-pulp.lp'...
/tmp/642-pulp.lp:4: constraints section missing
CPLEX LP file processing error
/tmp/642-pulp.sol
Traceback (most recent call last):
  File "snf_resource_scheduler.py", line 178, in <module>
    ResourceScheduler(peers)
  File "snf_resource_scheduler.py", line 53, in __init__
    self.convert_mcfp_solution_to_resource_reservations(self,
self.binary_search(peers))
  File "snf_resource_scheduler.py", line 72, in binary_search
    optimizers[Tmin] = Optimizer(mcfp_reducer)
  File
"/home/msirivia/svnroot/fedex/Hermes/trunk/pulp/PuLP-1.23.01/pulp-or/examples/sn
f_optimizer.py",
line 32, in __init__
    self.solve_mcfp()
  File
"/home/msirivia/svnroot/fedex/Hermes/trunk/pulp/PuLP-1.23.01/pulp-or/examples/sn
f_optimizer.py",
line 192, in solve_mcfp
    self.problem.solve()
  File "/usr/local/lib/python2.6/dist-packages/pulp/pulp.py", line 1334, in
solve
    status = solver.actualSolve(self)
  File "/usr/local/lib/python2.6/dist-packages/pulp/solvers.py", line 302,
in actualSolve
    raise "PuLP: Error while executing "+self.path



The lp file looks like:
/tmp/642-pulp.lp:
\* MCFP problem *\
Maximize
Maximimize_incoming_flows_to_last_receiver:
 sender/receiver_minus_1_>receiver_star_1
 + sender/receiver_star_0_>receiver_star_1
Subject To
Outgoing_flows_from_first_demand_peer_sender_equal_to_last_receiver:
 sender/sender_star_0_>sender_star_1 + sender/sender_star_0_>sender_plus_0
 - sender/receiver_minus_1_>receiver_star_1
 - sender/receiver_star_0_>receiver_star_1 = 0
Bounds
sender/sender_star_0_>sender_plus_0 <= 10
sender/sender_star_0_>sender_star_1 <= 100
sender/receiver_minus_1_>receiver_star_1 <= 20
sender/receiver_star_0_>receiver_star_1 <= 100
End

Their is no /tmp/642-pulp.sol file.

I am using ubuntu 8.10 on a 64-bit machine.

If needed i can send you the actual code I am using.
I am new to pulp, i looked in the pulp/solvers.py and pulp/pulp.py but
still cannot interpret
the warnings.


I would greatly appreciate any help!
Best,
Mike

Original issue reported on code.google.com by [email protected] on 21 Jul 2009 at 10:39

Efficient changed variables recognition

If I'm well understanding, there is a field that flag the modified
variables and constraints, i.e. LpElement.modified.

It is used in the CPLEX_DLL.actualSolve and CPLEX_DLL.actualResolve methods.

This could be lead to inefficiency for large problem, both for memory and
CPU time consumption.

Are you planning to properly use the LpProblem.modifiedVariables list?

Original issue reported on code.google.com by [email protected] on 3 Jun 2008 at 11:53

pulp fails with 64 bit python 2.6.5 and 64 bit cplex 12.1

What steps will reproduce the problem?
1. install pulp by easy_install
2. import pulp
3. modify the cfg file to reflect the paths for solvers
4. run pulp.pulpTestAll()

What is the expected output? What do you see instead?

Expected to pass the test, while the pulp.solver.CPLXE_DLL tests failed. 

In [1]: import pulp

In [2]: pulp.pulpTestAll()
         Testing continuous LP solution
         Testing maximize continuous LP solution
exception: access violation reading 0xFFFFFFFF04389EF8
* Solver pulp.solvers.CPLEX_DLL failed.
         Testing continuous LP solution
         Testing maximize continuous LP solution
         Testing unbounded continuous LP solution
         Testing MIP solution
         Testing MIP relaxation
         Testing feasibility problem (no objective)
         Testing an infeasible problem
         Testing an integer infeasible problem
         Testing column based modelling
         Testing column based modelling with empty constr
         Testing dual variables and slacks reporting
         Testing fractional constraints
         Testing elastic constraints (no change)
         Testing elastic constraints (freebound)
         Testing elastic constraints (penalty unchanged)
         Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.CPLEX_CMD passed.
Solver pulp.solvers.COIN_CMD unavailable.
Solver pulp.solvers.COINMP_DLL unavailable.
Solver pulp.solvers.GLPK_CMD unavailable.
Solver pulp.solvers.XPRESS unavailable.
         Testing continuous LP solution
         Testing maximize continuous LP solution
         Testing unbounded continuous LP solution
         Testing MIP solution
         Testing MIP relaxation
         Testing feasibility problem (no objective)
         Testing an infeasible problem
         Testing an integer infeasible problem
         Testing column based modelling
         Testing Sequential Solves
         Testing fractional constraints
         Testing elastic constraints (no change)
         Testing elastic constraints (freebound)
         Testing elastic constraints (penalty unchanged)
         Testing elastic constraints (penalty unbounded)
* Solver pulp.solvers.GUROBI passed.

What version of the product are you using? On what operating system?
Windows 7 business 64 bit
Python 2.6.5 64 bit
CPLEX 12.1 64 bit

Please provide any additional information below.
I also have 32 bit cplex 12.1 and python 2.5 32 bit installed in the same 
machine, and passed all the tests. 

In a 32 bit windows xp with python 2.6.5 32 bit and cplex 12.1 32 bit, all the 
tests passed. 

Original issue reported on code.google.com by [email protected] on 14 Jun 2010 at 6:57

Memory leak with CPLEX DLL

What steps will reproduce the problem?
1. Solve a lot of lp problems using CPLEX_DLL (like the attached one)
2. Watch the memory consumption of your process growing up

What is the expected output? What do you see instead?

A constant memory consumption, like the one with - by example - CPLEX_CMD

What version of the product are you using? On what operating system?

1.4.7 as well as the trunk, on a Cent OS (GNU/linux 32bits) computer, as well 
on other unix computers.

Please provide any additional information below.

The joined example is a stupid lp problem, but repeated a lot of time. The 
memory usage is growing up (as reported by (h)top), until there is no memory 
left and cplex refuse to solve another problem.

I've tried to fix it myself, without any success. The way I tried are : free 
the memory used by CPLEX by calling CPXfreeprob in CPLEX_DLL.__del__ (according 
to CPLEX doc, this must be done before releasing the license), and make the lib 
attribute (library loaded by ctypes) an attribute of instances of CPLEX_DLL 
instead of class attributes, to get the lib object deleted on instance delete.

(Anyway, thanks for pulp, it's a really good ilp API!)

Original issue reported on code.google.com by [email protected] on 27 Jul 2010 at 9:37

Attachments:

os.spawnv call returns error no 2

What steps will reproduce the problem?
1. prob.solve(GLPK(GLPK_PATH)) # to use GLPK as the solver
2. GLPK_PATH points to folder of glpsol.exe executable
3.

What is the expected output? What do you see instead?
expect valid solution
error no 2

What version of the product are you using? On what operating system?
1.4.7, Python 2.5, Windows XP

Please provide any additional information below.

Changing the os.spawnv call syntax fixed the issue.
existing solver.py line 332:
                rc = os.spawnv(os.P_WAIT, self.executable(self.path), proc)


new solver.py line 332:
                rc = os.spawnv(os.P_WAIT,
self.executable(self.path)+'glpsol', proc)

Original issue reported on code.google.com by [email protected] on 18 Mar 2010 at 3:48

LpInteger Variable Error

What steps will reproduce the problem?
1. Declare integer variable over 2 indexes
2.
3.

What is the expected output? What do you see instead?
running program, error regarding integer variables

What version of the product are you using? On what operating system?
1.4.7 on Windows 7 32 bit 

Please provide any additional information below.
Program working fine until I tried to use integer variable, declared exactly as 
shown in examples (see line 51 in proj.py)

I'm getting the following error in traceback ending with (abbreviated) 
in solvers.py, line 225, in getCplexStyleArrays
   columnType[selv.v2n[v]] = LpVarCategories[v.cat]
KeyError: 0

Original issue reported on code.google.com by [email protected] on 8 May 2011 at 11:01

Attachments:

Testing PuLP installation fails

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
Following instructions from 
http://www.coin-or.org/PuLP/main/installing_pulp_at_home.html#installation , I 
installed PuLP using "Windows Installation from source"

When I tried to run the test on the page ( Instructions on the page : "To test 
that that you pulp installation is working correctly please type the following 
into a python interpreter and note that the output should be similar. The 
output below is what you would expect if you have not installed any other 
solvers and the CoinMP solver bundled with pulp works.") 


My Results :
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.CPLEX_CMD unavailable.
Solver pulp.solvers.COIN_CMD unavailable.
Solver pulp.solvers.COINMP_DLL unavailable.
Solver pulp.solvers.GLPK_CMD unavailable.
Solver pulp.solvers.XPRESS unavailable.
Solver pulp.solvers.GUROBI unavailable.

According to the webpage,this should be my output :

>>> import pulp
>>> pulp.pulpTestAll()          
Solver pulp.pulp.COIN_MEM unavailable.
Solver pulp.pulp.COIN_CMD unavailable.
     Testing continuous LP solution
     Testing maximize continuous LP solution
     Testing unbounded continuous LP solution
     Testing MIP solution
     Testing MIP relaxation
     Testing feasibility problem (no objective)
     Testing an infeasible problem
     Testing an integer infeasible problem (Error to be fixed)
     Testing column based modelling
     Testing column based modelling with empty constraints
     Testing dual variables and slacks reporting
     Testing resolve of problem
     Testing Sequential Solves
     Testing fractional constraints
     Testing elastic constraints (no change)
     Testing elastic constraints (freebound)
     Testing elastic constraints (penalty unchanged)
     Testing elastic constraints (penalty unbounded)
* Solver pulp.pulp.COINMP_DLL passed.
Solver pulp.pulp.GLPK_MEM unavailable.
Solver pulp.pulp.GLPK_CMD unavailable.
Solver pulp.pulp.XPRESS unavailable.


What version of the product are you using? On what operating system?

I am using Python 2.7.1, PuLP 1.4.7  on Windows 7 64 bit.


Please provide any additional information below.

I guess it is because the CoinMP solver bundled with PuLP is not working. I 
just started working on Python a week back, I am just an amateur in 
programming. 


Original issue reported on code.google.com by [email protected] on 24 Jun 2011 at 4:45

GLPK is not being recognized

I am trying to install GLPK and run it as my PuLP solver. I have added the 
location of glpsol to my path by adding a .pth file to the site-packages folder 
in the Lib folder of my Python27 folder.

What is the expected output? What do you see instead?
I expect to see that GLPK_CMD is available when I run pulpTestAll(), but I 
always see it as unavailable.

What version of the product are you using? On what operating system?
I am using python 2.7 and the newest version of PuLP.

Original issue reported on code.google.com by [email protected] on 9 Jun 2012 at 3:52

suppressing screen output

I am trying to solve a large number LPs and I am only interesting in the output 
when a solution is found.  

Is there a way to turn off screen output whenever puLP is called?

Many thanks
Markus

Original issue reported on code.google.com by [email protected] on 20 Aug 2012 at 6:37

Two issues with solver COINMP_DLL

Issue 1:
I was running large-scale calculations using COINMP_DLL as my solver, with 
parameter 'msg=0' to hide internal prints. But then I found millions of temp 
file was created in my user's temp directory (Windows 7: 
C:\Users\username\AppData\Local\Temp). I had great trouble deleting them 
manually because I never succeeded in listing the whole directory. Finally I 
had to format the drive to prevent the hard disk from being damaged by frequent 
read.

Issue 2:
I detected memory leak when running the tasks above.

Hope these issues can be fixed.

Original issue reported on code.google.com by [email protected] on 27 Mar 2013 at 2:22

Pulp do not detect a gurobi installation

Environment:
Linux Ubuntu x64 (2.6.32-23)
Python 2.6

What steps will reproduce the problem?
1. Install gurobi (/opt/gurobi301)
2. Install pulp (via easy_install of setup.py)
3. run pulptest


What is the expected output? What do you see instead?
I get 
...
Solver pulp.solvers.GUROBI unavailable.
While I would expect to have gurobi available

Please provide any additional information below.
I may be missing a step, but I found no information on how to setup a solver to 
work with pulp...
Please note that Gurobi is integrated with my Python installation and can be 
imported directly

Original issue reported on code.google.com by [email protected] on 7 Jul 2010 at 11:37

LP writing error generates blank line with =

What steps will reproduce the problem?
1. Convert metabolic model size LP to LpProblem

2. Run writeLP or run solver with GLPK

3. Observe error 

GLPSOL: GLPK LP/MIP Solver 4.38
glp_read_lp: reading problem data from `/tmp/8039-pulp.lp'...
/tmp/8039-pulp.lp:274: symbol `=' in wrong position

What is the expected output? What do you see instead?
Expect GLPSOL to run, instead receive error about miss-constructed LP file.

What version of the product are you using? On what operating system?
PuLP 1.5.1
Python 2.6
Ubuntu 10.04 LTS

Please provide any additional information below.

If I feed the information into glpk using swing and generate an LP file 
everything is fine.  Also generating an MPS file from the same LpProblem object 
does not result in a problem.  Only the LP format seems to result in the blank 
line looking like " = <float> " depending on what value the constraint was set 
to.  It may be a repeated equality form the previous line as the line its on 
has no constraint name, or equality code (E G L) etc. 

Original issue reported on code.google.com by [email protected] on 8 May 2012 at 11:48

Attachments:

64bit issue: error run cplex from DLL model in ubuntu 10.04 64 bit

What steps will reproduce the problem?
1. Install cplex 12.2 64 bit, obtained through IBM Academic Initiative
2. Make link such that the libcplex122.so and cplex bin file are included in 
path
3. Install python 2.6 from ubuntu repository as well as the dist utility
4. Install pulp via easy_install
5. Change the pulp.cfg.linux to reflect the .so file position
6. invoke python, import pulp and then run pulp.pulpTestAll()

What is the expected output? What do you see instead?
Expected to see all the tests passed
Screen output:

IBM ILOG License Manager: "IBM ILOG Optimization Suite for Academic Initiative" 
is accessing CPLEX 12 with option(s): "e m b q ".
Segmentation fault

Also the python session was interrupted and exit to shell directly

What version of the product are you using? On what operating system?
CPLEX 12.2 64 bit for linux
Ubuntu 10.04 64 bit, and python 2.6.5 64 bit from the repository

Please provide any additional information below.

Sorry to bother again after I reported the problem for windows side. A college 
of mine tried on run my code in a 64 bit linux box, and seems it was not 
working. We tried different machines and found the same error on a mac running 
snow leopard. However, this only happened to the DLL method, the CMD worked 
fine. 
I am new to python, thus I have trouble identifying what exactly caused this 
error. 

Original issue reported on code.google.com by [email protected] on 25 Jul 2010 at 11:55

lpSum bug

Consider the following code:

from pulp import *

p = LpProblem('test', LpMinimize)
p += lpSum([0,0]) <= 0
p.solve()

It generates a LP file as follows:

\* test *\
Minimize
OBJ: __dummy
Subject To
_C1:0 <= 0
Bounds
__dummy = 0
End

Which when parsed with cbc gives you:

Welcome to the CBC MILP Solver 
Version: 2.7 
Build Date: Oct  1 2011 
Revision Number: 1735 

command line - 
/home/llpamies/local/lib/python2.7/site-packages/PuLP-1.4.9-py2.7.egg/pulp/solve
rdir/cbc-32 /tmp/15485-pulp.lp branch (default strategy 1)
Coin3007W ### CoinLpIO::is_invalid_name(): Name _C1:0 contains illegal 
character ':'
Coin3007W ### CoinLpIO::are_invalid_names(): Invalid name: vnames[1]: _C1:0
Coin3007W ### CoinLpIO::readLp(): Invalid column names
Now using default column names.
Presolve 0 (-1) rows, 0 (-2) columns and 0 (-1) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value 0
After Postsolve, objective 0, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 0 - 0 iterations time 0.002, Presolve 0.00
Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00




The error is that the "_C1:0 <= 0" is an illegal expression.

Original issue reported on code.google.com by [email protected] on 20 Oct 2011 at 8:09

Integer optimal within tolerance not recognized as optimal.

What steps will reproduce the problem?
1. Break the symmetry of an IP by adding noise to the objective.
2. Solve repeatedly. Sometimes the solution returned by CPLEX will be code
102, CPXMIP_OPTIMAL_TOL, but pulp will not recognize this as optimal.

What is the expected output? What do you see instead?
In the abscense of a more specific code, pulp should return optimal. I am
not sure what it returns actually, since I only test for optimality or
infeasibility.

What version of the product are you using? On what operating system?

PuLP-1.21.03 on linux.

Please provide any additional information below.

I attached a patch.

Original issue reported on code.google.com by [email protected] on 1 Apr 2009 at 1:26

Attachments:

executables from PuLP-1.4.9/src/pulp/solverdir/ break RPM dependencies

What steps will reproduce the problem?
1. tar zxf PuLP-1.4.9.tar.gz
2. file PuLP-1.4.9/src/pulp/solverdir/cbc*
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?

PuLP-1.4.9.
cat /etc/redhat-release 
Scientific Linux release 6.0 (Carbon)
Linux 2.6.32-131.12.1.el6.i686 #1 SMP Tue Aug 23 11:12:55 CDT 2011 i686 i686 
i386 GNU/Linux

Please provide any additional information below.

src/pulp/solverdir/ constains a 64bit excutable:
PuLP-1.4.9/src/pulp/solverdir/cbc-64: ELF 64-bit LSB executable, x86-64, 
version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, 
not stripped

This, when building pulp-or RPM on a 32bit system results in broken 
dependencies: 32bit pulp-or RPM package depends on 64bit packages.
And analogously, 64bit pulp-or RPM depends on 32bit packages.

Solution:
1. `setup.py install` should install only executables for the requested platform
2. or one has to %exclude spurious executables directly in the RPM spec file, 
like:
https://build.opensuse.org/package/show?package=python-pulp-or&project=home%3Ama
rcindulak

Original issue reported on code.google.com by [email protected] on 9 Nov 2011 at 12:46

distributed packages do not work out of the box on Linux 64bit

What steps will reproduce the problem?
1. sudo easy_install PuLP
2. Run "import pulp; pulp.pulpTestAll()"
3. No solvers are available.

It would be great to have at least one solver available out of the box.

1.4.7 comes with 32bit libraries that a 64bit python on Linux cannot digest.
1.4.8 is packaged with a single CoinMP.dll - 32bit Windows.

I know that it is possible to compile things from scratch, but it would be 
great to be able to list pulp as a dependencies in distutils, so that 
installation would be 0-hassle. 

Original issue reported on code.google.com by [email protected] on 6 May 2011 at 3:08

Build and Install in Mac OS X

This is the log in build and install in Mac OS X.

I know that there is no support for Mac OS X yet.

It needs .dylib (dynamic library) as well. I am interested on GLPK and CBC 
solver to work with PuLP in Mac OS X.

#############

Last login: Mon Nov 26 12:00:46 on ttys005
Nolis-MacBook-Pro:PuLP-1.5.3 nsicad$ python setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/pulp
copying src/pulp/__init__.py -> build/lib/pulp
copying src/pulp/amply.py -> build/lib/pulp
copying src/pulp/constants.py -> build/lib/pulp
copying src/pulp/pulp.py -> build/lib/pulp
copying src/pulp/solvers.py -> build/lib/pulp
copying src/pulp/sparse.py -> build/lib/pulp
copying src/pulp/tests.py -> build/lib/pulp
creating build/lib/pulp/solverdir
copying src/pulp/solverdir/__init__.py -> build/lib/pulp/solverdir
copying src/pulp/pulp.cfg.linux -> build/lib/pulp
copying src/pulp/pulp.cfg.win -> build/lib/pulp
copying src/pulp/solverdir/cbc-32 -> build/lib/pulp/solverdir
copying src/pulp/solverdir/cbc-64 -> build/lib/pulp/solverdir
copying src/pulp/solverdir/cbc.exe -> build/lib/pulp/solverdir
copying src/pulp/solverdir/CoinMP.dll -> build/lib/pulp/solverdir
Nolis-MacBook-Pro:PuLP-1.5.3 nsicad$ python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-1623.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  http://peak.telecommunity.com/EasyInstall.html

Please make the appropriate changes for your system and try again.

Nolis-MacBook-Pro:PuLP-1.5.3 nsicad$ sudo python setup.py install
dyld: DYLD_ environment variables being ignored because main executable 
(/usr/bin/sudo) is setuid or setgid
Password:
running install
running bdist_egg
running egg_info
writing requirements to src/PuLP.egg-info/requires.txt
writing src/PuLP.egg-info/PKG-INFO
writing top-level names to src/PuLP.egg-info/top_level.txt
writing dependency_links to src/PuLP.egg-info/dependency_links.txt
writing entry points to src/PuLP.egg-info/entry_points.txt
reading manifest file 'src/PuLP.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/PuLP.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.8-intel
creating build/bdist.macosx-10.8-intel/egg
creating build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/__init__.py -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/amply.py -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/constants.py -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/pulp.cfg.linux -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/pulp.cfg.win -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/pulp.py -> build/bdist.macosx-10.8-intel/egg/pulp
creating build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solverdir/__init__.py -> 
build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solverdir/cbc-32 -> 
build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solverdir/cbc-64 -> 
build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solverdir/cbc.exe -> 
build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solverdir/CoinMP.dll -> 
build/bdist.macosx-10.8-intel/egg/pulp/solverdir
copying build/lib/pulp/solvers.py -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/sparse.py -> build/bdist.macosx-10.8-intel/egg/pulp
copying build/lib/pulp/tests.py -> build/bdist.macosx-10.8-intel/egg/pulp
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/__init__.py to 
__init__.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/amply.py to amply.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/constants.py to 
constants.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/pulp.py to pulp.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/solverdir/__init__.py to 
__init__.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/solvers.py to solvers.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/sparse.py to sparse.pyc
byte-compiling build/bdist.macosx-10.8-intel/egg/pulp/tests.py to tests.pyc
creating build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/PKG-INFO -> build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/SOURCES.txt -> 
build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/dependency_links.txt -> 
build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/entry_points.txt -> 
build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/requires.txt -> 
build/bdist.macosx-10.8-intel/egg/EGG-INFO
copying src/PuLP.egg-info/top_level.txt -> 
build/bdist.macosx-10.8-intel/egg/EGG-INFO
writing build/bdist.macosx-10.8-intel/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
pulp.solvers: module references __file__
creating dist
creating 'dist/PuLP-1.5.3-py2.7.egg' and adding 
'build/bdist.macosx-10.8-intel/egg' to it
removing 'build/bdist.macosx-10.8-intel/egg' (and everything under it)
Processing PuLP-1.5.3-py2.7.egg
creating /Library/Python/2.7/site-packages/PuLP-1.5.3-py2.7.egg
Extracting PuLP-1.5.3-py2.7.egg to /Library/Python/2.7/site-packages
Adding PuLP 1.5.3 to easy-install.pth file
Installing pulpdoctest script to /usr/local/bin
Installing pulptest script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/PuLP-1.5.3-py2.7.egg
Processing dependencies for PuLP==1.5.3
Searching for pyparsing>=1.5.2
Reading http://pypi.python.org/simple/pyparsing/
Reading http://pyparsing.wikispaces.com/
Reading http://sourceforge.net/project/showfiles.php?group_id=97203
Reading http://pyparsing.sourceforge.net/
Reading http://sourceforge.net/projects/pyparsing
Best match: pyparsing 1.5.6
Downloading 
http://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.6.zip#md5=5404d
e54e6d0ae71ce354d8db3576ac1
Processing pyparsing-1.5.6.zip
Running pyparsing-1.5.6/setup.py -q bdist_egg --dist-dir 
/tmp/easy_install-OEVnqh/pyparsing-1.5.6/egg-dist-tmp-1yxJYI
zip_safe flag not set; analyzing archive contents...
pyparsing: module MAY be using inspect.stack
Adding pyparsing 1.5.6 to easy-install.pth file

Installed /Library/Python/2.7/site-packages/pyparsing-1.5.6-py2.7.egg
Finished processing dependencies for PuLP==1.5.3
Nolis-MacBook-Pro:PuLP-1.5.3 nsicad$ 

#####

Noli

Original issue reported on code.google.com by [email protected] on 26 Nov 2012 at 1:07

Linux installation errors

I encountered the following problems while trying to install PuLP 1.23 on
Debian Lenny.

The install itself went fine but after opening a python shell and typing
import pulp I received:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pulp/__init__.py", line 33, in
<module>
    from pulp import *
  File "/usr/lib/python2.5/site-packages/pulp/pulp.py", line 75, in <module>
    from solvers import *
  File "/usr/lib/python2.5/site-packages/pulp/solvers.py", line 1325, in
<module>
    COIN = COIN_MEM
NameError: name 'COIN_MEM' is not defined

I only did a quick review of the code but it appears line 1325 of
solvers.py should read:

COIN = COINMP_DLL instead of COIN = COIN_MEM.

After making the above change to solvers.py I attempted to import PuLP
again and received the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pulp/__init__.py", line 33, in
<module>
    from pulp import *
  File "/usr/lib/python2.5/site-packages/pulp/pulp.py", line 100, in <module>
    elif GLPK_MEM().available():
NameError: name 'GLPK_MEM' is not defined

I could not find any reference to GLPK_MEM in solvers.py so I removed this
from the default solvers tests in pulp.py.  After removing GLPK_MEM from
the default solvers I was able to import pulp and successfully run
pulpTestAll().

Original issue reported on code.google.com by [email protected] on 27 May 2009 at 8:49

Feature request: check for empty constraints when adding to problem

What steps will reproduce the problem?

# Consider the following linear form as a constraint
a = [0,]
problem += lpSum([a[i]*variable[i] for i in range(len(i))]) < 1, 'a_constraint'

What is the expected output? What do you see instead?
The expected output should be either a_constraint: "0*variable[i] <1"
or nothing at all with a warning.  Instead, we get "a_constraint: 0 < 1", which 
makes for  invalid cpxlp specification since it's missing a variable. 

What version of the product are you using? On what operating system?

Pulp 1.4.7 on Ubuntu 9.1, 32bit, Python 2.6.

Please provide any additional information below.

PS Many thanks for an excellent package.  Please keep up the excellent work.

Original issue reported on code.google.com by [email protected] on 23 Jun 2010 at 4:28

What is probset module?

I found couple references to probset module in pulp.py:

    try:
        import probset
        return probset.Combination(orgset,k)

As far as I understand there should be probstat, not probset:
http://probstat.sourceforge.net/

Original issue reported on code.google.com by kit1980 on 26 Feb 2010 at 10:12

Pulp Fails in 64 bit linux

What steps will reproduce the problem?
Install Pulp in 64 Bit linux

What is the expected output? What do you see instead?
Unit tests fail

This is mostly a documentation issue as the installation directions do not
match what has to happen in linux


Original issue reported on code.google.com by [email protected] on 2 Apr 2009 at 10:39

When a constraint evaluates to zero, pulp produces an lp file glpk cannot parse, making GLPK_CMD fail.

What steps will reproduce the problem?

Run the attached example: you'll see that GLPK_CMD fails where COIN_CMD has 
succeeded.

What is the expected output? What do you see instead?

It is pretty obvious that the command line tool glpsol does not like the line 6 
in "debug.lp". this line is:

    _C2:0 <= 0

To be determined: is it a bug we should fix in pulp, or is it a problem with 
glpsol? I filed a bug on their mailing list in order to find out. Anyway I am 
still reporting the issue here in order to avoid having to search for hours if 
this happen to someone else meanwhile.

Original issue reported on code.google.com by chm.duquesne on 5 May 2011 at 1:38

Attachments:

An unexpected error occurred while tokenizing input

What is the expected output? What do you see instead?
I expect to see the normal PuLP output, but I get an error instead that says

"ERROR: An unexpected error occurred while tokenizing input. The following 
traceback may be corrupted or invalid. The error message is: ('EOF in 
multi-line statement',(338,0))"

I have to do a ctrl+C keyboard interrupt in order to even see this, otherwise 
it would just run indefinitely.

What version of the product are you using? On what operating system?
I'm using the most recent version on Windows XP

Original issue reported on code.google.com by [email protected] on 2 Jul 2012 at 11:08

Bug in solve

The following code:

from pulp import *

p = LpProblem('p', LpMaximize)
a = LpVariable('a', 0, 2)
p += a>= 1.0
p.solve()
p.setObjective(a)
p.writeLP('/tmp/test.lp')
print LpStatus[p.status]

Gives the following error:

$ python test.py 
Traceback (most recent call last):
  File "test.py", line 8, in <module>
    p.writeLP('/tmp/test.lp')
  File "/home/llpamies/local/lib/python2.7/site-packages/PuLP-1.5.0-py2.7.egg/pulp/pulp.py", line 1430, in writeLP
    f.write(self.objective.asCplexLpAffineExpression(objName, constant = 0))
  File "/home/llpamies/local/lib/python2.7/site-packages/PuLP-1.5.0-py2.7.egg/pulp/pulp.py", line 636, in asCplexLpAffineExpression
    if val == 1: ns += v.name
TypeError: cannot concatenate 'str' and 'NoneType' objects


Original issue reported on code.google.com by [email protected] on 27 Oct 2011 at 12:44

Python 3

Is PuLP going to be ported to Python 3? 

I have a software package that uses PuLP 
(http://www.github.com/pcreed/WPolyanna) that I would hope to eventually port 
to Python 3.

I am willing to assist in this process. It should only require implementing the 
syntax changes in 
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#overview-of-syntax-change
s

Páidí

Original issue reported on code.google.com by [email protected] on 19 Apr 2012 at 3:57

Not Implemented Error when trying to set initial variable values

What is the expected output? What do you see instead?

I expect to see an output with the values modified by ILP as 0 or 1, and the 
other values as .5. Instead I get a 'NotImplementedError' message.

Please provide any additional information below.

I am using the default solver on Windows 7 with Python 2.7. I'm trying to use 
var.setInitialValue(val) but it isn't working. It's giving me the error 
described above. I am doing an optimization problem in which the output is 
based on all the variables, but where PuLP only modifies/sets some of those 
variables. I want to be able to distinguish between the modified and the 
unmodified values.

Original issue reported on code.google.com by [email protected] on 22 Jun 2012 at 7:40

use subprocess for GLPK silent call

os.popen is deprecated in newer versions of Python, from what I saw, the rest 
of the library uses subprocess.

I was having some issue (return code =1) with the popen version.  I swapped 
it over to subprocess.call and it just worked.  This happened on Windows 7 
Ultimate 64-bit, Python 2.6.4, glpk 4.34 (32-bit, which i got in binary form 
from somewhere).

The attached patch should do it.

Original issue reported on code.google.com by [email protected] on 15 Apr 2010 at 4:39

Attachments:

Pulp fails with new version of lpsolve 4.36

I'm using the PuLP 1.21.04, for which much thanks - it really does
make the usually slightly grisly business of using an LP solver
painless.  Anyway, something that's changed:

Using GLPK version 4.36 (as found in debian unstable), there seems to
have been a command-line parameter change: --lpt has become --cpxlp

thanks,

John Kozak.


Original issue reported on code.google.com by [email protected] on 2 Apr 2009 at 10:41

fix for CPLEX_PY changeTimeLimit, changeEpgap (code inside)

I implemented the two missing functions changeTimeLimit and changeEpgap for 
CPLEX_PY.

I took the information how to set variables from [1] and am using both settings 
successfully on v12.4.

After applying the diff, the setting of the epgap and timeLimit attribute is 
used as usual, by defining the arguments in the constructor of pulp.CPLEX.



[1]: 
http://pic.dhe.ibm.com/infocenter/cosinfoc/v12r2/topic/ilog.odms.cplex.help/Cont
ent/Optimization/Documentation/CPLEX/_pubskel/CPLEX180.html

Original issue reported on code.google.com by [email protected] on 28 Jun 2012 at 5:27

Attachments:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.