XML file format: serialized models and solutions
CPLEX offers an XML file format to support serialized models and solutions.
Concert Technology for C++ users offers a suite of classes
for serializing CPLEX models
(that is, instances of IloModel ) and solutions
(that is, instances of IloSolution) through
XML. The CPLEX C++ API Reference Manual documents
the XML serialization API in the group optim.concert.xml.
That group includes these classes:
IloXmlContextallows you to serialize an instance ofIloModelorIloSolution. This class offers methods for reading and writing a model, a solution, or both a model and a solution together. There are examples of how to use this class in the reference manual.IloXmlInfooffers methods that enable you to validate the XML serialization of elements, such as numeric arrays, integer arrays, variables, and other extractables from your model or solution.IloXmlReadercreates a reader in an environment (that is, in an instance ofIloEnv). This class offers methods to check runtime type information (RTTI), to recognize hierarchic relations between objects, and to access attributes of objects in your model or solution.IloXmlWritercreates a writer in an environment (that is, in an instance ofIloEnv). This class offers methods to access elements and to convert their types as needed in order to serialize elements of your model or solution.
There is a fundamental difference between writing an XML file of a model and writing an LP/MPS/SAV file of the same extracted model. Some higher level modeling constructs do not have an equivalent representation in the solver engine and have to be transformed when passed to the solver engine. The XML file will represent those constructs as such. In contrast, the LP/MPS/SAV file will represent only the transformed model. That transformed model obscures those features because of the automatic transformation that took place.