[Cgl] Re: [Coin-discuss] generateCpp()

fmargot at andrew.cmu.edu fmargot at andrew.cmu.edu
Wed Oct 4 12:13:11 EDT 2006



On Tue, 3 Oct 2006, John J Forrest wrote:

> fmargot at andrew.cmu.edu wrote on 10/03/2006 03:32:57 PM:
>
>>
>>
>> On Mon, 2 Oct 2006, John J Forrest wrote:
>>
>>> Whom else!
>>>
>>> If a cut generator (or heuristic etc) is modified from its default
>>> constructor and then this is called  a series of lines of code is
> output
>>> which changes the default generator to the current state.
>>>
>>
>> Except that there is some kind of key associated with the lines of code:
>> I see lines starting with
>>
>> 0
>> 3
>> 4
>
> The way it works is that just before going into CbcModel branch and cut
> the stand-alone solver sees that -cpp was set (or cpp if interactive).  It
> goes through all generators, heuristics CbcModel and associated solver
> asking them to write lines to file.  Then it calls a bit of code called
> generateCode (in CoinSolve.cpp).  This goes through file several times -
> first doing ones with 0, then 1 etc.  Some levels may be skipped so if cpp
> was just 1 then it does not put out commands where the generator has a
> default value (i.e. it only puts out level 3 and not level 4).  If you
> want the default changes (so you can modify them ) then you up the cpp
> value.
>>
>> What is the meaning of these keys? Is it possible to have a line
>> starting with other numbers? What about 1 and 2?
>
> 0,3,5 and 8 always go out (cpp==0)
> 1 and 6 go out if cpp==1
> 2 4 and 7 go out if cpp>1
>
> You can see what they were meant to be if you search for std::string
> header in CoinSolve.cpp as those are the comments which go out in created
> code.
>

This explains how the keys are used by cbc, not the meaning of the keys.
The method CglCutGenerator::generateCpp() has to be documented, so that 
somebody implementing a new generator can write a correct 
reimplementation of it.

I gather that

key=0 means "always written"
key=3 means "not default value"
key=4 means "default value"

What is the meaning of key=k, for k= 1, 2, 5, 6, 7, 8?

>From the above description of the use, I see no reason to have more than 
3 keys. It would then be more logical to have these keys as k=0,1,2.
Alternatively, we could have

generateCpp(FILE *fp, int output_level)

with several levels of output, among which:

0: print a "set" line only for changes from default parameter values
1: print a "set" line for all parameters values

as well as any other output level deemed useful.

The file would then be free of these mysterious key codes and there
would be no need for a subsequent parsing by the calling program.

Francois







>
>>
>>> I wrote it when feeling in need of light entertainment, however it has
> a
>>> serious purpose.  If you use the stand-alone cbc (or any other solver)
>>> then your commands may change the behavior of the cut generators. When
>>> you like the result you add -cpp 1 (other numbers create more output)
> and
>>> lo and behold  a driver is created which mimics those actions.
>>>
>>
>> I add "-cpp 1" to what? Command line of cbc?
>>
>> Francois
>


More information about the Cgl mailing list