[Coin-discuss] Controlling printing for CbcStrategyDefault
Kish Shen
kish.shen at crosscoreop.com
Fri Jul 7 11:22:02 EDT 2006
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
More information about the Coin-discuss
mailing list