Opened 12 years ago

Closed 20 months 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:



I do not understand the following code from OsiCpx::getBInvArow:

  int *ind_bas = new int[nrow];

  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];

  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 12 years ago by stefan

getBinvCol seem to have the same problem

comment:2 Changed 11 years ago by stefan

fixed in trunk and stable/0.100

comment:3 Changed 20 months 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:

Note: See TracTickets for help on using tickets.