<br><font size=2 face="sans-serif">Miroslav,</font>
<br>
<br><font size=2 face="sans-serif">It should be okay now. It was
not designed to do slacks initially and in fact would complain if NDEBUG
had not been defined.</font>
<br>
<br><font size=2 face="sans-serif">John Forrest</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Miroslav Karamanov <miroslav@andrew.cmu.edu></b>
</font>
<br><font size=1 face="sans-serif">Sent by: coin-discuss-bounces@list.coin-or.org</font>
<p><font size=1 face="sans-serif">12/29/2004 03:35 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
Discussions about open source software for Operations Research
</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">coin-discuss@list.coin-or.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">[Coin-discuss] OsiClpSolverInterface::getBInvACol()</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hello,<br>
<br>
It seems the tableau obtained by OsiClpSolverInterface::getBInvACol() <br>
differs from the one from OsiClpSolverInterface::getBInvARow() and the
<br>
difference is in the sign of the slack/artificial columns.<br>
Matthew Galati kindly helped me localize the problem and pointed out <br>
that this is not the case when the tableau is obtained through Clp, not
<br>
through Osi. The function below shows this. I attached a small test <br>
instance too but the problem appeared with all instances I tested.<br>
The incorrect routine seems to be OsiClpSolverInterface::getBInvACol().<br>
<br>
Best,<br>
Miroslav<br>
<br>
==========================<br>
Miroslav Karamanov<br>
PhD Student<br>
Carnegie Mellon University<br>
==========================<br>
<br>
<br>
========================================================<br>
void TableauCheck(OsiClpSolverInterface * siCLP){<br>
<br>
/*<br>
---<br>
--- CLP tableau from getBInvARow = from getBInvACol<br>
---<br>
*/<br>
int ii, jj, i, j;<br>
int n_cols = siCLP->getNumCols();<br>
int n_rows = siCLP->getNumRows();<br>
double * binvACol = (double*) malloc(n_rows * sizeof(double));<br>
double * binvASRow = (double*) malloc(n_cols * sizeof(double));<br>
double * binvAARow = (double*) malloc(n_rows * sizeof(double));<br>
double * binvARow = (double*) malloc((n_cols+n_rows)
* sizeof(double));<br>
int * indCol = (int*) malloc((n_cols+n_rows)
* sizeof(int));<br>
int * indRow = (int*) malloc(n_rows
* sizeof(int));<br>
<br>
CoinPackedMatrix Mcol;<br>
CoinPackedMatrix Mrow;<br>
CoinPackedMatrix OSIMcol;<br>
CoinPackedMatrix OSIMrow;<br>
<br>
CoinIotaN(indCol, n_cols+n_rows, 0);<br>
CoinIotaN(indRow, n_rows, 0);<br>
<br>
Mcol.setDimensions (n_rows, 0);<br>
Mrow.setDimensions (0, n_cols+n_rows);<br>
OSIMcol.setDimensions(n_rows, 0);
// tableau accessed<br>
through OSI<br>
OSIMrow.setDimensions(0, n_cols+n_rows);<br>
<br>
for(j = 0; j < (n_cols + n_rows); j++){<br>
/* access artificial columns thru CLP directly, not
thru OSI */<br>
siCLP->getModelPtr()->getBInvACol(j, binvACol);<br>
Mcol.appendCol(n_rows, indRow, binvACol);<br>
<br>
// access through OSI<br>
siCLP->getBInvACol(j, binvACol);<br>
OSIMcol.appendCol(n_rows, indRow, binvACol);<br>
}<br>
<br>
for(i = 0; i < n_rows; i++){<br>
siCLP->getModelPtr()->getBInvARow(i, binvASRow,
binvAARow);<br>
for(jj = 0; jj < n_cols; jj++)<br>
binvARow[jj] = binvASRow[jj];<br>
for(ii = 0; ii < n_rows; ii++)<br>
binvARow[n_cols+ii] = binvAARow[ii];<br>
Mrow.appendRow(n_cols+n_rows, indCol, binvARow);<br>
<br>
// access through OSI<br>
siCLP->getBInvARow(i, binvASRow, binvAARow);<br>
for(jj = 0; jj < n_cols; jj++)<br>
binvARow[jj] = binvASRow[jj];<br>
for(ii = 0; ii < n_rows; ii++)<br>
binvARow[n_cols+ii] = binvAARow[ii];<br>
OSIMrow.appendRow(n_cols+n_rows, indCol, binvARow);<br>
}<br>
<br>
printf("\nCOL MATRIX:");<br>
Mcol.dumpMatrix();<br>
<br>
printf("\nROW MATRIX:");<br>
Mrow.dumpMatrix();<br>
<br>
assert(Mcol.isEquivalent2(Mrow));<br>
<br>
printf("\nCOL MATRIX (OSI):");<br>
OSIMcol.dumpMatrix();<br>
<br>
printf("\nROW MATRIX (OSI):");<br>
OSIMrow.dumpMatrix();<br>
<br>
assert(OSIMcol.isEquivalent2(OSIMrow));<br>
<br>
free(binvACol);<br>
free(binvASRow);<br>
free(binvAARow);<br>
free(binvARow);<br>
free(indCol);<br>
free(indRow);<br>
<br>
}<br>
==========================================================<br>
NAME small<br>
ROWS<br>
N obj<br>
L c1<br>
L c2<br>
COLUMNS<br>
x0 obj -1 c1 1<br>
x0 c2 2<br>
x1 obj -1 c1 2<br>
x1 c2 1<br>
RHS<br>
rhs c1 1 c2 1<br>
ENDATA<br>
<br>
_______________________________________________<br>
Coin-discuss mailing list<br>
Coin-discuss@list.coin-or.org<br>
http://list.coin-or.org/mailman/listinfo/coin-discuss<br>
</tt></font>
<br>