[Cbc] CLI-like solve with API
John Forrest
john.forrest at fastercoin.com
Mon Jul 28 14:24:55 EDT 2014
Matthew,
I get identical results using driver4.cpp and cbc executable - if you
don't then maybe I can track it down.
In your example it would be OsiClpSolverInterface iface and maybe there
is some subtle difference between reading an mps file and ConstructModel.
John Forrest
On 28/07/14 18:43, Matthew Gidden wrote:
> Hi all,
>
> 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:
>
> OsiCbcSolverInterface iface;
> ConstructModel(iface);
>
> int argc = 3;
> const char *argv[] = {"exchange","-solve","-quit"};
>
> CbcMain0(*iface->getModelPtr());
> CbcMain1(argc, argv, *iface->getModelPtr(), callBack);
>
>
> 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.
>
> 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.
>
> Again, I apologize if this is old hat for the community; I'd also like
> to specifically thank John and Rolf for assisting.
>
> Cheers,
>
>
>
> On Sun, Jul 27, 2014 at 10:02 AM, Matthew Gidden <gidden at wisc.edu
> <mailto:gidden at wisc.edu>> wrote:
>
> Hi John,
>
>
>
>
> On Sat, Jul 26, 2014 at 1:45 PM, John Forrest
> <john.forrest at fastercoin.com <mailto:john.forrest at fastercoin.com>>
> wrote:
>
> Matthew,
>
> Look at driver4.cpp in Cbc/examples.
>
> 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!
>
> You could easily turn some of that into your SolveModelLikeCli
> (with optional string of parameters).
>
> John Forrest
>
>
> On 26/07/14 00:06, Matthew Gidden wrote:
>> Hi all,
>>
>> 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:
>>
>> model = ConstructModel();
>> SolveModelLikeCLI(model);
>>
>>
>> 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?
>>
>> Sorry if this is an obvious question; I was hoping to
>> leverage the features already implemented before
>> reimplementing something myself.
>>
>> --
>> Matthew Gidden
>> Ph.D. Candidate, Nuclear Engineering
>> The University of Wisconsin -- Madison
>> Ph. 225.892.3192 <tel:225.892.3192>
>>
>>
>> _______________________________________________
>> Cbc mailing list
>> Cbc at list.coin-or.org <mailto:Cbc at list.coin-or.org>
>> http://list.coin-or.org/mailman/listinfo/cbc
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org <mailto:Cbc at list.coin-or.org>
> http://list.coin-or.org/mailman/listinfo/cbc
>
>
>
>
> --
> Matthew Gidden
> Ph.D. Candidate, Nuclear Engineering
> The University of Wisconsin -- Madison
> Ph. 225.892.3192 <tel:225.892.3192>
>
>
>
>
> --
> Matthew Gidden
> Ph.D. Candidate, Nuclear Engineering
> The University of Wisconsin -- Madison
> Ph. 225.892.3192
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20140728/fb80fce7/attachment-0001.html>
More information about the Cbc
mailing list