Changeset 1090
- Timestamp:
- Aug 20, 2007 2:53:45 PM (14 years ago)
- Location:
- trunk/Clp/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Clp/src/ClpMain.cpp
r1088 r1090 1368 1368 if (name!="EOL") { 1369 1369 int length=name.length(); 1370 if (name[length-1]== '/'||name[length-1]=='\\')1371 directory =name;1370 if (name[length-1]==dirsep) 1371 directory = name; 1372 1372 else 1373 directory = name+ "/";1373 directory = name+dirsep; 1374 1374 parameters[iParam].setStringValue(directory); 1375 1375 } else { … … 1383 1383 if (name!="EOL") { 1384 1384 int length=name.length(); 1385 if (name[length-1]== '/'||name[length-1]=='\\')1386 dirSample =name;1385 if (name[length-1]==dirsep) 1386 dirSample = name; 1387 1387 else 1388 dirSample = name+ "/";1388 dirSample = name+dirsep; 1389 1389 parameters[iParam].setStringValue(dirSample); 1390 1390 } else { … … 1398 1398 if (name!="EOL") { 1399 1399 int length=name.length(); 1400 if (name[length-1]== '/'||name[length-1]=='\\')1401 dirNetlib =name;1400 if (name[length-1]==dirsep) 1401 dirNetlib = name; 1402 1402 else 1403 dirNetlib = name+ "/";1403 dirNetlib = name+dirsep; 1404 1404 parameters[iParam].setStringValue(dirNetlib); 1405 1405 } else { … … 1413 1413 if (name!="EOL") { 1414 1414 int length=name.length(); 1415 if (name[length-1]== '/'||name[length-1]=='\\')1416 dirMiplib =name;1415 if (name[length-1]==dirsep) 1416 dirMiplib = name; 1417 1417 else 1418 dirMiplib = name+ "/";1418 dirMiplib = name+dirsep; 1419 1419 parameters[iParam].setStringValue(dirMiplib); 1420 1420 } else { … … 1436 1436 int nFields=4; 1437 1437 fields[0]="fake main from unitTest"; 1438 std::string mpsfield = "- mpsDir=";1438 std::string mpsfield = "-dirSample="; 1439 1439 mpsfield += dirSample.c_str(); 1440 1440 fields[1]=mpsfield.c_str(); 1441 std::string netfield = "- netlibDir=";1441 std::string netfield = "-dirNetlib="; 1442 1442 netfield += dirNetlib.c_str(); 1443 1443 fields[2]=netfield.c_str(); … … 1474 1474 int nFields=2; 1475 1475 fields[0]="fake main from unitTest"; 1476 std::string dirfield = "- mpsDir=";1476 std::string dirfield = "-dirSample="; 1477 1477 dirfield += dirSample.c_str(); 1478 1478 fields[1]=dirfield.c_str(); -
trunk/Clp/src/ClpSimplex.hpp
r1084 r1090 50 50 51 51 class ClpSimplex : public ClpModel { 52 friend void ClpSimplexUnitTest(const std::string & mpsDir, 53 const std::string & netlibDir); 52 friend void ClpSimplexUnitTest(const std::string & mpsDir); 54 53 55 54 public: … … 1293 1292 */ 1294 1293 void 1295 ClpSimplexUnitTest(const std::string & mpsDir, 1296 const std::string & netlibDir); 1294 ClpSimplexUnitTest(const std::string & mpsDir); 1297 1295 1298 1296 -
trunk/Clp/src/unitTest.cpp
r1088 r1090 227 227 printf("Computed objective %g\n",objValue); 228 228 } 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 230 void 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 241 245 //---------------------------------------------------------------- 242 246 int mainTest (int argc, const char *argv[],int algorithm, … … 258 262 // define valid parameter keywords 259 263 std::set<std::string> definedKeyWords; 260 definedKeyWords.insert("- mpsDir");261 definedKeyWords.insert("- netlibDir");264 definedKeyWords.insert("-dirSample"); 265 definedKeyWords.insert("-dirNetlib"); 262 266 definedKeyWords.insert("-netlib"); 263 267 … … 283 287 // invalid key word. 284 288 // 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); 296 290 return 1; 297 291 } … … 301 295 const char dirsep = CoinFindDirSeparator(); 302 296 // 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"]; 306 300 else 307 mpsDir= dirsep == '/' ? "../../Data/Sample/" : "..\\..\\Data\\Sample\\";301 dirSample = dirsep == '/' ? "../../Data/Sample/" : "..\\..\\Data\\Sample\\"; 308 302 309 303 // 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"]; 313 307 else 314 netlibDir= dirsep == '/' ? "../../Data/Netlib/" : "..\\..\\Data\\Netlib\\";308 dirNetlib = dirsep == '/' ? "../../Data/Netlib/" : "..\\..\\Data\\Netlib\\"; 315 309 if (!empty.numberRows()) { 316 310 testingMessage( "Testing ClpSimplex\n" ); 317 ClpSimplexUnitTest( mpsDir,netlibDir);311 ClpSimplexUnitTest(dirSample); 318 312 } 319 313 if (parms.find("-netlib") != parms.end()||empty.numberRows()) … … 477 471 478 472 ClpSimplex solutionBase=empty; 479 std::string fn = netlibDir+mpsName[m];473 std::string fn = dirNetlib+mpsName[m]; 480 474 if (!empty.numberRows()||algorithm<6) { 481 475 // Read data mps file, … … 648 642 // test factorization methods and simplex method and simple barrier 649 643 void 650 ClpSimplexUnitTest(const std::string & mpsDir, 651 const std::string & netlibDir) 644 ClpSimplexUnitTest(const std::string & dirSample) 652 645 { 653 646 … … 770 763 { 771 764 CoinMpsIO m; 772 std::string fn = mpsDir+"exmip1";765 std::string fn = dirSample+"exmip1"; 773 766 m.readMps(fn.c_str(),"mps"); 774 767 ClpSimplex solution; … … 790 783 { 791 784 CoinMpsIO m; 792 std::string fn = mpsDir+"exmip1";785 std::string fn = dirSample+"exmip1"; 793 786 //fn = "Test/subGams4"; 794 787 m.readMps(fn.c_str(),"mps"); … … 841 834 { 842 835 CoinMpsIO m; 843 std::string fn = mpsDir+"exmip1";836 std::string fn = dirSample+"exmip1"; 844 837 m.readMps(fn.c_str(),"mps"); 845 838 ClpSimplex model; … … 900 893 { 901 894 CoinMpsIO m; 902 std::string fn = mpsDir+"exmip1";895 std::string fn = dirSample+"exmip1"; 903 896 m.readMps(fn.c_str(),"mps"); 904 897 ClpSimplex model; … … 1003 996 { 1004 997 CoinMpsIO m; 1005 std::string fn = mpsDir+"finnis";998 std::string fn = dirSample+"finnis"; 1006 999 int returnCode = m.readMps(fn.c_str(),"mps"); 1007 1000 if (returnCode) { 1008 1001 // 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()); 1010 1003 fprintf(stderr,"Most probable cause is finnis.mps is gzipped i.e. finnis.mps.gz and libz has not been activated\n"); 1011 1004 fprintf(stderr,"Either gunzip files or edit Makefiles/Makefile.location to get libz\n"); … … 1033 1026 { 1034 1027 CoinMpsIO m; 1035 std::string fn = mpsDir+"afiro";1028 std::string fn = dirSample+"afiro"; 1036 1029 m.readMps(fn.c_str(),"mps"); 1037 1030 ClpSimplex solution; … … 1120 1113 { 1121 1114 CoinMpsIO m; 1122 std::string fn = mpsDir+"brandy";1115 std::string fn = dirSample+"brandy"; 1123 1116 m.readMps(fn.c_str(),"mps"); 1124 1117 ClpSimplex solution; … … 1192 1185 { 1193 1186 CoinMpsIO m; 1194 std::string fn = mpsDir+"brandy";1187 std::string fn = dirSample+"brandy"; 1195 1188 m.readMps(fn.c_str(),"mps"); 1196 1189 ClpSimplex solution; … … 1281 1274 { 1282 1275 CoinMpsIO m; 1283 std::string fn = mpsDir+"brandy";1276 std::string fn = dirSample+"brandy"; 1284 1277 m.readMps(fn.c_str(),"mps"); 1285 1278 ClpSimplex solution; … … 1460 1453 { 1461 1454 CoinMpsIO m; 1462 std::string fn = mpsDir+"exmip1";1455 std::string fn = dirSample+"exmip1"; 1463 1456 m.readMps(fn.c_str(),"mps"); 1464 1457 ClpInterior solution; … … 1472 1465 #define QUADRATIC 1473 1466 if (1) { 1474 std::string fn = mpsDir+"input.130";1467 std::string fn = dirSample+"input.130"; 1475 1468 int numberColumns; 1476 1469 int numberRows; … … 1483 1476 } 1484 1477 if (!fp) { 1485 fprintf(stderr,"Unable to open file input.130 in mpsDiror Data/Sample directory\n");1478 fprintf(stderr,"Unable to open file input.130 in dirSample or Data/Sample directory\n"); 1486 1479 } else { 1487 1480 int problem; … … 1649 1642 if (1) { 1650 1643 CoinMpsIO m; 1651 std::string fn = mpsDir+"exmip1";1644 std::string fn = dirSample+"exmip1"; 1652 1645 m.readMps(fn.c_str(),"mps"); 1653 1646 ClpSimplex solution; … … 1694 1687 if (1) { 1695 1688 CoinMpsIO m; 1696 std::string fn = mpsDir+"share2qp";1689 std::string fn = dirSample+"share2qp"; 1697 1690 //fn = "share2qpb"; 1698 1691 m.readMps(fn.c_str(),"mps");
Note: See TracChangeset
for help on using the changeset viewer.