<div dir="ltr">Hi John,<div><br></div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 28, 2014 at 1:24 PM, John Forrest <span dir="ltr"><<a href="mailto:john.forrest@fastercoin.com" target="_blank">john.forrest@fastercoin.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Matthew,<br>
<br>
I get identical results using driver4.cpp and cbc executable - if
you don't then maybe I can track it down.<br></div></div></blockquote><div>I can confirm this to be the case. I've updated my in-library timing to use CoinCpuTime(), and have confirmed the longer run times with my application. </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div><br>
In your example it would be OsiClpSolverInterface iface and maybe
there is some subtle difference between reading an mps file and
ConstructModel.</div></div></blockquote><div>I've spent some time looking into this and I'm really surprised that this is the cause of the time difference. If I use an OsiCbcSolverInterface and pass CbcMain0/1 my model pointer, I see the 2-3x slow down factor I described earlier. If a use an OsiClpSolverInterface and create a CbcModel as in the example, I see the exact same answer as the CLI, less a ~0.1s overhead (which I attribute to the time difference of reading and MPS file). Definitely good to know about, but unexpected (for me), behavior!</div>
<div><br></div><div>Thanks again,</div><div>Matt </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
<div><span><font color="#888888"><br>
<br>
John Forrest</font></span><div><div><br>
On 28/07/14 18:43, Matthew Gidden wrote:<br>
</div></div></div><div><div>
<blockquote type="cite">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I just wanted to report back. I've been hunting for the
actual main function used by the CLI, and as best I can tell
it's in CoinSolve.cpp. It doesn't appear that there's anything
extra going on between CbcMain0 and CbcMain1. Accordingly,
it's unclear to me why a call to `cbc` from the command line
returns a solution consistently faster than using the API by a
factor of ~2-3 for smallish problems. To be clear, I do the
following:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">OsiCbcSolverInterface
iface;<br>
ConstructModel(iface);</blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">int
argc = 3;<br>
const char *argv[] = {"exchange","-solve","-quit"}; </blockquote>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">CbcMain0(*iface->getModelPtr());<br>
CbcMain1(argc, argv, *iface->getModelPtr(), callBack);</blockquote>
<div><br>
</div>
<div>I'm going to leave this for now (unless someone has a clear
idea as to what the difference may be). Using CbcMain0/1
provides me a substantial speed up (3 orders of magnitude)
over naively calling branchAndBound, as one might expect. </div>
<div><br>
</div>
<div>I would still be very interested in any documentation
regarding the heuristics, cuts, branching strategies, etc.
used in CbcMain1 (again, 8k+ lines of code is burdensome to
investigate). I would also be very interested if anyone has
any open source drivers that do something like CbcMain1 (i.e.,
apply 'generally good' heuristics, cuts, etc.) but maintains
the unsolved model in order to provide user-specified,
additional options.</div>
<div><br>
</div>
<div>Again, I apologize if this is old hat for the community;
I'd also like to specifically thank John and Rolf for
assisting.</div>
<div><br>
</div>
<div>Cheers, </div>
<div><br>
</div>
</div>
<div class="gmail_extra">
<br>
<br>
<div class="gmail_quote">On Sun, Jul 27, 2014 at 10:02 AM,
Matthew Gidden <span dir="ltr"><<a href="mailto:gidden@wisc.edu" target="_blank">gidden@wisc.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">Hi John,
<div><br>
</div>
<div><br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>On Sat, Jul 26, 2014 at 1:45 PM, John
Forrest <span dir="ltr"><<a href="mailto:john.forrest@fastercoin.com" target="_blank">john.forrest@fastercoin.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>Matthew,<br>
<br>
Look at driver4.cpp in Cbc/examples. </div>
</div>
</blockquote>
</div>
<div>I'm playing around with this right now. Just
using CbcMain0 and CbcMain1 get's within an order of
magnitude of the CLI execution. I'll keep at it.
Thanks for the input! </div>
<div>
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>You could easily turn some of that into
your SolveModelLikeCli (with optional string
of parameters).<span><font color="#888888"><br>
<br>
John Forrest</font></span>
<div>
<div><br>
<br>
On 26/07/14 00:06, Matthew Gidden wrote:<br>
</div>
</div>
</div>
<blockquote type="cite">
<div>
<div>
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I've discovered that the cbc CLI
does a pretty good job at solving my
class of problems. In short, I'm
curious if there's a way to get that
rich functionality at the API level.
Ideally, I'd like to do something
like the following:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">model
= ConstructModel();<br>
SolveModelLikeCLI(model); </blockquote>
<div><br>
</div>
<div>It looks like the implementation
is one long function (cbcMain1 is
8k+ lines) and would be incredibly
difficult to cherry-pick
implementation from it. I've scoured
the API docs and haven't found
anything that looks promising.
Alternatively, is there a listing of
all the heuristics, cuts, branching
strategies, etc., used by the
default CLI?<br>
<div><br>
</div>
<div>Sorry if this is an obvious
question; I was hoping to leverage
the features already implemented
before reimplementing something
myself.</div>
<div><br>
</div>
-- <br>
<div dir="ltr">Matthew Gidden<br>
Ph.D. Candidate, Nuclear
Engineering
<div> The University of Wisconsin
-- Madison<br>
Ph. <a href="tel:225.892.3192" value="+12258923192" target="_blank">225.892.3192</a><br>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<div>
<pre>_______________________________________________
Cbc mailing list
<a href="mailto:Cbc@list.coin-or.org" target="_blank">Cbc@list.coin-or.org</a>
<a href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a>
</pre>
</div>
</blockquote>
<br>
</div>
<br>
_______________________________________________<br>
Cbc mailing list<br>
<a href="mailto:Cbc@list.coin-or.org" target="_blank">Cbc@list.coin-or.org</a><br>
<a href="http://list.coin-or.org/mailman/listinfo/cbc" target="_blank">http://list.coin-or.org/mailman/listinfo/cbc</a><br>
<br>
</blockquote>
</div>
</div>
</div>
<div>
<div><br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">Matthew Gidden<br>
Ph.D. Candidate, Nuclear Engineering
<div>The University of Wisconsin -- Madison<br>
Ph. <a href="tel:225.892.3192" value="+12258923192" target="_blank">225.892.3192</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">Matthew Gidden<br>
Ph.D. Candidate, Nuclear Engineering
<div>The University of Wisconsin -- Madison<br>
Ph. <a href="tel:225.892.3192" value="+12258923192" target="_blank">225.892.3192</a><br>
</div>
</div>
</div>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Matthew Gidden<br>Ph.D. Candidate, Nuclear Engineering<div>The University of Wisconsin -- Madison<br>Ph. <a href="tel:225.892.3192" value="+12258923192" target="_blank">225.892.3192</a><br>
</div></div>
</div></div>