Changes from stable/2.7/Cbc/src/CbcCutGenerator.cpp at r1675 to stable/2.8/Cbc/src/CbcCutGenerator.cpp at r1883
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

stable/2.8/Cbc/src/CbcCutGenerator.cpp
r1675 r1883 50 50 numberActiveCutsAtRoot_(0), 51 51 numberShortCutsAtRoot_(0), 52 switches_(1) 52 switches_(1), 53 maximumTries_(1) 53 54 { 54 55 } … … 73 74 numberActiveCutsAtRoot_(0), 74 75 numberShortCutsAtRoot_(0), 75 switches_(1) 76 switches_(1), 77 maximumTries_(1) 76 78 { 77 79 if (howOften < 1900) { … … 111 113 generatorName_ = CoinStrdup(rhs.generatorName_); 112 114 switches_ = rhs.switches_; 115 maximumTries_ = rhs.maximumTries_; 113 116 timeInCutGenerator_ = rhs.timeInCutGenerator_; 114 117 savedCuts_ = rhs.savedCuts_; … … 141 144 generatorName_ = CoinStrdup(rhs.generatorName_); 142 145 switches_ = rhs.switches_; 146 maximumTries_ = rhs.maximumTries_; 143 147 timeInCutGenerator_ = rhs.timeInCutGenerator_; 144 148 savedCuts_ = rhs.savedCuts_; … … 202 206 if (howOften == 100) 203 207 return false; 208 int pass = model_>getCurrentPassNumber()  1; 209 if (maximumTries_>0) { 210 // howOften means what it says 211 if ((pass%howOften)!=0depth) 212 return false; 213 else 214 howOften=1; 215 } 204 216 if (howOften > 0) 205 217 howOften = howOften % 1000000; … … 210 222 bool returnCode = false; 211 223 //OsiSolverInterface * solver = model_>solver(); 212 int pass = model_>getCurrentPassNumber()  1;213 224 // Reset cuts on first pass 214 225 if (!pass) … … 287 298 CglProbing* generator = 288 299 dynamic_cast<CglProbing*>(generator_); 300 //if (!depth&&!pass) 301 //printf("Cut generator %s when %d\n",generatorName_,whenCutGenerator_); 289 302 if (!generator) { 290 303 // Pass across model information in case it could be useful … … 1119 1132 } 1120 1133 #endif 1121 { 1122 int numberRowCutsAfter = cs.sizeRowCuts() ;1123 1124 1125 1126 1127 1128 1134 int numberRowCutsAfter = cs.sizeRowCuts() ; 1135 int numberColumnCutsAfter = cs.sizeColCuts() ; 1136 if (numberRowCutsBefore < numberRowCutsAfter) { 1137 for (int k = numberRowCutsBefore; k < numberRowCutsAfter; k++) { 1138 OsiRowCut thisCut = cs.rowCut(k) ; 1139 int n = thisCut.row().getNumElements(); 1140 numberElements_ += n; 1141 } 1129 1142 #ifdef JJF_ZERO 1130 printf("generator %s generated %d row cuts\n", 1131 generatorName_, numberRowCutsAfter  numberRowCutsBefore); 1132 #endif 1133 numberCuts_ += numberRowCutsAfter  numberRowCutsBefore; 1134 } 1135 int numberColumnCutsAfter = cs.sizeColCuts() ; 1136 if (numberColumnCutsBefore < numberColumnCutsAfter) { 1143 printf("generator %s generated %d row cuts\n", 1144 generatorName_, numberRowCutsAfter  numberRowCutsBefore); 1145 #endif 1146 numberCuts_ += numberRowCutsAfter  numberRowCutsBefore; 1147 } 1148 if (numberColumnCutsBefore < numberColumnCutsAfter) { 1137 1149 #ifdef JJF_ZERO 1138 printf("generator %s generated %d column cuts\n", 1139 generatorName_, numberColumnCutsAfter  numberColumnCutsBefore); 1140 #endif 1141 numberColumnCuts_ += numberColumnCutsAfter  numberColumnCutsBefore; 1142 } 1150 printf("generator %s generated %d column cuts\n", 1151 generatorName_, numberColumnCutsAfter  numberColumnCutsBefore); 1152 #endif 1153 numberColumnCuts_ += numberColumnCutsAfter  numberColumnCutsBefore; 1143 1154 } 1144 1155 if (timing()) 1145 1156 timeInCutGenerator_ += CoinCpuTime()  time1; 1146 #ifdef JJF_ZERO1147 1157 // switch off if first time and no good 1148 if (node == NULL && !pass) { 1149 if (cs.sizeCuts()  cutsBefore < CoinAbs(switchOffIfLessThan_)) { 1150 whenCutGenerator_ = 99; 1151 whenCutGeneratorInSub_ = 200; 1158 if (node == NULL && !pass ) { 1159 if (numberRowCutsAfter  numberRowCutsBefore 1160 < switchOffIfLessThan_ /*&& numberCuts_ < switchOffIfLessThan_*/) { 1161 // switch off 1162 maximumTries_ = 0; 1163 whenCutGenerator_=100; 1164 //whenCutGenerator_ = 100; 1165 //whenCutGeneratorInSub_ = 200; 1152 1166 } 1153 1167 } 1154 #endif 1168 if (maximumTries_>0) { 1169 maximumTries_; 1170 if (!maximumTries_) 1171 whenCutGenerator_=100; 1172 } 1155 1173 } 1156 1174 return returnCode; … … 1182 1200 { 1183 1201 depthCutGeneratorInSub_ = value; 1202 } 1203 // Add in statistics from other 1204 void 1205 CbcCutGenerator::addStatistics(const CbcCutGenerator * other) 1206 { 1207 // Time in cut generator 1208 timeInCutGenerator_ += other>timeInCutGenerator_; 1209 // Number times cut generator entered 1210 numberTimes_ += other>numberTimes_; 1211 // Total number of cuts added 1212 numberCuts_ += other>numberCuts_; 1213 // Total number of elements added 1214 numberElements_ += other>numberElements_; 1215 // Total number of column cuts added 1216 numberColumnCuts_ += other>numberColumnCuts_; 1217 // Total number of cuts active after (at end of n cut passes at each node) 1218 numberCutsActive_ += other>numberCutsActive_; 1219 // Number of cuts generated at root 1220 numberCutsAtRoot_ += other>numberCutsAtRoot_; 1221 // Number of cuts active at root 1222 numberActiveCutsAtRoot_ += other>numberActiveCutsAtRoot_; 1223 // Number of short cuts at root 1224 numberShortCutsAtRoot_ += other>numberShortCutsAtRoot_; 1225 } 1226 // Scale back statistics by factor 1227 void 1228 CbcCutGenerator::scaleBackStatistics(int factor) 1229 { 1230 // leave time 1231 // Number times cut generator entered 1232 numberTimes_ = (numberTimes_+factor1)/factor; 1233 // Total number of cuts added 1234 numberCuts_ = (numberCuts_+factor1)/factor; 1235 // Total number of elements added 1236 numberElements_ = (numberElements_+factor1)/factor; 1237 // Total number of column cuts added 1238 numberColumnCuts_ = (numberColumnCuts_+factor1)/factor; 1239 // Total number of cuts active after (at end of n cut passes at each node) 1240 numberCutsActive_ = (numberCutsActive_+factor1)/factor; 1241 // Number of cuts generated at root 1242 numberCutsAtRoot_ = (numberCutsAtRoot_+factor1)/factor; 1243 // Number of cuts active at root 1244 numberActiveCutsAtRoot_ = (numberActiveCutsAtRoot_+factor1)/factor; 1245 // Number of short cuts at root 1246 numberShortCutsAtRoot_ = (numberShortCutsAtRoot_+factor1)/factor; 1184 1247 } 1185 1248 // Create C++ lines to get to current state
Note: See TracChangeset
for help on using the changeset viewer.