Tuning CBC solver parameters in PuLP

4,650 views
Skip to first unread message

Akhil

unread,
Jan 14, 2015, 2:23:14 PM1/14/15
to pulp-or...@googlegroups.com
Hi,

This question is about changing CBC solver parameters using PuLP. CBC (with its default settings) is unable to find initial feasible solution for my milp problem even after 30K nodes. I am trying to change parameters of the solver to make its search process simpler. I've the following questions:

1) To influence node selection during strong branching, Page 16 of this link suggests that priorities should be defined for integer variables. A variable with a lower priority gets branched first. How do I set priorities for integer variables using PuLP? Solver help mentions about using 'priorityIn' command and passing a file, but there is no documentation which mentions how to write such a file. Can you please give a small example on how to set priorities?

2) How do I create a file for 'mipstart' command to load an initial feasible solution in the solver?

3) How to save CBC log file after it terminates?


Thanks a lot.

Regards,

Akhil.

Stuart Mitchell

unread,
Mar 15, 2015, 5:21:14 AM3/15/15
to pulp-or...@googlegroups.com
pulp does not support priorities with cbc  sorry,

nor does it have an easy way to create a mip start.

if you want to save the cbc log you can pass in command line parameters by using the solver parameter options

>>> prob.solve(PULP_CBC_CMD(options=[...])

where ... is a list of strings that you want to pass cbc as commandline options

Stu

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To post to this group, send email to pulp-or...@googlegroups.com.
Visit this group at http://groups.google.com/group/pulp-or-discuss.
For more options, visit https://groups.google.com/d/optout.



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

Syed Taha Munir

unread,
Mar 26, 2015, 4:10:09 AM3/26/15
to pulp-or...@googlegroups.com
This might help
 
prob.solve(PULP_CBC_CMD(fracGap = 0.00001, maxSeconds = 500, threads = None))

 

kind regards

Luis Damián Reyes Rodríguez

unread,
May 31, 2016, 9:01:28 PM5/31/16
to pulp-or-discuss
Akhil asked: 
3) How to save CBC log file after it terminates?
Stuart answered: 
if you want to save the cbc log you can pass in command line parameters by using the solver parameter options
>>> prob.solve(PULP_CBC_CMD(options=[...]) 

I have gone through the documentation of CBC to see what option would set the log file address, but to no avail. I even tried running ">>> cbc -verbose 15 ? " in a (Windows) console to see all the non-documented parameters. 

I tried including the string  "> myLogFile.txt" as the last entry in the list of options fed to PULP_CBC_CMD, hoping that the program would just feed the raw input parameters to a console, sot that then the console would just redirect all output to myLogFile.txt. Alas, that doesn't work, nothing happens. Can someone explain how to do it?

Thanks.

Matthew Pearlson

unread,
May 2, 2017, 6:22:02 PM5/2/17
to pulp-or-discuss
Thanks for the support Syed. Can you point me to the documentation on fracGap, and maxSeconds? 
Thanks! Matthew


On Thursday, March 26, 2015 at 4:10:09 AM UTC-4, Syed Taha Munir wrote:

Stuart Mitchell

unread,
May 2, 2017, 6:27:34 PM5/2/17
to pulp-or...@googlegroups.com
here is the cbc documentation but it doesn't really have the options listed :-(

MaxSeconds is self explanatory as in the maximum number of seconds it will run.

FracGap is a number between 0 and 1 which determines when branch and bound will complete by comparing the best Integer solution with the current lower bound.

Stu

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to pulp-or-discuss@googlegroups.com.
Visit this group at https://groups.google.com/group/pulp-or-discuss.

For more options, visit https://groups.google.com/d/optout.

xu...@leantaas.com

unread,
Sep 25, 2018, 8:09:02 PM9/25/18
to pulp-or-discuss
Hi Stu, 

I am currently facing the same problem - trying to understand CBC parameters. I think the link is missing in your post. I read the documentation here https://pythonhosted.org/PuLP/solvers.html#pulp.solvers.LpSolver_CMD and I think these are all the parameters tunable for CBC 
class pulp.solvers.COIN_CMD(path=NonekeepFiles=0mip=1msg=0cuts=Nonepresolve=Nonedual=Nonestrong=Noneoptions=[]fracGap=NonemaxSeconds=Nonethreads=None)
I understand fracGap and maxSeconds from your other posts but still trying to figure out the others. Especially about "threads", the format of "cuts", and perhaps "options". Previous I just used the default setting but now a problem takes too much time so I need to dig more to reduce the running time. Any suggestion is appreciated.
PS: I am running an MIP with around 5000 variables and 5000 constraints and it takes 5 hours to complete.

On Tuesday, May 2, 2017 at 3:27:34 PM UTC-7, Stuart Mitchell wrote:
here is the cbc documentation but it doesn't really have the options listed :-(

MaxSeconds is self explanatory as in the maximum number of seconds it will run.

FracGap is a number between 0 and 1 which determines when branch and bound will complete by comparing the best Integer solution with the current lower bound.

Stu
On Wed, May 3, 2017 at 2:02 AM, Matthew Pearlson <mpea...@gmail.com> wrote:
Thanks for the support Syed. Can you point me to the documentation on fracGap, and maxSeconds? 
Thanks! Matthew

On Thursday, March 26, 2015 at 4:10:09 AM UTC-4, Syed Taha Munir wrote:
This might help
 
prob.solve(PULP_CBC_CMD(fracGap = 0.00001, maxSeconds = 500, threads = None))

 

kind regards

On Wednesday, January 14, 2015 at 8:23:14 PM UTC+1, Akhil wrote:
Hi,

This question is about changing CBC solver parameters using PuLP. CBC (with its default settings) is unable to find initial feasible solution for my milp problem even after 30K nodes. I am trying to change parameters of the solver to make its search process simpler. I've the following questions:

1) To influence node selection during strong branching, Page 16 of this link suggests that priorities should be defined for integer variables. A variable with a lower priority gets branched first. How do I set priorities for integer variables using PuLP? Solver help mentions about using 'priorityIn' command and passing a file, but there is no documentation which mentions how to write such a file. Can you please give a small example on how to set priorities?

2) How do I create a file for 'mipstart' command to load an initial feasible solution in the solver?

3) How to save CBC log file after it terminates?


Thanks a lot.

Regards,

Akhil.

--
You received this message because you are subscribed to the Google Groups "pulp-or-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pulp-or-discu...@googlegroups.com.
To post to this group, send email to pulp-or...@googlegroups.com.



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

CONFIDENTIALITY NOTICE - This e-mail, including any attachments, may contain privileged and confidential information. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution, or use of the contents is prohibited and maybe illegal.  If you have received this transmission in error, please immediately notify us by “reply to sender only” e-mail and destroy the original transmission and its attachments without reading them or saving them to disk.
Reply all
Reply to author
Forward
0 new messages