Changeset 2200
- Timestamp:
- Jun 13, 2015 3:52:17 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cbc/src/CbcModel.cpp
r2198 r2200 1644 1644 dblParam_[CbcLargestChange] = 0.0; 1645 1645 intParam_[CbcNumberBranches] = 0; 1646 double lastBestPossibleObjective=-COIN_DBL_MAX; 1646 1647 // when to check for restart 1647 1648 int nextCheckRestart=50; … … 2452 2453 that produced a given cut. 2453 2454 */ 2454 maximumWhich_ = 1000 ; 2455 #define INITIAL_MAXIMUM_WHICH 1000 2456 maximumWhich_ = INITIAL_MAXIMUM_WHICH ; 2455 2457 delete [] whichGenerator_; 2456 2458 whichGenerator_ = new int[maximumWhich_] ; … … 3615 3617 // mark all cuts as globally valid 3616 3618 int numberCuts=cuts.sizeRowCuts(); 3619 resizeWhichGenerator(0,numberCuts); 3617 3620 for (int i=0;i<numberCuts;i++) { 3618 3621 cuts.rowCutPtr(i)->setGloballyValid(); … … 4654 4657 #endif 4655 4658 if (!intParam_[CbcPrinting]) { 4659 // Parallel may not have any nodes 4660 if (!nNodes) 4661 bestPossibleObjective_ = lastBestPossibleObjective; 4662 else 4663 lastBestPossibleObjective = bestPossibleObjective_; 4656 4664 messageHandler()->message(CBC_STATUS, messages()) 4657 << numberNodes_ << nNodes<< bestObjective_ << bestPossibleObjective_4665 << numberNodes_ << CoinMax(nNodes,1) << bestObjective_ << bestPossibleObjective_ 4658 4666 << getCurrentSeconds() 4659 4667 << CoinMessageEol ; … … 5509 5517 preferredWay_(0), 5510 5518 currentPassNumber_(0), 5511 maximumWhich_( 1000),5519 maximumWhich_(INITIAL_MAXIMUM_WHICH), 5512 5520 maximumRows_(0), 5513 5521 randomSeed_(-1), … … 5679 5687 preferredWay_(0), 5680 5688 currentPassNumber_(0), 5681 maximumWhich_( 1000),5689 maximumWhich_(INITIAL_MAXIMUM_WHICH), 5682 5690 maximumRows_(0), 5683 5691 randomSeed_(-1), … … 7142 7150 } 7143 7151 } 7152 resizeWhichGenerator(currentNumberCuts_,currentNumberCuts); 7144 7153 currentNumberCuts_ = currentNumberCuts; 7145 7154 if (currentNumberCuts > maximumNumberCuts_) { … … 7317 7326 cutsToDrop = new int[currentNumberCuts] ; 7318 7327 assert (currentNumberCuts + numberRowsAtContinuous_ <= lastws->getNumArtificial()); 7328 #undef NDEBUG 7329 assert (currentNumberCuts <= maximumWhich_); // we will read from whichGenerator_[0..currentNumberCuts-1] below, so should have all these entries 7330 // the above assert fails in certain situations, which indicates a bug in the code below 7331 // as a workaround, resize whichGenerator_ to make sure we can read all entries without an invalid read from valgrind (and subsequent crash somewhere, seems so) 7319 7332 resizeWhichGenerator(maximumWhich_, currentNumberCuts); 7320 7333 for (i = 0; i < currentNumberCuts; i++) { … … 7329 7342 numberRowsAtContinuous_ + numberToAdd); 7330 7343 # endif 7344 assert (i<maximumWhich_); 7331 7345 whichGenerator_[numberToAdd] = whichGenerator_[i]; 7332 7346 addCuts[numberToAdd++] = addedCuts_[i]; … … 7642 7656 { 7643 7657 if (numberAfter > maximumWhich_) { 7644 maximumWhich_ = CoinMax(maximumWhich_ * 2 + 100, numberAfter) ; 7658 #define MAXIMUM_WHICH_INCREMENT 100 7659 #define MAXIMUM_WHICH_MULTIPLIER 2 7660 //printf("maximumWhich from %d to %d (%d needed)\n",maximumWhich_, 7661 // CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter), 7662 // numberAfter); 7663 maximumWhich_ = CoinMax(maximumWhich_ * MAXIMUM_WHICH_MULTIPLIER + MAXIMUM_WHICH_INCREMENT, numberAfter) ; 7664 //maximumWhich_ = numberAfter ; 7645 7665 int * temp = new int[2*maximumWhich_] ; 7646 7666 memcpy(temp, whichGenerator_, numberNow*sizeof(int)) ; … … 12495 12515 //OsiHintStrength saveStrength; 12496 12516 //bool savePrintHint; 12497 //solver_->writeMps ("infeas");12517 //solver_->writeMpsNative("infeas.mps", NULL, NULL, 2); 12498 12518 //bool gotHint = (solver_->getHintParam(OsiDoReducePrint,savePrintHint,saveStrength)); 12499 12519 //gotHint = (solver_->getHintParam(OsiDoScale,saveTakeHint,saveStrength)); … … 12724 12744 #if CBC_FEASIBILITY_INVESTIGATE==0 12725 12745 } 12746 #else 12747 solver_->writeMpsNative("BFeasible.mps",NULL,NULL,2); 12726 12748 #endif 12727 12749 //if (fabs(objValue-objectiveValue)>1.0e-7*fabs(objectiveValue)) { … … 17914 17936 delete [] newSolution; 17915 17937 // Space for type of cuts 17916 maximumWhich_ = 1000;17938 maximumWhich_ = INITIAL_MAXIMUM_WHICH; 17917 17939 delete [] whichGenerator_ ; 17918 17940 whichGenerator_ = new int[maximumWhich_]; … … 18487 18509 that produced a given cut. 18488 18510 */ 18489 maximumWhich_ = 1000;18511 maximumWhich_ = INITIAL_MAXIMUM_WHICH ; 18490 18512 delete [] whichGenerator_ ; 18491 18513 whichGenerator_ = new int[maximumWhich_] ;
Note: See TracChangeset
for help on using the changeset viewer.