[Cbc] Redirect output to stderr

John Forrest john.forrest at fastercoin.com
Thu Jan 28 09:25:05 EST 2016


Gleb,

You need to add
     msgNew1.setLogLevel(0,1);

before passing in.

If you do not pass in a message handler then the default one is cloned.  
By default Cbc turns off the OsiSolver printing but that doesn't matter 
as only that handler is changed.

When you pass in a handler then it is not cloned.  So OsiSolver switches 
it off.

The setLoglevel(0,1) tells the code that there are different levels for 
different modules.  0 is Cbc - so you will get normal output for Cbc.  
If you need more information e.g. on Cgl then you would need (3,1).

You could get same effect in a clumsier way - setting solver log level 
up to 2 and checking in your code -

   if (source_=="Cbc" && currentMessage_.detail_==1)
     std::cerr << messageBuffer_ << std::endl;

John Forrest
On 28/01/16 01:26, Gleb Belov wrote:
> Have tried CbcModel::passInMessageHandler(msgNew) with msgNEw defined 
> either as
>
>     CoinMessageHandler msgNew1(stderr);
>
> or
>
>     class StderrCoinMessageHandler : public CoinMessageHandler {
>       int print() {
>         cerr << messageBuffer_ << endl;
>       }
>       void checkSeverity() {
>       }
>     } msgNew2;
>
> Without preprocessing, the linked code says
>
>     Welcome to the CBC MILP Solver
>     Version: 2.9
>     Build Date: Jan 28 2016
>     Revision Number: 2244
>
>     command line - cbc -preprocess off -solve -quit -quit (default
>     strategy 1)
>     Option for preprocess changed from sos to off
>
>
> and nothing more. With preprocessing,
>
>     Welcome to the CBC MILP Solver
>     Version: 2.9
>     Build Date: Jan 28 2016
>     Revision Number: 2244
>
>     command line - cbc -solve -quit -quit (default strategy 1)
>     4 fixed, 144 tightened bounds, 987 strengthened rows, 0 substitutions
>     0 fixed, 44 tightened bounds, 0 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 1095 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 846 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 790 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 610 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 448 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 366 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 384 strengthened rows, 0 substitutions
>     0 fixed, 0 tightened bounds, 354 strengthened rows, 0 substitutions
>     processed model has 1437 rows, 765 columns (765 integer (535 of
>     which binary)) and 9676 elements
>     Cutoff increment increased from 1e-05 to 0.9999
>
>
> and again nothing more... Unmodified output used to have normal 
> progress log.
>
> Gleb
>
>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cbc/attachments/20160128/96df3f98/attachment.html>


More information about the Cbc mailing list