Changeset 2102
 Timestamp:
 Dec 15, 2014 10:45:52 AM (4 years ago)
 Location:
 stable/2.8/Cbc/src
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

stable/2.8/Cbc/src/CbcHeuristicRENS.cpp
r1902 r2102 33 33 whereFrom_ = 256 + 1; 34 34 } 35 36 35 // Constructor with model  assumed before cuts 37 36 … … 87 86 int returnCode = 0; 88 87 const double * bestSolution = model_>bestSolution(); 88 bool returnNow=false; 89 89 if ((numberTries_&&(rensType_&16)==0)  numberTries_>1  (when() < 2 && bestSolution)) 90 returnNow=true;; 91 // If 32 bit set then do once with bestSolution 92 if ((rensType_&32)!=0&&bestSolution) 93 returnNow=false; 94 if (returnNow) 90 95 return 0; 96 // switch off next time if bestSolution 97 if (bestSolution) { 98 if ((rensType_&32)!=0) 99 rensType_ &= ~32; // switch off but leave bestSolution 100 else 101 bestSolution=NULL; // null bestSolution so won't use 102 } 91 103 numberTries_++; 104 #ifdef HEURISTIC_INFORM 105 printf("Entering heuristic %s  nRuns %d numCould %d when %d\n", 106 heuristicName(),numRuns_,numCouldRun_,when_); 107 #endif 92 108 double saveFractionSmall=fractionSmall_; 93 109 OsiSolverInterface * solver = model_>solver(); … … 736 752 int numberAtBound = 0; 737 753 int numberContinuous = numberColumns  numberIntegers; 738 754 /* 755 0  allow fixing 756 1  don't allow fixing 757 */ 758 char * marked = new char [numberColumns]; 759 memset(marked,0,numberColumns); 760 if (bestSolution) { 761 for (i = 0; i < numberIntegers; i++) { 762 int iColumn = integerVariable[i]; 763 double value = currentSolution[iColumn]; 764 double lower = colLower[iColumn]; 765 double upper = colUpper[iColumn]; 766 value = CoinMax(value, lower); 767 value = CoinMin(value, upper); 768 if (fabs(bestSolution[iColumn]value)>0.999) 769 marked[iColumn]=1; 770 } 771 } 772 if ((rensType_&(64128))!=0&&model_>objects()) { 773 int lowPriority=COIN_INT_MAX; 774 int highPriority=COIN_INT_MAX; 775 for (i = 0; i < numberIntegers; i++) { 776 int priority=model_>priority(i); 777 lowPriority=CoinMax(lowPriority,priority); 778 highPriority=CoinMin(highPriority,priority); 779 } 780 if (highPriority<lowPriority) { 781 int keepPriority=((rensType_&64)!=0) ? highPriority : lowPriority; 782 for (i = 0; i < numberIntegers; i++) { 783 int iColumn = integerVariable[i]; 784 int priority=model_>priority(i); 785 if (priority==keepPriority) 786 marked[iColumn]=1; 787 } 788 } 789 } 739 790 for (i = 0; i < numberIntegers; i++) { 740 791 int iColumn = integerVariable[i]; … … 745 796 value = CoinMin(value, upper); 746 797 double djValue=dj[iColumn]*direction; 798 bool dontFix=marked[iColumn]!=0; 747 799 #define RENS_FIX_ONLY_LOWER 748 800 #ifndef RENS_FIX_ONLY_LOWER 749 801 if (fabs(value  floor(value + 0.5)) < 1.0e8) { 750 802 value = floor(value + 0.5); 803 if (dontFix) { 804 continue; 805 } 751 806 if (value == lower  value == upper) 752 807 numberAtBound++; … … 763 818 floor(value + 0.5) == lower && 764 819 djValue > djTolerance ) { 820 if (dontFix) { 821 continue; 822 } 765 823 value = floor(value + 0.5); 766 824 numberAtBound++; … … 772 830 djValue > djTolerance && (djTolerance > 0.0type==2)) { 773 831 value = floor(value + 0.5); 832 if (dontFix) { 833 continue; 834 } 774 835 numberAtBound++; 775 836 newSolver>setColLower(iColumn, value); … … 794 855 #endif 795 856 } 857 delete [] marked; 796 858 delete [] dj; 797 859 if (numberFixed > numberIntegers / 5) { 
stable/2.8/Cbc/src/CbcHeuristicRENS.hpp
r1902 r2102 67 67 3  fix on 0.01*average dj 68 68 add 16 to allow two tries 69 32  if solution exists use to keep more variables 70 64  if priorities keep high priority 71 128  if priorities keep low priority 69 72 */ 70 73 int rensType_; 
stable/2.8/Cbc/src/CbcSolver.cpp
r2085 r2102 657 657 parameters_[whichParam(CBC_PARAM_STR_FPUMP, numberParameters_, parameters_)].setCurrentOption("on"); 658 658 parameters_[whichParam(CBC_PARAM_STR_GREEDY, numberParameters_, parameters_)].setCurrentOption("on"); 659 parameters_[whichParam(CBC_PARAM_STR_COMBINE, numberParameters_, parameters_)].setCurrentOption("o n");659 parameters_[whichParam(CBC_PARAM_STR_COMBINE, numberParameters_, parameters_)].setCurrentOption("off"); 660 660 parameters_[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters_, parameters_)].setCurrentOption("off"); 661 661 parameters_[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters_, parameters_)].setCurrentOption("off"); … … 9782 9782 parameters[whichParam(CBC_PARAM_STR_FPUMP, numberParameters, parameters)].setCurrentOption("on"); 9783 9783 parameters[whichParam(CBC_PARAM_STR_GREEDY, numberParameters, parameters)].setCurrentOption("on"); 9784 parameters[whichParam(CBC_PARAM_STR_COMBINE, numberParameters, parameters)].setCurrentOption("o n");9784 parameters[whichParam(CBC_PARAM_STR_COMBINE, numberParameters, parameters)].setCurrentOption("off"); 9785 9785 parameters[whichParam(CBC_PARAM_STR_CROSSOVER2, numberParameters, parameters)].setCurrentOption("off"); 9786 9786 parameters[whichParam(CBC_PARAM_STR_PIVOTANDCOMPLEMENT, numberParameters, parameters)].setCurrentOption("off");
Note: See TracChangeset
for help on using the changeset viewer.