[Coin-discuss] Message handling
John J Forrest
jjforre at us.ibm.com
Tue Jul 30 17:37:03 EDT 2002
If COIN is to be taken seriously it needs uniform message handling. I put
together a message handler for COIN LP which has just received IBM
clearance. I have put this in Osi (the development branch) so people can
look at it and tell me to start again.
There is a simple message handler, from which user specific ones can be
derived. For each module there is a simple description of the messages
e.g. Osi/include/OsiOsiMessage.hpp and OsiOsiMessage.cpp
So for instance - for the developer, OSI_MPS_DUPROW is defined in
Osi/include/OsiOsiMessage.hpp
and in OsiOsiMessage.cpp the text is given as:
{OSI_MPS_DUPROW,3004,0,"Duplicate row %s at line %d < %s >"},
In the code the message is created by:
handler_->message(OSI_MPS_DUPROW,messages_)
<<mpsfile.rowName()<<mpsfile.cardNumber()<<mpsfile.card()
<<OsiMessageEol;
and the default would print this to stdout as
Osi3004W Duplicate Row XYXYXY at line 1234 < COLUMN7 XYXYXY
4.0>
A bit clumsy but fairly near to std::cout syntax.
The user (as against developer) can create a derived message handler - see
OsiOslSolverInterfaceTest.cpp for an example.
The amount of detail wanted may be specified etc.
Many design features are similar to OSL's EKK messages (which were designed
- so obviously I was not involved :-)). This can be changed.
I like language support so that is in - if a particular message is not
there it defaults to US english - see OsiMpsReaderTest.cpp for some
atrocious Italian.
In OsiOslSolverInterfaceTest.cpp I have put in code to allow OSL messages
to be passed to the message handler. This can be used as a template for
anyone who has a sophisticated program calling OSL.
It is a bit sketchy for now and there are very few messages There are many
more messages in Clp.
Comments welcomed.
John Forrest
More information about the Coin-discuss
mailing list