[Osi-tickets] [COIN-OR Open Solver Interface] #44:
OsiCpx::getBInvRow incorrect rows are flipped
COIN-OR Open Solver Interface
coin-trac at coin-or.org
Mon Nov 19 15:40:49 EST 2007
#44: OsiCpx::getBInvRow incorrect rows are flipped
--------------------+-------------------------------------------------------
Reporter: stefan | Owner: mjs
Type: defect | Status: new
Priority: major | Milestone:
Component: OsiCpx | Version:
Keywords: |
--------------------+-------------------------------------------------------
Hi,
I am not definitely sure, maybe I just do not know enough the background
behind this basis/nonbasis stuff. But I think the way that rows of the
basis inverse are flipped in !OsiCpx is not correct.
So far, when one asks for row number row_ of the BASIS INVERSE matrix,
then the method checks whether row row_ from the ORIGINAL matrix is a
greater-equal row! If so, and if the slack corresponding to row row_ is in
the basis, then the row is flipped.
However, I think one should check whether row row_ from the basis inverse
corresponds to a slack variable. Then, if the row in the original matrix
that belongs to this slack is a greater-equal row, the row has to be
flipped in the basis inverse.
A code would be
{{{
int *ind_bas = new int[nrow];
getBasics(ind_bas);
if (ind_bas[row]>=ncol) { // binv row corresponds to a slack variable
int Arow=ind_bas[row]-ncol; // Arow is the number of the row in the
problem matrix which this slack belongs to
char sense;
status = CPXgetsense(env_, lp, &sense, Arow, Arow);
if(status) {
printf("### ERROR: OsiCpxSolverInterface::getBInvRow(): Unable to
get senses for row %d\n", Arow);
exit(1);
}
if(sense == 'G') { // slack has coeff -1 in Cplex; thus row in binv
must be flipped
for(int j=0; j<nrow; j++) {
z[j] = -z[j];
}
}
}
delete[] ind_bas;
}}}
The same probably in getBInvARow().
Best,
Stefan
--
Ticket URL: <https://projects.coin-or.org/Osi/ticket/44>
COIN-OR Open Solver Interface <http://projects.coin-or.org/Osi>
An API for a variety of LP and MIP solvers (and more).
More information about the Osi-tickets
mailing list