Changeset 56
 Timestamp:
 Feb 4, 2005 2:53:35 PM (17 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/CbcModel.cpp
r54 r56 423 423 originalContinuousObjective_ = solver_>getObjValue(); 424 424 bestPossibleObjective_=originalContinuousObjective_; 425 426 # ifdef CBC_DEBUG427 425 /* 428 426 OsiRowCutDebugger knows an optimal answer for a subset of MIP problems. … … 430 428 see if it cuts off the optimal answer. 431 429 */ 432 solver_>activateRowCutDebugger(problemName.c_str()) ; 430 // If debugger exists set specialOptions_ bit 431 if (solver_>getRowCutDebuggerAlways()) 432 specialOptions_ = 1; 433 434 # ifdef CBC_DEBUG 435 if ((specialOptions_&1)==0) 436 solver_>activateRowCutDebugger(problemName.c_str()) ; 437 if (solver_>getRowCutDebuggerAlways()) 438 specialOptions_ = 1; 433 439 # endif 434 440 … … 851 857 { deleteNode = true ; } 852 858 853 # ifdef CBC_DEBUG 854 /*855 This doesn't work as intended  getRowCutDebugger will return null856 unless the current feasible solution region includes the optimal solution857 that RowCutDebugger knows. There's no way to tell inactive from off the858 optimal path.859 */860 const OsiRowCutDebugger *debugger = solver_>getRowCutDebugger() ;861 if (debugger)862 { if(debugger>onOptimalPath(*solver_))863 864 865 866 # endif 859 if ((specialOptions_&1)!=0) { 860 /* 861 This doesn't work as intended  getRowCutDebugger will return null 862 unless the current feasible solution region includes the optimal solution 863 that RowCutDebugger knows. There's no way to tell inactive from off the 864 optimal path. 865 */ 866 const OsiRowCutDebugger *debugger = solver_>getRowCutDebugger() ; 867 if (debugger) 868 { if(debugger>onOptimalPath(*solver_)) 869 printf("On optimal path\n") ; 870 else 871 printf("Not on optimal path\n") ; } 872 } 867 873 /* 868 874 Reoptimize, possibly generating cuts and/or using heuristics to find … … 1258 1264 currentNode_(NULL), 1259 1265 integerVariable_(NULL), 1260 s trategy_(0),1266 specialOptions_(0), 1261 1267 subTreeModel_(NULL), 1262 1268 numberStoppedSubTrees_(0), … … 1331 1337 nextRowCut_(NULL), 1332 1338 currentNode_(NULL), 1333 s trategy_(0),1339 specialOptions_(0), 1334 1340 subTreeModel_(NULL), 1335 1341 numberStoppedSubTrees_(0), … … 1486 1492 numberIterations_(rhs.numberIterations_), 1487 1493 status_(rhs.status_), 1488 s trategy_(rhs.strategy_),1494 specialOptions_(rhs.specialOptions_), 1489 1495 subTreeModel_(rhs.subTreeModel_), 1490 1496 numberStoppedSubTrees_(rhs.numberStoppedSubTrees_), … … 1701 1707 numberIterations_ = rhs.numberIterations_; 1702 1708 status_ = rhs.status_; 1703 s trategy_ = rhs.strategy_;1709 specialOptions_ = rhs.specialOptions_; 1704 1710 subTreeModel_ = rhs.subTreeModel_; 1705 1711 numberStoppedSubTrees_ = rhs.numberStoppedSubTrees_; … … 2279 2285 numberNewCuts = 0 ; 2280 2286 2281 # ifdef CBC_DEBUG2282 /*2283 See OsiRowCutDebugger for details. In a nutshell, make sure that current2284 variable values do not conflict with a known optimal solution. (Obviously2285 this can be fooled when there are multiple solutions.)2286 */2287 2287 bool onOptimalPath = false ; 2288 const OsiRowCutDebugger *debugger = solver_>getRowCutDebugger() ; 2289 if (debugger) 2290 onOptimalPath = (debugger>onOptimalPath(*solver_)) ; 2291 # endif 2288 const OsiRowCutDebugger *debugger = NULL; 2289 if ((specialOptions_&1)!=0) { 2290 /* 2291 See OsiRowCutDebugger for details. In a nutshell, make sure that current 2292 variable values do not conflict with a known optimal solution. (Obviously 2293 this can be fooled when there are multiple solutions.) 2294 */ 2295 debugger = solver_>getRowCutDebugger() ; 2296 if (debugger) 2297 onOptimalPath = (debugger>onOptimalPath(*solver_)) ; 2298 } 2292 2299 /* 2293 2300 Resolve the problem. If we've lost feasibility, might as well bail out right … … 2303 2310 else 2304 2311 { printf("Infeasible %d rows\n",solver_>getNumRows()) ; } 2312 #endif 2313 if ((specialOptions_&1)!=0) { 2305 2314 /* 2306 2315 If the RowCutDebugger said we were compatible with the optimal solution, … … 2308 2317 may have fathomed by bound, heading for a rediscovery of an optimal solution. 2309 2318 */ 2310 if (onOptimalPath && !solver_>isDualObjectiveLimitReached()) {2311 if (!feasible) {2312 solver_>writeMps("infeas");2313 CoinWarmStartBasis *slack =2314 2315 solver_>setWarmStart(slack);2316 delete slack ;2317 solver_>setHintParam(OsiDoReducePrint,false,OsiHintDo,0) ;2318 solver_>initialSolve();2319 }2320 assert(feasible) ;2321 }2322 # endif 2319 if (onOptimalPath && !solver_>isDualObjectiveLimitReached()) { 2320 if (!feasible) { 2321 solver_>writeMps("infeas"); 2322 CoinWarmStartBasis *slack = 2323 dynamic_cast<CoinWarmStartBasis *>(solver_>getEmptyWarmStart()) ; 2324 solver_>setWarmStart(slack); 2325 delete slack ; 2326 solver_>setHintParam(OsiDoReducePrint,false,OsiHintDo,0) ; 2327 solver_>initialSolve(); 2328 } 2329 assert(feasible) ; 2330 } 2331 } 2323 2332 2324 2333 if (!feasible) return (false) ; … … 2485 2494 if (mustResolve) { 2486 2495 feasible = resolve() ; 2487 # ifdef CBC_DEBUG 2488 2489 2490 2491 2492 2493 2494 2495 # endif 2496 if ((specialOptions_&1)!=0) { 2497 debugger = solver_>getRowCutDebugger() ; 2498 if (debugger) 2499 onOptimalPath = (debugger>onOptimalPath(*solver_)) ; 2500 else 2501 onOptimalPath=false; 2502 if (onOptimalPath && !solver_>isDualObjectiveLimitReached()) 2503 assert(feasible) ; 2504 } 2496 2505 if (!feasible) 2497 2506 break ; … … 2515 2524 int numberColumnCutsAfter = theseCuts.sizeColCuts() ; 2516 2525 2517 #ifdef CBC_DEBUG 2518 if (onOptimalPath) { 2519 int k ; 2520 for (k = numberRowCutsBefore;k<numberRowCutsAfter;k++) { 2521 OsiRowCut thisCut = theseCuts.rowCut(k) ; 2522 assert(!debugger>invalidCut(thisCut)) ; 2523 } 2526 if ((specialOptions_&1)!=0) { 2527 if (onOptimalPath) { 2528 int k ; 2529 for (k = numberRowCutsBefore;k<numberRowCutsAfter;k++) { 2530 OsiRowCut thisCut = theseCuts.rowCut(k) ; 2531 if(debugger>invalidCut(thisCut)) { 2532 solver_>writeMps("badCut"); 2533 } 2534 assert(!debugger>invalidCut(thisCut)) ; 2535 } 2536 } 2524 2537 } 2525 #endif2526 2538 2527 2539 /* … … 3875 3887 const OsiRowCut * thisCut = theseCuts.rowCutPtr(j); 3876 3888 if (thisCut>globallyValid()) { 3877 # ifdef CBC_DEBUG 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 # endif 3889 if ((specialOptions_&1)!=0) { 3890 /* As these are global cuts  3891 a) Always get debugger object 3892 b) Not fatal error to cutoff optimal (if we have just got optimal) 3893 */ 3894 const OsiRowCutDebugger *debugger = solver_>getRowCutDebuggerAlways() ; 3895 if (debugger) { 3896 if(debugger>invalidCut(*thisCut)) 3897 printf("ZZZZ Global cut  cuts off optimal solution!\n"); 3898 } 3899 } 3888 3900 // add to global list 3889 3901 globalCuts_.insert(*thisCut); 
trunk/include/CbcModel.hpp
r54 r56 1244 1244 /// Indices of integer variables 1245 1245 int * integerVariable_; 1246 /// 0 bit gomory, 1 probing, 2 knapsack, 3 oddhole1247 int s trategy_;1246 /// 0 bit  check if cuts valid (if on list) 1247 int specialOptions_; 1248 1248 /// User node comparison function 1249 1249 CbcCompareBase * nodeCompare_;
Note: See TracChangeset
for help on using the changeset viewer.