I have decided to change the solver from default solver (Coin) to GLPK
and Gurobi. After installed GLPK and Gurobi (license
activated,interactive shell worked), I've tested the command by using
the command pulp.pulpTestAll. The following text display on the
screen.
>>> import pulp
>>> pulp.pulpTestAll()
Solver pulp.solvers.CPLEX_DLL unavailable.
Solver pulp.solvers.CPLEX_CMD unavailable.
Solver pulp.solvers.COIN_CMD unavailable.
Testing continuous LP solution
Testing maximize continuous LP solution
Testing unbounded continuous LP solution
Error in CoinMP it reports Optimal
Testing MIP solution
Testing MIP relaxation
Testing feasibility problem (no objective)
Testing an infeasible problem
Testing an integer infeasible problem
Error in CoinMP to be fixed, reports Opt
Testing column based modelling
Testing column based modelling with empty constr
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.solvers.COINMP_DLL passed.
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 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.
As you can see pulp cannot find Gurobi solver. I'm sure that the PATH
in the system environment variable of Windows Seven contains the
location of the Gurobi since when I type gurobi in the command prompt,
it will show the interactive shell of the Gurobi.
1. Could anyone tell me how to configure Gurobi to work with Pulp 1.47
and how to call it from python through the Pulp interface?
2. Is the command "status = prob.solve(GLPK(msg = 0))" really call
GLPK solver? or it just call Coin solver because when I use the
command 'GLPK().solve(prob)", it displays the different text on the
screen.
Thank you for your kindness
Ukyo
ukyo wrote:
>
> As you can see pulp cannot find Gurobi solver. I'm sure that the PATH
> in the system environment variable of Windows Seven contains the
> location of the Gurobi since when I type gurobi in the command prompt,
> it will show the interactive shell of the Gurobi.
>
> 1. Could anyone tell me how to configure Gurobi to work with Pulp 1.47
> and how to call it from python through the Pulp interface?
>
The standard gurobi installation does not install gurobi into your
python environment.
Test if this is true from a python prompt (not a gurobi shell)
>>> import gurobipy
If you get an import error try using the setup.py provided by gurobi
which has these instructions at the beginning
# This script installs the gurobi module in your local environment, allowing
# you to say 'import gurobipy' from the Python shell.
#
# To install the Gurobi libraries, type 'python setup.py install'. You
# may need to run this as superuser on a Linux system.
#
# Note that your Python version must match the Gurobi version. This
# is currently Python 2.5 for Windows and Linux, and Python 2.6 for
# Mac. If you are using 64-bit Python, you will need to install 64-bit
# Gurobi.
#
# We are grateful to Stuart Mitchell for his help with this script.
> 2. Is the command "status = prob.solve(GLPK(msg = 0))" really call
> GLPK solver? or it just call Coin solver because when I use the
> command 'GLPK().solve(prob)", it displays the different text on the
> screen.
>
Yes they both should do the same thing except
msg = 0
turns off printing to the screen I suggest you compare
>>> prob.solve(GLPK())
with
>>> GLPK().solve(prob)
Vinaka
Stu
Thanks
Ukyo