Changeset 135 for trunk/CbcStrategy.cpp
 Timestamp:
 May 19, 2005 11:24:16 AM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/CbcStrategy.cpp
r116 r135 42 42 CbcStrategyDefault::CbcStrategyDefault(bool cutsOnlyAtRoot, 43 43 int numberStrong, 44 int numberBeforeTrust, 44 45 int printLevel) 45 46 :CbcStrategy(), 46 47 cutsOnlyAtRoot_(cutsOnlyAtRoot), 47 48 numberStrong_(numberStrong), 49 numberBeforeTrust_(numberBeforeTrust), 48 50 printLevel_(printLevel) 49 51 { … … 69 71 cutsOnlyAtRoot_(rhs.cutsOnlyAtRoot_), 70 72 numberStrong_(rhs.numberStrong_), 73 numberBeforeTrust_(rhs.numberBeforeTrust_), 71 74 printLevel_(rhs.printLevel_) 72 75 { … … 83 86 CglProbing generator1; 84 87 generator1.setUsingObjective(true); 85 generator1.setMaxPass( 3);88 generator1.setMaxPass(1); 86 89 // Number of unsatisfied variables to look at 87 90 generator1.setMaxProbe(10); 88 91 // How far to follow the consequences 89 generator1.setMaxLook( 50);92 generator1.setMaxLook(10); 90 93 // Only look at rows with fewer than this number of elements 91 94 generator1.setMaxElements(200); 92 generator1.setRowCuts(3);95 //generator1.setRowCuts(3); 93 96 94 97 CglGomory generator2; … … 113 116 // Add in generators 114 117 int setting = cutsOnlyAtRoot_ ? 99 : 1; 115 116 model.addCutGenerator(&generator1,setting,"Probing");117 model.addCutGenerator(&generator2,setting,"Gomory");118 model.addCutGenerator(&generator3,setting,"Knapsack");119 //model.addCutGenerator(&generator4,setting,"OddHole");120 model.addCutGenerator(&generator5,setting,"Clique");121 model.addCutGenerator(&flowGen,setting,"FlowCover");122 model.addCutGenerator(&mixedGen,setting,"MixedIntegerRounding");123 // Say we want timings124 118 int numberGenerators = model.numberCutGenerators(); 125 119 int iGenerator; 126 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 120 bool found; 121 found=false; 122 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 123 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 124 CglProbing * cgl = dynamic_cast<CglProbing *>(generator); 125 if (cgl) { 126 found=true; 127 break; 128 } 129 } 130 if (!found) 131 model.addCutGenerator(&generator1,setting,"Probing"); 132 found=false; 133 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 134 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 135 CglGomory * cgl = dynamic_cast<CglGomory *>(generator); 136 if (cgl) { 137 found=true; 138 break; 139 } 140 } 141 if (!found) 142 model.addCutGenerator(&generator2,setting,"Gomory"); 143 found=false; 144 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 145 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 146 CglKnapsackCover * cgl = dynamic_cast<CglKnapsackCover *>(generator); 147 if (cgl) { 148 found=true; 149 break; 150 } 151 } 152 if (!found) 153 model.addCutGenerator(&generator3,setting,"Knapsack"); 154 //model.addCutGenerator(&generator4,setting,"OddHole"); 155 found=false; 156 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 157 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 158 CglClique * cgl = dynamic_cast<CglClique *>(generator); 159 if (cgl) { 160 found=true; 161 break; 162 } 163 } 164 if (!found) 165 model.addCutGenerator(&generator5,setting,"Clique"); 166 found=false; 167 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 168 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 169 CglFlowCover * cgl = dynamic_cast<CglFlowCover *>(generator); 170 if (cgl) { 171 found=true; 172 break; 173 } 174 } 175 if (!found) 176 model.addCutGenerator(&flowGen,setting,"FlowCover"); 177 found=false; 178 for (iGenerator=0;iGenerator<numberGenerators;iGenerator++) { 179 CglCutGenerator * generator = model.cutGenerator(iGenerator)>generator(); 180 CglMixedIntegerRounding * cgl = dynamic_cast<CglMixedIntegerRounding *>(generator); 181 if (cgl) { 182 found=true; 183 break; 184 } 185 } 186 if (!found) 187 model.addCutGenerator(&mixedGen,setting,"MixedIntegerRounding"); 188 // Say we want timings 189 int newNumberGenerators = model.numberCutGenerators(); 190 for (iGenerator=numberGenerators;iGenerator<newNumberGenerators;iGenerator++) { 127 191 CbcCutGenerator * generator = model.cutGenerator(iGenerator); 128 192 generator>setTiming(true); … … 142 206 143 207 CbcRounding heuristic1(model); 144 model.addHeuristic(&heuristic1); 208 int numberHeuristics = model.numberHeuristics(); 209 int iHeuristic; 210 bool found; 211 found=false; 212 for (iHeuristic=0;iHeuristic<numberHeuristics;iHeuristic++) { 213 CbcHeuristic * heuristic = model.heuristic(iHeuristic); 214 CbcRounding * cgl = dynamic_cast<CbcRounding *>(heuristic); 215 if (cgl) { 216 found=true; 217 break; 218 } 219 } 220 if (!found) 221 model.addHeuristic(&heuristic1); 145 222 } 146 223 // Do printing stuff … … 163 240 { 164 241 model.setNumberStrong(numberStrong_); 242 model.setNumberBeforeTrust(numberBeforeTrust_); 165 243 } 166 244
Note: See TracChangeset
for help on using the changeset viewer.