 Timestamp:
 Mar 25, 2011 3:05:49 PM (10 years ago)
 Location:
 trunk/Cbc/src
 Files:

 4 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Cbc/src/CbcBranchingObject.hpp
r1573 r1624 112 112 int ) const {} 113 113 114 /** Change (tighten) bounds in object to reflect bounds in solver. 115 Return true if now fixed */ 116 virtual bool tighten(OsiSolverInterface * ) {return false;} 117 114 118 /** Reset every information so that the branching object appears to point to 115 119 the previous child. This method does not need to modify anything in any 
trunk/Cbc/src/CbcNode.cpp
r1605 r1624 877 877 } 878 878 // If we have hit max time don't do strong branching 879 bool hitMaxTime = ( CoinCpuTime()  model>getDblParam(CbcModel::CbcStartSeconds) >879 bool hitMaxTime = (model>getCurrentSeconds() > 880 880 model>getDblParam(CbcModel::CbcMaximumSeconds)); 881 881 // also give up if we are looping round too much … … 1346 1346 } 1347 1347 } 1348 bool hitMaxTime = ( CoinCpuTime()  model>getDblParam(CbcModel::CbcStartSeconds) >1348 bool hitMaxTime = (model>getCurrentSeconds() > 1349 1349 model>getDblParam(CbcModel::CbcMaximumSeconds)); 1350 1350 if (hitMaxTime) { … … 2445 2445 assert (bestChoice >= 0); 2446 2446 // If we have hit max time don't do strong branching 2447 bool hitMaxTime = ( CoinCpuTime()  model>getDblParam(CbcModel::CbcStartSeconds) >2447 bool hitMaxTime = (model>getCurrentSeconds() > 2448 2448 model>getDblParam(CbcModel::CbcMaximumSeconds)); 2449 2449 // also give up if we are looping round too much … … 2861 2861 numberStrongInfeasible++; 2862 2862 } else { 2863 //#defineTIGHTEN_BOUNDS2864 #ifdef TIGHTEN_BOUNDS2863 #define CBCNODE_TIGHTEN_BOUNDS 2864 #ifdef CBCNODE_TIGHTEN_BOUNDS 2865 2865 // Can we tighten bounds? 2866 2866 if (iColumn < numberColumns && cutoff < 1.0e20 … … 3008 3008 numberStrongInfeasible++; 3009 3009 } else { 3010 #ifdef TIGHTEN_BOUNDS3010 #ifdef CBCNODE_TIGHTEN_BOUNDS 3011 3011 // Can we tighten bounds? 3012 3012 if (iColumn < numberColumns && cutoff < 1.0e20 … … 3321 3321 } 3322 3322 // Check max time 3323 hitMaxTime = ( CoinCpuTime()  model>getDblParam(CbcModel::CbcStartSeconds) >3323 hitMaxTime = (model>getCurrentSeconds() > 3324 3324 model>getDblParam(CbcModel::CbcMaximumSeconds)); 3325 3325 if (hitMaxTime) { … … 3383 3383 if (feasible) { 3384 3384 anyAction = 0; 3385 // See if candidate still possible3386 if (branch_) {3387 const OsiObject * object = model>object(bestChoice);3388 int preferredWay;3389 double infeasibility = object>infeasibility(&usefulInfo, preferredWay);3390 if (!infeasibility) {3391 // take out3392 delete branch_;3393 branch_ = NULL;3394 } else {3395 CbcBranchingObject * branchObj =3396 dynamic_cast <CbcBranchingObject *>(branch_) ;3397 assert (branchObj);3398 branchObj>way(preferredWay);3399 }3400 }3401 3385 } else { 3402 3386 anyAction = 2; … … 3406 3390 } 3407 3391 // If fixed then round again 3408 if (!branch_ && anyAction != 2) { 3392 // See if candidate still possible 3393 if (branch_) { 3394 const OsiObject * object = model>object(bestChoice); 3395 int preferredWay; 3396 double infeasibility = object>infeasibility(&usefulInfo, preferredWay); 3397 if (!infeasibility) { 3398 // take out 3399 delete branch_; 3400 branch_ = NULL; 3401 } else { 3402 CbcBranchingObject * branchObj = 3403 dynamic_cast <CbcBranchingObject *>(branch_) ; 3404 assert (branchObj); 3405 branchObj>way(preferredWay); 3406 #ifdef CBCNODE_TIGHTEN_BOUNDS 3407 bool fixed = branchObj>tighten(solver); 3408 if (fixed) { 3409 printf("Variable now fixed!\n"); 3410 // take out 3411 delete branch_; 3412 branch_ = NULL; 3413 } 3414 #endif 3415 } 3416 } 3417 if (!branch_ && anyAction != 2 && !hitMaxTime) { 3409 3418 finished = false; 3410 3419 } 
trunk/Cbc/src/CbcSimpleInteger.cpp
r1608 r1624 424 424 olb = model_>solver()>getColLower()[iColumn] ; 425 425 oub = model_>solver()>getColUpper()[iColumn] ; 426 //#define TIGHTEN_BOUNDS427 #ifndef TIGHTEN_BOUNDS426 //#define CBCSIMPLE_TIGHTEN_BOUNDS 427 #ifndef CBCSIMPLE_TIGHTEN_BOUNDS 428 428 #ifdef COIN_DEVELOP 429 429 if (olb != down_[0]  oub != up_[1]) { … … 446 446 } 447 447 #endif 448 #ifndef TIGHTEN_BOUNDS448 #ifndef CBCSIMPLE_TIGHTEN_BOUNDS 449 449 model_>solver()>setColLower(iColumn, down_[0]); 450 450 #else … … 452 452 #endif 453 453 model_>solver()>setColUpper(iColumn, down_[1]); 454 454 //#define CBC_PRINT2 455 455 #ifdef CBC_PRINT2 456 456 printf("%d branching down has bounds %g %g", iColumn, down_[0], down_[1]); … … 496 496 #endif 497 497 model_>solver()>setColLower(iColumn, up_[0]); 498 #ifndef TIGHTEN_BOUNDS498 #ifndef CBCSIMPLE_TIGHTEN_BOUNDS 499 499 model_>solver()>setColUpper(iColumn, up_[1]); 500 500 #else … … 541 541 printf("bad lb change for column %d from %g to %g\n", iColumn, olb, nlb); 542 542 #endif 543 //abort(); 543 544 model_>solver()>setColLower(iColumn, CoinMin(olb, nub)); 544 545 nlb = olb; … … 548 549 printf("bad ub change for column %d from %g to %g\n", iColumn, oub, nub); 549 550 #endif 551 //abort(); 550 552 model_>solver()>setColUpper(iColumn, CoinMax(oub, nlb)); 551 553 } … … 576 578 upper[iColumn] = up_[1]; 577 579 } 580 } 581 // Change (tighten) bounds in object to reflect bounds in solver. 582 // Return true if now fixed 583 bool 584 CbcIntegerBranchingObject::tighten(OsiSolverInterface * solver) 585 { 586 double lower = solver>getColLower()[variable_]; 587 double upper = solver>getColUpper()[variable_]; 588 assert (upper>lower); 589 down_[0] = CoinMax(down_[0],lower); 590 up_[0] = CoinMax(up_[0],lower); 591 down_[1] = CoinMin(down_[1],upper); 592 up_[1] = CoinMin(up_[1],upper); 593 return (down_[0]==up_[1]); 578 594 } 579 595 #ifdef FUNNY_BRANCHING 
trunk/Cbc/src/CbcSimpleInteger.hpp
r1573 r1624 71 71 double * lower, double * upper, 72 72 int branchState) const ; 73 /** Change (tighten) bounds in object to reflect bounds in solver. 74 Return true if now fixed */ 75 virtual bool tighten(OsiSolverInterface * ) ; 73 76 74 77 #ifdef JJF_ZERO … … 237 240 */ 238 241 virtual void resetBounds(const OsiSolverInterface * solver) ; 242 239 243 /** Change column numbers after preprocessing 240 244 */
Note: See TracChangeset
for help on using the changeset viewer.