Changeset 1681
 Timestamp:
 Jun 29, 2011 3:43:11 AM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

stable/2.7/Cbc/src/CbcModel.cpp
r1675 r1681 2396 2396 if (numberObjects_) 2397 2397 doHeuristicsAtRoot(); 2398 #ifdef COIN_HAS_BONMIN // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics) 2399 solver_>resolve(); 2400 if(!isProvenOptimal()){ 2401 solver_>initialSolve(); 2402 } 2403 #endif 2398 if (solverCharacteristics_>solutionAddsCuts()) { 2399 // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics) 2400 solver_>resolve(); 2401 if(!isProvenOptimal()){ 2402 solver_>initialSolve(); 2403 } 2404 } 2404 2405 /* 2405 2406 Grepping through the code, it would appear that this is a command line … … 2413 2414 stoppedOnGap_ = false ; 2414 2415 // See if can stop on gap 2415 #ifdef COIN_HAS_BONMIN // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics) 2416 solver_>resolve(); 2417 if(!isProvenOptimal()){ 2418 solver_>initialSolve(); 2419 } 2420 #endif 2416 if (solverCharacteristics_>solutionAddsCuts()) { 2417 // With some heuristics solver needs a resolve here (don't know if this is bug in heuristics) 2418 solver_>resolve(); 2419 if(!isProvenOptimal()){ 2420 solver_>initialSolve(); 2421 } 2422 } 2421 2423 bestPossibleObjective_ = solver_>getObjValue() * solver_>getObjSense(); 2422 2424 double testGap = CoinMax(dblParam_[CbcAllowableGap], … … 7105 7107 << CoinMessageEol ; 7106 7108 } 7107 #ifdef COIN_HAS_BONMIN//Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc2.4)7108 7109 7110 7111 7112 7113 7114 7115 7109 //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc2.4) 7110 if (solverCharacteristics_>solutionAddsCuts()&&numberViolated) { 7111 for (i = 0;i<numberCutGenerators_;i++) { 7112 if (generator_[i]>mustCallAgain()) { 7113 keepGoing=true; // say must go round 7114 break; 7115 } 7116 } 7117 } 7116 7118 if(!keepGoing){ 7117 #endif 7118 // Status for single pass of cut generation 7119 int status = 0; 7120 /* 7121 threadMode with bit 2^1 set indicates we should use threads for root cut 7122 generation. 7123 */ 7124 if ((threadMode_&2) == 0  numberNodes_) { 7119 // Status for single pass of cut generation 7120 int status = 0; 7121 /* 7122 threadMode with bit 2^1 set indicates we should use threads for root cut 7123 generation. 7124 */ 7125 if ((threadMode_&2) == 0  numberNodes_) { 7125 7126 status = serialCuts(theseCuts, node, slackCuts, lastNumberCuts); 7126 7127 } else { 7127 7128 // do cuts independently 7128 7129 #ifdef CBC_THREAD 7129 7130 status = parallelCuts(master, theseCuts, node, slackCuts, lastNumberCuts); 7130 7131 #endif 7131 7132 7133 7134 7132 } 7133 // Do we need feasible and violated? 7134 feasible = (status >= 0); 7135 if (status == 1) 7135 7136 keepGoing = true; 7136 7137 else if (status == 2) 7137 7138 numberTries = 0; 7138 7139 if (!feasible) 7139 7140 violated = 2; 7140 #ifdef COIN_HAS_BONMIN //Is Necessary for Bonmin? Always keepGoing if cuts have been generated in last iteration (taken from similar code in Cbc2.4) 7141 } 7142 #endif 7141 } 7143 7142 //if (!feasible) 7144 7143 //break; … … 12595 12594 #endif 12596 12595 currentNode_ = newNode; // so can be used elsewhere 12597 #ifdef COIN_HAS_BONMIN // Remember number of rows to restore at the end of the loop12598 int saveNumberRows=solver_>getNumRows();12599 #endif12600 12596 /* 12601 12597 Enough preparation. Get down to the business of choosing a branching 12602 12598 variable. 12603 12599 */ 12604 #ifdef COIN_HAS_BONMIN // Remember number of rows to restore at the end of the loop12605 12600 int saveNumberRows=solver_>getNumRows(); 12606 #endif12607 12601 while (anyAction == 1) { 12608 12602 // Set objective value (not so obvious if NLP etc) … … 12694 12688 resolve(solver_); 12695 12689 double objval = solver_>getObjValue(); 12696 #ifndef COIN_HAS_BONMIN12697 int saveNumberRows = solver_>getNumRows();12698 #endif12699 12690 lastHeuristic_ = NULL; 12700 12691 setBestSolution(CBC_SOLUTION, objval, … … 12714 12705 feasible = false; // pretend infeasible 12715 12706 } 12716 #ifndef COIN_HAS_BONMIN12717 if( saveNumberRows<solver_>getNumRows()) {12718 // delete rows  but leave solution12719 int n = solver_>getNumRows();12720 int * del = new int [nsaveNumberRows];12721 for (int i=saveNumberRows;i<n;i++)12722 del[isaveNumberRows]=i;12723 solver_>deleteRows(nsaveNumberRows,del);12724 delete [] del;12725 }12726 #endif12727 12707 if (feasible) 12728 12708 anyAction = 1; … … 12765 12745 } 12766 12746 } 12767 #ifdef COIN_HAS_BONMIN //A candidate has been found; restore the subproblem.12768 12747 if( saveNumberRows<solver_>getNumRows()) { 12769 12748 // delete rows  but leave solution … … 12775 12754 delete [] del; 12776 12755 } 12777 #endif12778 12756 /* 12779 12757 End main loop to choose a branching variable.
Note: See TracChangeset
for help on using the changeset viewer.