duals with glpk

100 views
Skip to first unread message

S P

unread,
Mar 30, 2012, 7:28:57 AM3/30/12
to pulp-or-discuss
As a new user of pulp 1.5 I attempted to run a script:

The Sponge Roll Problem with Columnwise Column Generation from
https://code.google.com/p/pulp-or/wiki/ColumnGeneration2

but obtained the message:

duals[i] = prob.constraints[name].pi
AttributeError: 'LpConstraint' object has no attribute 'pi'

Is it possible to get the duals corresponding to constraints using
glpk ? Or the default solver for pulp ?

Many thanks

Christophe-Marie Duquesne

unread,
Apr 4, 2012, 8:18:14 AM4/4/12
to pulp-or...@googlegroups.com
Hi,

- Having a look at the test suite, I can tell you that only CPLEX_DLL,
CPLEX_CMD and COINMP_DLL are actually tested for support for setting
duals/slacks.
- However, I know for sure that GUROBI sets them too and I am pretty
sure that it does the thing right.
- YAPOSIB and PYGLPK do this as well, but I just discovered bugs in
the way they are setting the slacks. This is corrected in my branch.

In your code, you are probably using the solver GLPK, which is
actually GLPK_CMD. It internally invokes glpk via the command line
tool glpsol, and parses the output. AFAIK, GLPK_CMD does not support
setting the duals. You might want to switch to PYGLPK, which
internally invokes glpk via a python binding _and_ set the duals. For
this, you have to install the following binding:
http://tfinley.net/software/pyglpk/. However this binding is not well
maintained, and last time I tried, I could not get it to compile.

In my branch, I have swithed to this binding:
http://www.dcc.fc.up.pt/~jpp/code/python-glpk/. It is better
maintained and packaged in ubuntu as python-glpk.

Stuart, could you have a look at my branch? I told you about the
pyglpk issue a while ago and I pointed you to my patch, but then it
seems that both of us forgot about it. I just pushed an updated
version including the binding, the inclusion in the test suite, the
bugfixes regarding the slacks and a few comment/docstrings corrections
regarding other classes.

https://chmduquesne-pulp-or.googlecode.com/hg/

Cheers,
Tof

S P

unread,
Apr 6, 2012, 12:07:09 PM4/6/12
to pulp-or-discuss
Many thanks for your response.

As I am using Windows XP I would be happy to use a solver that returns
duals to pulp on that machine.
Would COINMP_DLL be usable? When I ran the pulp solver test it did not
show as being available so perhaps I have not set it up correctly?

Best



On Apr 4, 2:18 pm, Christophe-Marie Duquesne <chm.duque...@gmail.com>
wrote:
> Hi,
>
> - Having a look at the test suite, I can tell you that only CPLEX_DLL,
> CPLEX_CMD and COINMP_DLL are actually tested for support for setting
> duals/slacks.
.....
> Cheers,
> Tof

Stuart Mitchell

unread,
Apr 6, 2012, 10:20:00 PM4/6/12
to pulp-or...@googlegroups.com
Hmm strange it should still be there in the download or you can get it from http://pulp-or.googlecode.com/hg/src/pulp/solverdir/CoinMP.dll

I'll have a look at it in a couple of days to see why it is not working, or to see if I can get duals from CBC_CMD which is the preferred solver.

Stu

> Cheers,
> Tof

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To post to this group, send email to pulp-or...@googlegroups.com.
To unsubscribe from this group, send email to pulp-or-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pulp-or-discuss?hl=en.




--
Stuart Mitchell
PhD Engineering Science
Extraordinary Freelance Programmer and Optimisation Guru

Stuart Mitchell

unread,
Jun 7, 2012, 4:38:44 AM6/7/12
to pulp-or...@googlegroups.com
Duals from cbc are now supported in pulp 1.5.3

Stu

S P

unread,
Oct 1, 2012, 5:42:08 AM10/1/12
to pulp-or...@googlegroups.com

Have updated and used the new version on my Win machine to obtain the duals and everything worked very well.
After experimenting with alternatives I find that PuLP is my first choice; a very nice package, many thanks for making it available.
Reply all
Reply to author
Forward
0 new messages