38 throw ErrorClass(
"Error trying to read MPS file");
45 std::ostringstream outStr;
47 outStr <<
"Detected " <<
m_nOfSOS <<
" special ordered sets" << std::endl;
50 int numberEntries =
m_SOS[i]->numberEntries();
51 const int * which =
m_SOS[i]->which();
52 const double * weights =
m_SOS[i]->weights();
53 outStr <<
"SOS " << i <<
" has type " <<
m_SOS[i]->setType();
54 outStr <<
" and " << numberEntries <<
" entries:" << std::endl;
55 for (
int j=0;j<numberEntries;j++)
56 outStr <<
" Idx: " << which[j] <<
" Weight: " << weights[j] << std::endl;
64 while (
m_MpsData->reader()->whichSection ( ) != COIN_ENDATA_SECTION )
66 switch (
m_MpsData->reader()->whichSection ( ))
68 case COIN_QUAD_SECTION:
73 if (status != -2 && status != -3)
74 throw ErrorClass(
"Error trying to read QUADOBJ section");
79 std::ostringstream outStr;
80 int numberColumns=
m_MpsData->getNumCols();
81 outStr <<
"Quadratic objective has " <<
m_quadColumnStart[numberColumns] <<
" entries" << std::endl;
82 outStr <<
"Column starts:" << std::endl;
83 for (
int i=0; i<=numberColumns; i++)
85 for (
int i=0; i<numberColumns; i++)
89 outStr <<
"Column " << i <<
": index value" << std::endl;
101 case COIN_CONIC_SECTION:
106 if (status != -2 && status != -3)
107 throw ErrorClass(
"Error trying to read cone section");
112 std::ostringstream outStr;
113 outStr <<
"Conic section has " <<
m_nOfCones <<
" cones" << std::endl;
117 outStr <<
"(type " <<
m_coneType[i] <<
"):" << std::endl;
119 outStr <<
" " <<
m_coneIdx[j] << std::endl;
129 case COIN_BASIS_SECTION:
132 std::ostringstream outStr;
133 outStr <<
"Basis section has not been implemented yet" << std::endl;
140 throw ErrorClass(
"encountered unknown section in MPS file");
197 int numnonz =
m_MpsData->getNumElements();
200 std::ostringstream outStr;
210 for(i = 0; i < numvar; i++)
227 double objWeight = 1.0;
230 double *p =
const_cast<double*
>(
m_MpsData->getObjCoefficients());
231 for(i = 0; i < numvar; i++)
233 objectiveCoefficients->
indexes[i] = i;
234 objectiveCoefficients->
values[i] = *(p++);
240 "min",
m_MpsData->objectiveOffset(), objWeight, objectiveCoefficients) ;
241 delete objectiveCoefficients;
242 objectiveCoefficients = NULL;
247 double constant = 0.0;
248 for(i = 0; i < numrows; i++)
257 int valuesEnd = numnonz - 1;
259 int indexesBegin = 0;
260 int indexesEnd = numnonz - 1;
270 int numberColumns=
m_MpsData->getNumCols();
272 if (numberElements > 0)
274 int *rowindexes =
new int[numberElements];
275 for (
int i=0; i<numberElements;i++)
277 int *colindexes =
new int[numberElements];
278 for (
int i=0; i<numberColumns; i++)
281 osinstance->setQuadraticCoefficients(numberElements, rowindexes, colindexes,