Re: pulp-or bug and CPLEX parameter setting

207 views
Skip to first unread message

Stuart Mitchell

unread,
Aug 29, 2009, 11:48:16 AM8/29/09
to Christopher Moore, pulp-or...@googlegroups.com
Thanks I will try to fix that as soon as possible.

I assume you have already tried setting the epgap to somthing large
(perhaps over 100%) to get a solution quickly?

Stu

Christopher Moore wrote:
> Dr. Michell,
>
> I am using pulp-or 1.3.07 and I appear to have found a bug in
> solvers.py. Around line 1450, there is a call to set the timeLimit
> which I have fixed below:
>
> if self.timeLimit:
> lp.solverModel.setParam("TimeLimit", self.timeLimit) ##
> was self.epgap
>
> as you can see from the comment, in the original file, self.timeLimit is
> self.epgap.
>
> ============
> I found the error above while I was cruising the code trying to
> understand how to set the timelimit and other parameters in CPLEX. I
> realize the bug that I found isn't even in the CPLEX code, but I was
> desperately trying to find some hint of how to do it when I noticed the
> bug. Could you tell me how to set parameters in cplex? The reason I'd
> like to do it is that I have a very large problem that takes 14+ hours
> (I haven't run to completion). However, I don't need a provably
> optimal solution. For this problem, I can take an answer that is simply
> decent instead of optimal.
>
> I've tried adding code to CPLEX_CMD to send "set timelimit 3600.0" to
> CPLEX directly and well as several combinations of using
> CPLEX_DELL.lib.CPXsetdblparam. For instance, I tried adding the following:
>
> def setTimeLimit(self, timeLimit=0.0):
> """
> Make cplex limit the time it takes --added CBM 8/28/09
> """
> CPLEX_DLL.lib.CPXsetdblparam.argtypes = [ctypes.c_void_p,
> ctypes.c_int,
> ctypes.c_double]
>
> CPLEX_DLL.lib.CPXsetdblparam(self.env,CPLEX_DLL.TILIM,float(timeLimit))
>
> to the CPLEX_DLL class just following your example in changeEpgap() in
> that same class. None of these have the desired effect.
>
> Perhaps there is a better way to get pulp-or to output an intermediate
> solution that would be good enough for my use?
>
>
> Thanks for any help,
>
> Christopher Moore
> Broad Institute of MIT and Harvard
>
> cmo...@broadinstitute.org
>
>

--
___________________________________
Dr Stuart Mitchell
Research Fellow
Light Metals Research Centre (LMRC)
University of Auckland
Private Bag 92019
Auckland
New Zealand

Ph (wk) +64 9 3737599 ext 84867
(ddi) +64 9 9234967
(fax) +64 9 3737925
(mb) +64 21 441331
___________________________________

s_mitchell.vcf

Stuart Mitchell

unread,
Aug 31, 2009, 5:21:41 AM8/31/09
to Christopher Moore, pulp-or...@googlegroups.com
when you initialise the solver

>>> solver = CPLEX_DLL(epgap = 1)

then later

>>> prob.solve(solver)

Stu

Christopher Moore wrote:
> Hi,
>
> Thanks for the quick reply. I haven't tried setting epgap. Long term
> it isn't right for my application, but it would get me started. Can you
> tell me how to set epgap for CPLEX?
>
> Thanks,
>
> Chris

>> <s_mitchell.vcf>

s_mitchell.vcf

Stuart Mitchell

unread,
Sep 2, 2009, 11:35:58 PM9/2/09
to Christopher Moore, pulp-or...@googlegroups.com
I have made changes to solver.py on launchpad
(available at https://launchpad.net/pulp-or)

Can you see if they work for you before I update the other repositories

Stu


Christopher Moore wrote:
> Hi,
>
> Thanks for the quick reply. I haven't tried setting epgap. Long term
> it isn't right for my application, but it would get me started. Can you
> tell me how to set epgap for CPLEX?
>
> Thanks,
>
> Chris
>
> On Aug 29, 2009, at 11:48 AM, Stuart Mitchell wrote:
>

>> <s_mitchell.vcf>

s_mitchell.vcf

Stuart Mitchell

unread,
Sep 3, 2009, 7:24:00 PM9/3/09
to Christopher Moore, pulp-or...@googlegroups.com
I was reading the ctypes documentation and it does say it supports macs.

I also read that the .jnilib extension is for java libraries. Is there
perhaps a libcplex111.dylib floating around your distribution?

Stu


Christopher Moore wrote:
> Hi,
>
> I figured out that part of my problem is that CPLEX_DLL fails and since
> I was following the examples and letting pulp find a solver, it was
> using CPLEX_CMD. I'm on a mac with cplex 11.1 so I'm not sure CPLEX_DLL
> can work for me. The "os x" (darwin) distribution of cplex does not
> include libcplex111.so or .dll. Instead, there is a libcplex111.jnilib
> but putting its path in to the pulp.cfg.linux file as CplexPath gives an
> error:
>
> OSError:
> dlopen(/Users/cmoore/bin/cplex1111.x86darwin/cplex111/bin/x86_darwin8_gcc4.0/libcplex111.jnilib,
> 6): Symbol not found: ___eprintf
>
> so it looks like I may be out of luck on that front. However,
> solver=CPLEX_CMD(options=["set timelimit 120"]) does work for me.
> Thanks for pointing me in the right direction (I couldn't find this in
> the docs). I hope the bug fix I noticed along the way helps out even
> though I can't test it.
>
>
> Thanks for your work on pulp and your help on this!
>
> Chris

s_mitchell.vcf
Reply all
Reply to author
Forward
0 new messages