[Osi-tickets] [COIN-OR Open Solver Interface] #75: bug in OsiCpx getBInvAcol

COIN-OR Open Solver Interface coin-trac at coin-or.org
Tue Dec 30 12:46:53 EST 2008


#75: bug in OsiCpx getBInvAcol
--------------------+-------------------------------------------------------
 Reporter:  stefan  |       Owner:  mjs 
     Type:  defect  |      Status:  new 
 Priority:  major   |   Milestone:      
Component:  OsiCpx  |     Version:  0.99
 Keywords:          |  
--------------------+-------------------------------------------------------
 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

-- 
Ticket URL: <https://projects.coin-or.org/Osi/ticket/75>
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