Opened 10 years ago
Closed 7 weeks ago
#75 closed defect (migrated)
bug in OsiCpx getBInvAcol
Reported by: | stefan | Owned by: | mjs |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | OsiCpx | Version: | 0.99 |
Keywords: | Cc: |
Description
Hi,
I do not understand the following code from OsiCpx::getBInvArow:
int *ind_bas = new int[nrow]; getBasics(ind_bas); for(int i=0; i<nrow; i++) { if(sense[i] == 'G') { int ind_slack = ncol+i; if(ind_bas[i] == ind_slack) { // slack for row is basic; whole row // must be flipped vec[i] = -vec[i]; } } }
I do not see why there should be a correspondence between ind_bas[i] and ncol+i, since i just iterates over the basis.
What seem to work for me is
int *ind_bas = new int[nrow]; getBasics(ind_bas); for(int i=0; i<nrow; i++) if (ind_bas[i] > ncol && sense[ind_bas[i]-ncol] == 'G') vec[i] = -vec[i];
That is, the sign of vec[i] is flipped if ind_bas[i] is a slack variable and if the corresponding row (ind_bas[i]-ncol) has sense 'G'.
Best, Stefan
Change History (3)
comment:1 Changed 10 years ago by stefan
comment:2 Changed 10 years ago by stefan
fixed in trunk and stable/0.100
comment:3 Changed 7 weeks ago by stefan
- Resolution set to migrated
- Status changed from new to closed
This ticket has been migrated to GitHub and will be resolved there: https://github.com/coin-or/Osi/issues/75
Note: See
TracTickets for help on using
tickets.
getBinvCol seem to have the same problem