[Cbc] The Silence of the LPs

Dirk Eßer essdir at web.de
Tue Feb 25 04:08:33 EST 2014


Hi John,

thanks for the tip. I overlooked, that you could install the message 
handler on the CbcModel directly, and your response pointed me into that 
direction. Using "passInMessageHandler" of the CbcModel instance solved 
my problems and silenced the solver.

Thanks again,
Dirk

Am 23.01.2014 12:42, schrieb John Forrest:
> Dirk,
>
> You will be better off using OsiClpSolverInterface rather than 
> OsiCbcSolverInterface as OsiCbc is an unhappy mixture of linear solver 
> and integer solver and is not much tested.
>
> If you replace OsiCbc with OsiClp, derive the message handler from 
> CbcMessageHandler and pass the message handler into the CbcModel then 
> it should work as you expect.
>
> John Forrest
>
> On 22/01/14 17:37, Dirk Eßer wrote:
>> Hi everybody!
>>
>> I just started porting an application of mine from lpsolver to CBC 
>> and things work fine so far. There is one minor annoyance, though: 
>> despite me defining my own "CoinMessageHandler" subclass and 
>> "passInMessageHandler"-ing it into any "OsiSolverInterface" I can 
>> find, there seems to be some code in the CBC library, which doesn't 
>> care about my efforts, and insists on making itself heard.
>>
>> This is slightly annoying, since the application is a server 
>> application, which solves a lot of (small to medium size) MIPs in a 
>> row on client requests, and the messages from CBC tend to blow up the 
>> log files considerably with noise, we are not interested in.
>>
>> The messages generated are "Cbc3007W" ("No integer variables - 
>> nothing to do"), "Cbc0004I" ("Integer solution of x found after x 
>> iterations and x nodes (x seconds)"), "Cbc0001I" ("Search completed - 
>> best objective x, took x iterations and x nodes (x seconds)"), and 
>> "Cbc0035I" ("Maximum depth x, x variables fixed on reduced cost").
>>
>> I'd rather not resolve this issue by brute force (say, via "FILE* p = 
>> fopen("/dev/null", "w"); CoinMessageHandler printer(p); ..." -- if 
>> that's at all viable).
>>
>> I am not using the "CbcSolver" class, only the "CbcModel" and 
>> "Osi[Cbc]SolverInterface" and related APIs. The MIPs are generated 
>> on-the-fly from data passed in by the client.
>>
>> Any input on this is greatly appreciated.
>>
>> Cheers,
>> Dirk
>>
>> P.S. For reference, here's my message handler and set-up code.
>>
>>     class MessageHandler: public CoinMessageHandler
>>     {
>>     public:
>>         MessageHandler(): CoinMessageHandler() {}
>>         MessageHandler(const MessageHandler& r): 
>> CoinMessageHandler(r) {}
>>         MessageHandler& operator= (const MessageHandler& r) { 
>> CoinMessageHandler::operator=(r); return *this; }
>>         virtual CoinMessageHandler* clone() { return new 
>> MessageHandler(*this); }
>>         virtual int print() { return 0; }
>>     };
>>
>> which is injected before and after model construction:
>>
>>     void
>>     matrix_builder::set_printer(OsiSolverInterface* pf, 
>> MessageHandler& printer)
>>     {
>>         if (pf) pf->passInMessageHandler(&printer);
>>     }
>>
>> and
>>
>>     OsiCbcSolverInterface iface;
>>     CoinPackedMatrix pmx(false, num_columns, num_rows, num_elements, 
>> matrix, columns, starts, lengths);
>>
>>     iface.setObjSense(-1.0);
>>     iface.loadProblem(pmx, 0, 0, objective, senses, rights, 0);
>>     iface.passInMessageHandler(&printer);
>>
>>     CbcModel model* = new CbcModel(iface);
>>     ... a few more things to set up SOS and integer declarations ...
>>
>>     set_printer(model->solver(), printer);
>>     set_printer(model->continuousSolver(), printer);
>>     set_printer(model->referenceSolver(), printer);
>>
>> where "printer" is a reference to an instance of "MessageHandler".
>>
>> _______________________________________________
>> Cbc mailing list
>> Cbc at list.coin-or.org
>> http://list.coin-or.org/mailman/listinfo/cbc
>>
>>
>
> _______________________________________________
> Cbc mailing list
> Cbc at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cbc
>



More information about the Cbc mailing list