[Cbc] CBC stand-alone vs callable

Andrea Manno andrea.manno at polimi.it
Wed Mar 21 12:36:29 EDT 2018


Hi Tom,


Thank you for the alternative solution Tom, however I implemented the solution proposed by John Forrest and it works well!


Andrea

________________________________
Da: Cbc <cbc-bounces at coin-or.org> per conto di Tom Anderson <twic at urchin.earth.li>
Inviato: mercoledì 21 marzo 2018 14:40:21
A: cbc at list.coin-or.org
Oggetto: Re: [Cbc] CBC stand-alone vs callable

Hi Andrea,

Alternatively, if you have a command line using the stand-alone cbc which
you are happy with, then you can add the -cpp flag to it to generate C++
code which will reproduce the command-line use. The help text says:

cpp(Generate) : Generates C++ code
Once you like what the stand-alone solver does then this allows you
to generate user_driver.cpp which approximates the code.  0 gives
simplest driver, 1 generates saves and restores, 2 generates saves
and restores even for variables at default value. 4 bit in cbc generates
size dependent code rather than computed values.  This is now deprecated
as you can call stand-alone solver - see Cbc/examples/driver4.cpp.

Although this is deprecated in favour of calling CbcMain1 directly, it
still works as far as i can tell. It's useful if you want to write your
own heuristics, or do other funky stuff that you can't express through the
command-line interface (which i do!).

Regards,
tom

On Wed, 21 Mar 2018, John Forrest wrote:

> Andrea,
>
> If you use CbcMain0 and CbcMain1 you can get the same functionality.  Look at
> the various driver*.cpp examples in Cbc/examples.
>
> John Forrest
>
> On 21/03/18 11:17, Andrea Manno wrote:
>>
>> Dear all,
>>
>>
>> I would kindly ask you two questions about the usage of CBC.
>>
>>
>> 1) I am using the callable version of CBC as the MILP solver unit embedded
>> in a c++ code. So what I am doing is nothing but including all the needed
>> CBC, OSI and CGL  header file and linking all the necessary library in
>> order to use the branchAnbBound() method of the CbcModel class. However I
>> would like to replicate exactly the performance of the stand-alone
>> executable version of cbc that I have used on the same instances as AMPL
>> solver. Anyone knows the setting of the stand-alone executable version of
>> cbc? I'am referring to the default options of presolve/preprocess,
>> heuristics and cuts in the stand-alone version.
>>
>>
>> 2) In case preprocess/presolve is needed for the answer of question 1),
>> which is the right way to invoke the preprocess/presolve before the
>> branchAnbBound() method (It si not so clear from the examples and from the
>> user guide). It si possible to have a simple example?
>>
>>
>> Thank you so much,
>>
>>
>> Andrea Manno
>>
>>
>>
>> _______________________________________________
>> Cbc mailing list
>> Cbc at list.coin-or.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__list.coin-2Dor.org_mailman_listinfo_cbc&d=DwID-g&c=Ngd-ta5yRYsqeUsEDgxhcqsYYY1Xs5ogLxWPA_2Wlc4&r=O8sJm66476KNQb0_wC5yq8bL2q13RBM-tS6AWZrDuUY&m=LR24XktatkwP7m66AJbNNQHZbR8RJaQfKTA82MfX6EE&s=etpU9PEI9BoOCyxoLReE4a9zywuzqGFr2WN7_AVPkZ8&e=
>
>
>

--
My opinion is that some platforms and frameworks come bundled with a set
of philosophical characteristics that most practitioners adopt. Some
popular open source web frameworks include a poster of Knuth's famous
quote about premature optimization and adopters consider that quote
to mean than it does, thereby expressly avoiding spending time thinking
about performance because doing so might lead to time spent on optimizing
code and that is evil. -- bhauer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20180321/85677e2d/attachment.html>


More information about the Cbc mailing list