[Clp] An error in CoinStructuredModel?
John Forrest
john.forrest at fastercoin.com
Wed Mar 6 04:41:25 EST 2013
Siamak,
The problem lies in the reason why CoinModel (which is one block of a
structured model) was written. It was written so that it would be fast
and flexible when adding individual elements and rows/columns. So it is
stored in a hashed triple format. When the model is complete then it is
converted to a more normal format using CoinPackedMatrix.
CoinStructuredModel just wanted the second format and that is what it
gets. So the triple format does not exist. The elements exist and can
be looked at by -
const CoinPackedMatrix * matrix = block.packedMatrix();
const int * row = matrix->getIndices();
const CoinBigIndex * columnStart = matrix->getVectorStarts();
const int * columnLength = matrix->getVectorLengths();
const double * elementByColumn = matrix->getElements();
int numberColumns = block.numberColumns();
for (int i=0;i<numberColumns;i++) {
for (CoinBigIndex j=columnStart[i];
j<columnStart[i]+columnLength[i];j++)
printf("%d %d %g\n",i,row[j],elementByColumn[j]);
}
I am looking at CoinStructuredModel for other reasons, so I may be able
to add some functionality if you need it.
John Forrest
More information about the Clp
mailing list