Changeset 641
 Timestamp:
 Jun 26, 2007 5:18:19 AM (13 years ago)
 Location:
 trunk/Cbc/src
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/unitTest.cpp
r325 r641 309 309 // where: 310 310 // miplibDir: directory containing miplib files 311 // Default value V2="./ Samples/miplib3"311 // Default value V2="./examples/miplib3" 312 312 // 313 313 // All parameters are optional. … … 349 349 std::cerr <<" where:\n"; 350 350 std::cerr <<" miplibDir: directory containing miplib files\n"; 351 std::cerr <<" Default value V2=\"./ Samples/miplib3\"\n";351 std::cerr <<" Default value V2=\"./Data/miplib3\"\n"; 352 352 return 1; 353 353 } … … 362 362 miplibDir=parms["miplibDir"] + dirsep; 363 363 else 364 miplibDir = dirsep == '/' ? "./ Samples/miplib3/" : ".\\Samples\\miplib3\\";364 miplibDir = dirsep == '/' ? "./Data/miplib3/" : ".\\Data\\miplib3\\"; 365 365 #ifdef COIN_HAS_CBC 366 366 
trunk/Cbc/src/unitTestClp.cpp
r624 r641 16 16 #include "CoinTime.hpp" 17 17 #include "CbcModel.hpp" 18 #include "CbcCutGenerator.hpp" 18 19 #include "OsiClpSolverInterface.hpp" 19 20 #include "ClpFactorization.hpp" … … 200 201 // 201 202 int mainTest (int argc, const char *argv[],int algorithm, 202 ClpSimplex empty, bool doPresolve, int switchOffValue )203 ClpSimplex empty, bool doPresolve, int switchOffValue,bool doVector) 203 204 { 204 205 int i; … … 462 463 if (solution.maximumSeconds()<0.0) 463 464 solution.setMaximumSeconds(120.0); 465 if (doVector) { 466 ClpMatrixBase * matrix = solution.clpMatrix(); 467 if (dynamic_cast< ClpPackedMatrix*>(matrix)) { 468 ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); 469 clpMatrix>makeSpecialColumnCopy(); 470 } 471 } 464 472 solution.initialSolve(solveOptions); 465 473 double time2 = CoinCpuTime()time1; … … 549 557 if (presolveOff) 550 558 solveOptions.setPresolveType(ClpSolve::presolveOff); 559 } 560 if (doVector) { 561 ClpMatrixBase * matrix = solution.clpMatrix(); 562 if (dynamic_cast< ClpPackedMatrix*>(matrix)) { 563 ClpPackedMatrix * clpMatrix = dynamic_cast< ClpPackedMatrix*>(matrix); 564 clpMatrix>makeSpecialColumnCopy(); 565 } 551 566 } 552 567 solution.initialSolve(solveOptions); … … 857 872 i,valueIncrease[i],sequenceIncrease[i], 858 873 valueDecrease[i],sequenceDecrease[i]); 859 //assert (fabs(valueDecrease[3]0.642857)<1.0e4);860 //assert (fabs(valueDecrease[8]2.95113)<1.0e4);874 assert (fabs(valueDecrease[3]0.642857)<1.0e4); 875 assert (fabs(valueDecrease[8]2.95113)<1.0e4); 861 876 #if 0 862 877 // out until I find optimization bug … … 1415 1430 FILE * fp = fopen(fn.c_str(),"r"); 1416 1431 if (!fp) { 1417 // Try in Samples1418 fn = " Samples/input.130";1432 // Try in Data 1433 fn = "Data/Sample/input.130"; 1419 1434 fp = fopen(fn.c_str(),"r"); 1420 1435 } 1421 1436 if (!fp) { 1422 fprintf(stderr,"Unable to open file input.130 in mpsDir or Samplesdirectory\n");1437 fprintf(stderr,"Unable to open file input.130 in mpsDir or Data/Sample directory\n"); 1423 1438 } else { 1424 1439 int problem; … … 1937 1952 1938 1953 double startTime = CoinCpuTime(); 1939 model>setMaximumNodes( 100000);1954 model>setMaximumNodes(200000); 1940 1955 OsiClpSolverInterface * si = 1941 1956 dynamic_cast<OsiClpSolverInterface *>(model>solver()) ; … … 1945 1960 modelC>tightenPrimalBounds(); 1946 1961 model>initialSolve(); 1962 if (modelC>dualBound()==1.0e10) { 1963 // user did not set  so modify 1964 // get largest scaled away from bound 1965 double largest=1.0e12; 1966 int numberRows = modelC>numberRows(); 1967 const double * rowPrimal = modelC>primalRowSolution(); 1968 const double * rowLower = modelC>rowLower(); 1969 const double * rowUpper = modelC>rowUpper(); 1970 const double * rowScale = modelC>rowScale(); 1971 int iRow; 1972 for (iRow=0;iRow<numberRows;iRow++) { 1973 double value = rowPrimal[iRow]; 1974 double above = valuerowLower[iRow]; 1975 double below = rowUpper[iRow]value; 1976 if (rowScale) { 1977 double multiplier = rowScale[iRow]; 1978 above *= multiplier; 1979 below *= multiplier; 1980 } 1981 if (above<1.0e12) 1982 largest = CoinMax(largest,above); 1983 if (below<1.0e12) 1984 largest = CoinMax(largest,below); 1985 } 1986 1987 int numberColumns = modelC>numberColumns(); 1988 const double * columnPrimal = modelC>primalColumnSolution(); 1989 const double * columnLower = modelC>columnLower(); 1990 const double * columnUpper = modelC>columnUpper(); 1991 const double * columnScale = modelC>columnScale(); 1992 int iColumn; 1993 for (iColumn=0;iColumn<numberColumns;iColumn++) { 1994 double value = columnPrimal[iColumn]; 1995 double above = valuecolumnLower[iColumn]; 1996 double below = columnUpper[iColumn]value; 1997 if (columnScale) { 1998 double multiplier = 1.0/columnScale[iColumn]; 1999 above *= multiplier; 2000 below *= multiplier; 2001 } 2002 if (above<1.0e12) 2003 largest = CoinMax(largest,above); 2004 if (below<1.0e12) 2005 largest = CoinMax(largest,below); 2006 } 2007 //std::cout<<"Largest (scaled) away from bound "<<largest<<std::endl; 2008 modelC>setDualBound(CoinMax(1.0001e8,CoinMin(1000.0*largest,1.00001e10))); 2009 } 1947 2010 model>setMinimumDrop(min(5.0e2, 1948 2011 fabs(model>getMinimizationObjValue())*1.0e3+1.0e4)); … … 1956 2019 1957 2020 double timeOfSolution = CoinCpuTime()startTime; 2021 // Print more statistics 2022 std::cout<<"Cuts at root node changed objective from "<<model>getContinuousObjective() 2023 <<" to "<<model>rootObjectiveAfterCuts()<<std::endl; 2024 int numberGenerators = model>numberCutGenerators(); 2025 for (int iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 2026 CbcCutGenerator * generator = model>cutGenerator(iGenerator); 2027 std::cout<<generator>cutGeneratorName()<<" was tried " 2028 <<generator>numberTimesEntered()<<" times and created " 2029 <<generator>numberCutsInTotal()<<" cuts of which " 2030 <<generator>numberCutsActive()<<" were active after adding rounds of cuts"; 2031 if (generator>timing()) 2032 std::cout<<" ( "<<generator>timeInCutGenerator()<<" seconds)"<<std::endl; 2033 else 2034 std::cout<<std::endl; 2035 } 1958 2036 if (!model>status()) { 1959 2037 double soln = model>getObjValue();
Note: See TracChangeset
for help on using the changeset viewer.