// Copyright (C) 2000, International Business Machines // Corporation and others. All Rights Reserved. #if defined(_MSC_VER) // Turn off compiler warning about long names # pragma warning(disable:4786) #endif #include #include "OsiRowCutDebugger.hpp" #ifdef NDEBUG #undef NDEBUG #endif //-------------------------------------------------------------------------- // test cut debugger methods. void OsiRowCutDebuggerUnitTest(const OsiSolverInterface * baseSiP, const std::string & mpsDir ) { CoinRelFltEq eq; // Test default constructor { OsiRowCutDebugger r; assert( r.integerVariable_==NULL ); assert( r.optimalSolution_==NULL ); assert( r.numberColumns_==0); } { // Get non trivial instance OsiSolverInterface * imP = baseSiP->clone(); std::string fn = mpsDir+"exmip1"; imP->readMps(fn.c_str(),"mps"); //std::cerr <getNumRows() <getNumRows() == 5); // activate debugger imP->activateRowCutDebugger("ab cd /x/ /exmip1.asc"); int i; // return debugger const OsiRowCutDebugger * debugger = imP->getRowCutDebugger(); // check assert (debugger!=NULL); assert (debugger->numberColumns_==8); const bool type[]={0,0,1,1,0,0,0,0}; const double values[]= {2.5, 0, 1, 1, 0.5, 3, 0, 0.26315789473684253}; CoinPackedVector objCoefs(8,imP->getObjCoefficients()); #if 0 for (i=0;i<8;i++) { assert(type[i]==debugger->integerVariable_[i]); std::cerr <optimalSolution_[i] <optimalSolution_); //std::cerr <invalidCut(cut[0])); assert( debugger->invalidCut(cut[1])); assert(debugger->validateCuts(cs,0,2)==1); assert(debugger->validateCuts(cs,0,1)==0); delete imP; } }