[Coin-discuss] Controlling printing for CbcStrategyDefault

John J Forrest jjforre at us.ibm.com
Fri Jul 7 11:48:27 EDT 2006


Kish,

You can derive from CbcStrategyDefault and do what you want but it seems a 
sensible think to change the default to pass in the CbcModel's handler. So 
I will change.

Until I do - add 

process->passInMessageHandler(model.messageHandler());

just after process is created (line 300 of CbcStrategy.cpp)

and tell me if that works.

Your other point about infeasible solutions is more complicated and I will 
put the changes into the development branch.

John Forrest



Kish Shen <kish.shen at crosscoreop.com> 
Sent by: coin-discuss-bounces at list.coin-or.org
07/07/2006 11:22 AM
Please respond to
Discussions about open source software for Operations Research 
<coin-discuss at list.coin-or.org>


To
coin-discuss at list.coin-or.org
cc

Subject
[Coin-discuss] Controlling printing for CbcStrategyDefault






Hi,

I have been controlling the printing in various Coin components by 
defining a 
derived class of CoinMessageHandler:

class DerivedHandler : public CoinMessageHandler 
{
public:
    virtual int print();
};

and the print() basically redirects the messages into streams that the 
user 
could selectively control.

so when I declare something like a new CbcModel, I change its message 
handling 
to use my DerivedHandler:

    CbcModel* model = lpd->lp->mipmodel;
    DerivedHandler* mipMessageHandler = new DerivedHandler;
    model->passInMessageHandler(mipMessageHandler);

this works, except when I tried to use CbcStrategyDefault:

    CbcStrategyDefault strategy(true,5,5);
    strategy.setupPreProcessing(2);
    model->setStrategy(strategy);

when solving, this seem to generate Cgl messages that do not go through my 

print handler, and there seems to be no way of adding my print handler to 
whatever is generating the message (a CglPreProcess?).

The only way I can control the message is to use the setupPrinting() 
method:

     strategy.setupPrinting(*model, 0);

but this is not what I need. It would be nice if there is some way of 
passing 
in a print handler here, rather than just control the log level. Can this 
be 
done?

Thanks in advance for any help!


Cheers,

Kish


_______________________________________________
Coin-discuss mailing list
Coin-discuss at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/coin-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20060707/597e688b/attachment.html>


More information about the Coin-discuss mailing list