We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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:
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.
ind_bas[i]
ncol+i
i
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'.
vec[i]
ind_bas[i]-ncol
Best, Stefan
The text was updated successfully, but these errors were encountered:
Comment by @svigerske created at 2008-12-30 17:49:32
getBinvCol seem to have the same problem
Sorry, something went wrong.
Comment by @svigerske created at 2009-10-04 10:57:34
fixed in trunk and stable/0.100
No branches or pull requests
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
:I do not see why there should be a correspondence between
ind_bas[i]
andncol+i
, sincei
just iterates over the basis.What seem to work for me is
That is, the sign of
vec[i]
is flipped ifind_bas[i]
is a slack variable and if the corresponding row (ind_bas[i]-ncol
) has sense 'G'.Best,
Stefan
The text was updated successfully, but these errors were encountered: