Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in OsiCpx getBInvAcol #75

Closed
svigerske opened this issue Mar 2, 2019 · 2 comments
Closed

bug in OsiCpx getBInvAcol #75

svigerske opened this issue Mar 2, 2019 · 2 comments
Labels
bug Something isn't working OsiCpx

Comments

@svigerske
Copy link
Member

Issue created by migration from Trac.

Original creator: @svigerske

Original creation time: 2008-12-30 17:46:53

Assignee: @mjsaltzman

Version: 0.99

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

@svigerske svigerske added bug Something isn't working major OsiCpx labels Mar 2, 2019
@svigerske
Copy link
Member Author

Comment by @svigerske created at 2008-12-30 17:49:32

getBinvCol seem to have the same problem

@svigerske
Copy link
Member Author

Comment by @svigerske created at 2009-10-04 10:57:34

fixed in trunk and stable/0.100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working OsiCpx
Projects
None yet
Development

No branches or pull requests

1 participant