[Coin-discuss] CLP simplex interface, get dual ray twice

Matthew Galati Matthew.Galati at sas.com
Mon Apr 9 11:13:11 EDT 2007


Hi --

Is this a feature or a bug?

For an infeasible problem, getDualRay, print some basis info, getDualRay again, this time it does not exist.

Example mps file here:
   https://coral.ie.lehigh.edu/projects/DECOMP/browser/trunk/TempFix/bugs/masterProb.n1.c0.p0.mps?format=raw


// to build:  
// g++ main.cpp -L ~/COIN/coin-Decomp/build-g/lib -I ~/COIN/coin-Decomp/build-g/include/ -lOsiClp -lOsi -lClp -lCoinUtils -llapack

#include "OsiClpSolverInterface.hpp"
#include <string>
using namespace std;

// --------------------------------------------------------------------- //
void printBasisInfo(OsiClpSolverInterface * si){

   int      b, r, c;
   int    * basics  = 0;
   int    * rstat   = 0;
   int    * cstat   = 0;
   double * bInvRow = 0;
   const int n  = si->getNumCols();
   const int m  = si->getNumRows();
   char type[4] = {'F','B','U','L'};
   
   basics  = new int[m];
   bInvRow = new double[m];
   rstat   = new int[m];
   cstat   = new int[n];
   
   si->enableSimplexInterface(false);
   si->getBasics(basics);
   cout << "\n\nBasics: ";
   for(b = 0; b < m; b++)
      cout << basics[b] << " ";
   si->getBasisStatus(cstat,rstat);

   cout << "\ncstat: ";
   for(c = 0; c < n; c++){
      cout << type[cstat[c]];
   }
   cout << "\n";
   cout << "rstat: ";
   for(r = 0; r < m; r++){
      cout << type[rstat[r]];
   }
   cout << "\n";

   cout << "\nB-1:";
   for(r = 0; r < m; r++){
      si->getBInvRow(r, bInvRow);
      cout << "\nBRow r: " << r << ": ";
      for(b = 0; b < m; b++){
         cout << bInvRow[b] << " ";
      }
   }

   delete [] basics;
   delete [] bInvRow;
   delete [] rstat;
   delete [] cstat;
  
   si->disableSimplexInterface();   
}


int main(int argc, char ** argv){
   string mpsFile = "masterProb.n1.c0.p0.mps";
   OsiClpSolverInterface si;
   si.readMps(mpsFile.c_str());
   si.initialSolve();
   
   vector<double*> rays1 = si.getDualRays(10);
   assert(rays1[0]);
   
   printBasisInfo(&si);
   
   //si.resolve();
   vector<double*> rays2 = si.getDualRays(10);
   assert(rays2[0]);

   printBasisInfo(&si);

}








More information about the Coin-discuss mailing list