Ignore:
Timestamp:
Aug 20, 2007 2:53:45 PM (13 years ago)
Author:
ladanyi
Message:

fixed trailing backslash in directory specifications for Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/unitTest.cpp

    r1088 r1090  
    227227  printf("Computed objective %g\n",objValue);
    228228}
    229 //----------------------------------------------------------------
    230 // unitTest [-mpsDir=V1] [-netlibDir=V2] [-test]
    231 //
    232 // where:
    233 //   -mpsDir: directory containing mps test files
    234 //       Default value V1="../../Data/Sample"   
    235 //   -netlibDir: directory containing netlib files
    236 //       Default value V2="../../Data/Netlib"
    237 //   -test
    238 //       If specified, then netlib test set run
    239 //
    240 // All parameters are optional.
     229
     230void usage(const std::string& key)
     231{
     232  std::cerr
     233    <<"Undefined parameter \"" <<key <<"\".\n"
     234    <<"Correct usage: \n"
     235    <<"  clp [-dirSample=V1] [-dirNetlib=V2] [-netlib]\n"
     236    <<"  where:\n"
     237    <<"    -dirSample: directory containing mps test files\n"
     238    <<"        Default value V1=\"../../Data/Sample\"\n"
     239    <<"    -dirNetlib: directory containing netlib files\"\n"
     240    <<"        Default value V2=\"../../Data/Netlib\"\n"
     241    <<"    -netlib\n"
     242    <<"        If specified, then netlib testset run as well as the nitTest.\n";
     243}
     244
    241245//----------------------------------------------------------------
    242246int mainTest (int argc, const char *argv[],int algorithm,
     
    258262  // define valid parameter keywords
    259263  std::set<std::string> definedKeyWords;
    260   definedKeyWords.insert("-mpsDir");
    261   definedKeyWords.insert("-netlibDir");
     264  definedKeyWords.insert("-dirSample");
     265  definedKeyWords.insert("-dirNetlib");
    262266  definedKeyWords.insert("-netlib");
    263267
     
    283287      // invalid key word.
    284288      // Write help text
    285       std::cerr <<"Undefined parameter \"" <<key <<"\".\n";
    286       std::cerr <<"Correct usage: \n";
    287       std::cerr <<"  unitTest [-mpsDir=V1] [-netlibDir=V2] [-test[=V3]]\n";
    288       std::cerr <<"  where:\n";
    289       std::cerr <<"    -mpsDir: directory containing mps test files\n";
    290       std::cerr <<"        Default value V1=\"../../Data/Sample\"\n";
    291       std::cerr <<"    -netlibDir: directory containing netlib files\n";
    292       std::cerr <<"        Default value V2=\"../../Data/Netlib\"\n";
    293       std::cerr <<"    -test\n";
    294       std::cerr <<"        If specified, then netlib testset run.\n";
    295       std::cerr <<"        If V3 then taken as single file\n";
     289      usage(key);
    296290      return 1;
    297291    }
     
    301295  const char dirsep =  CoinFindDirSeparator();
    302296  // Set directory containing mps data files.
    303   std::string mpsDir;
    304   if (parms.find("-mpsDir") != parms.end())
    305     mpsDir=parms["-mpsDir"] + dirsep;
     297  std::string dirSample;
     298  if (parms.find("-dirSample") != parms.end())
     299    dirSample=parms["-dirSample"];
    306300  else
    307     mpsDir = dirsep == '/' ? "../../Data/Sample/" : "..\\..\\Data\\Sample\\";
     301    dirSample = dirsep == '/' ? "../../Data/Sample/" : "..\\..\\Data\\Sample\\";
    308302 
    309303  // Set directory containing netlib data files.
    310   std::string netlibDir;
    311   if (parms.find("-netlibDir") != parms.end())
    312     netlibDir=parms["-netlibDir"] + dirsep;
     304  std::string dirNetlib;
     305  if (parms.find("-dirNetlib") != parms.end())
     306    dirNetlib=parms["-dirNetlib"];
    313307  else
    314     netlibDir = dirsep == '/' ? "../../Data/Netlib/" : "..\\..\\Data\\Netlib\\";
     308    dirNetlib = dirsep == '/' ? "../../Data/Netlib/" : "..\\..\\Data\\Netlib\\";
    315309  if (!empty.numberRows()) {
    316310    testingMessage( "Testing ClpSimplex\n" );
    317     ClpSimplexUnitTest(mpsDir,netlibDir);
     311    ClpSimplexUnitTest(dirSample);
    318312  }
    319313  if (parms.find("-netlib") != parms.end()||empty.numberRows())
     
    477471
    478472      ClpSimplex solutionBase=empty;
    479       std::string fn = netlibDir+mpsName[m];
     473      std::string fn = dirNetlib+mpsName[m];
    480474      if (!empty.numberRows()||algorithm<6) {
    481475        // Read data mps file,
     
    648642// test factorization methods and simplex method and simple barrier
    649643void
    650 ClpSimplexUnitTest(const std::string & mpsDir,
    651                    const std::string & netlibDir)
     644ClpSimplexUnitTest(const std::string & dirSample)
    652645{
    653646 
     
    770763  {   
    771764    CoinMpsIO m;
    772     std::string fn = mpsDir+"exmip1";
     765    std::string fn = dirSample+"exmip1";
    773766    m.readMps(fn.c_str(),"mps");
    774767    ClpSimplex solution;
     
    790783  {   
    791784    CoinMpsIO m;
    792     std::string fn = mpsDir+"exmip1";
     785    std::string fn = dirSample+"exmip1";
    793786    //fn = "Test/subGams4";
    794787    m.readMps(fn.c_str(),"mps");
     
    841834  {   
    842835    CoinMpsIO m;
    843     std::string fn = mpsDir+"exmip1";
     836    std::string fn = dirSample+"exmip1";
    844837    m.readMps(fn.c_str(),"mps");
    845838    ClpSimplex model;
     
    900893  {   
    901894    CoinMpsIO m;
    902     std::string fn = mpsDir+"exmip1";
     895    std::string fn = dirSample+"exmip1";
    903896    m.readMps(fn.c_str(),"mps");
    904897    ClpSimplex model;
     
    1003996  {   
    1004997    CoinMpsIO m;
    1005     std::string fn = mpsDir+"finnis";
     998    std::string fn = dirSample+"finnis";
    1006999    int returnCode = m.readMps(fn.c_str(),"mps");
    10071000    if (returnCode) {
    10081001      // probable cause is that gz not there
    1009       fprintf(stderr,"Unable to open finnis.mps in %s\n", mpsDir.c_str());
     1002      fprintf(stderr,"Unable to open finnis.mps in %s\n", dirSample.c_str());
    10101003      fprintf(stderr,"Most probable cause is finnis.mps is gzipped i.e. finnis.mps.gz and libz has not been activated\n");
    10111004      fprintf(stderr,"Either gunzip files or edit Makefiles/Makefile.location to get libz\n");
     
    10331026  {   
    10341027    CoinMpsIO m;
    1035     std::string fn = mpsDir+"afiro";
     1028    std::string fn = dirSample+"afiro";
    10361029    m.readMps(fn.c_str(),"mps");
    10371030    ClpSimplex solution;
     
    11201113  {   
    11211114    CoinMpsIO m;
    1122     std::string fn = mpsDir+"brandy";
     1115    std::string fn = dirSample+"brandy";
    11231116    m.readMps(fn.c_str(),"mps");
    11241117    ClpSimplex solution;
     
    11921185  {   
    11931186    CoinMpsIO m;
    1194     std::string fn = mpsDir+"brandy";
     1187    std::string fn = dirSample+"brandy";
    11951188    m.readMps(fn.c_str(),"mps");
    11961189    ClpSimplex solution;
     
    12811274  {   
    12821275    CoinMpsIO m;
    1283     std::string fn = mpsDir+"brandy";
     1276    std::string fn = dirSample+"brandy";
    12841277    m.readMps(fn.c_str(),"mps");
    12851278    ClpSimplex solution;
     
    14601453  {
    14611454    CoinMpsIO m;
    1462     std::string fn = mpsDir+"exmip1";
     1455    std::string fn = dirSample+"exmip1";
    14631456    m.readMps(fn.c_str(),"mps");
    14641457    ClpInterior solution;
     
    14721465#define QUADRATIC
    14731466  if (1) {   
    1474     std::string fn = mpsDir+"input.130";
     1467    std::string fn = dirSample+"input.130";
    14751468    int numberColumns;
    14761469    int numberRows;
     
    14831476    }
    14841477    if (!fp) {
    1485       fprintf(stderr,"Unable to open file input.130 in mpsDir or Data/Sample directory\n");
     1478      fprintf(stderr,"Unable to open file input.130 in dirSample or Data/Sample directory\n");
    14861479    } else {
    14871480      int problem;
     
    16491642  if (1) {   
    16501643    CoinMpsIO m;
    1651     std::string fn = mpsDir+"exmip1";
     1644    std::string fn = dirSample+"exmip1";
    16521645    m.readMps(fn.c_str(),"mps");
    16531646    ClpSimplex solution;
     
    16941687  if (1) {   
    16951688    CoinMpsIO m;
    1696     std::string fn = mpsDir+"share2qp";
     1689    std::string fn = dirSample+"share2qp";
    16971690    //fn = "share2qpb";
    16981691    m.readMps(fn.c_str(),"mps");
Note: See TracChangeset for help on using the changeset viewer.