Installing PuLP at Home
PuLP is a free open source software written in Python. It is used to describe optimisation problems as mathematical models. PuLP can then call any of numerous external LP solvers (CBC, GLPK, CPLEX, Gurobi etc) to solve this model and then use python commands to manipulate and display the solution.
Note that to install PuLP you must first have a working python installation as described in installing python.
PuLP requires Python >= 2.7 or Python >= 3.4.
The latest version of PuLP can be freely obtained from github.
Pip and pypi installation
By far the easiest way to install pulp is through the use of pip.
In windows (please make sure pip is on your path):
c:\Python34\Scripts\> pip install pulp
$ sudo pip install pulp $ sudo pulptest #needed to get the default solver to work
Then follow the instructions below to test your installation
To access the examples and pulp source code use the instructions below to install from source.
Windows installation from source
Install python (installing python)
Download the PuLP zipfile
Extract the zipfile to a suitable location (such as the desktop: the folder will be no longer required after installation)
Open a command prompt by clicking “Run” in the Start Menu, and type ‘cmd’ in the window and push enter.
Navigate to the extracted folder with the setup file in it. [Do this by typing ‘cd foldername’ at the prompt, where ‘cd’ stands for current directory and the ‘foldername’ is the name of the folder to open in the path already listed to the left of the prompt. To return back to a root drive, type ‘cd C:']
Type ‘setup.py install’ at the command prompt. This will install all the PuLP functions into Python’s site-packages directory.
The PuLP function library is now able to be imported from any python command line. Go to IDLE or PyDev and type
>>> from pulp import *
to load in the functions. (You need to re-import the functions each time after you close the GUI) PuLP is written in a programming language called Python, and to use PuLP you must write Python code to describe your optimization problem.
Extract the PuLP zipfile folder to a suitable location (such as your home directory - the folder will be no longer required after installation)
Open a command line navigate to the extracted zipfile with the setup file in it. [Do this by typing ‘cd foldername’ at the prompt]
Type the following at the command prompt. This will install all the PuLP functions into Python’s callable modules.
$ sudo python setup.py install
install a solver for pulp to use either
Testing your PuLP installation
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 CBC solver bundled with pulp works.
>>> import pulp >>> pulp.pulpTestAll() Testing zero subtraction Testing continuous LP solution Testing maximize continuous LP solution Testing unbounded continuous LP solution Testing Long Names Testing repeated Names Testing zero constraint Testing zero objective Testing LpVariable (not LpAffineExpression) objective Testing Long lines in LP Testing LpAffineExpression divide 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 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.PULP_CBC_CMD passed. Solver pulp.solvers.CPLEX_DLL unavailable Solver pulp.solvers.CPLEX_CMD unavailable Solver pulp.solvers.CPLEX_PY 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 Solver pulp.solvers.GUROBI_CMD unavailable Solver pulp.solvers.PYGLPK unavailable Solver pulp.solvers.YAPOSIB unavailable