[Symphony-tickets] [SYMPHONY] #61: Deleting Rows and Columns with
OsiSymSolverInterface fails
SYMPHONY
coin-trac at coin-or.org
Fri Jan 19 11:07:58 EST 2007
#61: Deleting Rows and Columns with OsiSymSolverInterface fails
-----------------------------------------+----------------------------------
Reporter: lutz.goehring | Owner: tkr
Type: defect | Status: new
Priority: major | Milestone: 5.2
Component: Not Sure | Version: 5.1.2
Keywords: delete rows, delete columns |
-----------------------------------------+----------------------------------
I am having a problem of size 553 x 2320 stored in Class of type
AgentProblem and consisting of a sparse matrix which I attached as MPS.
To reduce the problem size I delete the zero rows and columns by doing
something like:
...
AgentProblem* specificProblem;
specificProblem->loadProblem(....),//load problem from somewhere
specificProblem->findEmptyRowsAndCols();
OsiSymSolverInterface::deleteRows( specificProblem-
>getNumberOfRowsToDrop() , specificProblem->getRowsToDrop() );
OsiSymSolverInterface::( specificProblem->getNumberOfColsToDrop() ,
specificProblem->getColsToDrop() );
to delete rows and cols which are zero.
During runtime this results in the Error message:
*** glibc detected *** double free or corruption (!prev): 0x08605f00 ***
Aborted
In parallel, I am also using OSL via the OsiSolverInterface:
OsiOslSolverInterface::deleteRows( specificProblem-
>getNumberOfRowsToDrop() , specificProblem->getRowsToDrop() );
OsiOslSolverInterface::( specificProblem->getNumberOfColsToDrop() ,
specificProblem->getColsToDrop() );
This works fine and gives the correct result.
While looking at the mps I realized that the zero rows and columns are
thrown out anyway right away by SYMPHONY. So I conjecture that deleting
zero rows and cols is superfluous?!
The code for finding the empty Rows and cols is the following:
void AgentProblem::findEmptyRowsAndCols(){
numberofrowstodrop = 0;
numberofcolstodrop = 0;
//find rows to delete:
for (int i = 0; i < getNumRows(); i++) {
bool mark = true;
if ( fabs(getRightHandSide()[i]) > eps ) continue;
for (int j = 0; j < getNumCols(); j++)
if (fabs(getMatrixByCol()->getCoefficient(i,j)) >
eps ){
mark = false;
continue;
}
if (mark) rowsToDrop[numberofrowstodrop++] = i;
}
//find columns to delete:
for (int j = 0; j < getNumCols(); j++) {
bool mark = true;
if ( fabs(getObjCoefficients()[j]) > eps ) continue;
for (int i = 0; i < getNumRows(); i++)
if (fabs(getMatrixByCol()->getCoefficient(i,j)) >
eps ) {
mark = false;
continue;
}
if (mark) colsToDrop[numberofcolstodrop++] = j;
}
}
--
Ticket URL: <https://projects.coin-or.org/SYMPHONY/ticket/61>
SYMPHONY <http://projects.coin-or.org/SYMPHONY>
The SYMPHONY framework for parallel branch-and-cut algorithms.
More information about the Symphony-tickets
mailing list