Go to the documentation of this file.00001
00002
00003
00004 #ifndef CbcCutGenerator_H
00005 #define CbcCutGenerator_H
00006
00007 #include "OsiSolverInterface.hpp"
00008 #include "OsiCuts.hpp"
00009 #include "CglCutGenerator.hpp"
00010 #include "CbcCutModifier.hpp"
00011
00012 class CbcModel;
00013 class OsiRowCut;
00014 class OsiRowCutDebugger;
00015
00016
00017
00047 class CbcCutGenerator {
00048
00049 public:
00050
00069 bool generateCuts( OsiCuts &cs, int fullScan, OsiSolverInterface * solver,
00070 CbcNode * node);
00072
00073
00076
00077 CbcCutGenerator ();
00078
00080 CbcCutGenerator(CbcModel * model, CglCutGenerator * generator,
00081 int howOften = 1, const char * name = NULL,
00082 bool normal = true, bool atSolution = false,
00083 bool infeasible = false, int howOftenInsub = -100,
00084 int whatDepth = -1, int whatDepthInSub = -1, int switchOffIfLessThan = 0);
00085
00087 CbcCutGenerator (const CbcCutGenerator &);
00088
00090 CbcCutGenerator & operator=(const CbcCutGenerator& rhs);
00091
00093 ~CbcCutGenerator ();
00095
00103 void refreshModel(CbcModel * model);
00104
00106 inline const char * cutGeneratorName() const {
00107 return generatorName_;
00108 }
00109
00111 void generateTuning( FILE * fp);
00126 void setHowOften(int value) ;
00127
00129 inline int howOften() const {
00130 return whenCutGenerator_;
00131 }
00133 inline int howOftenInSub() const {
00134 return whenCutGeneratorInSub_;
00135 }
00137 inline int inaccuracy() const {
00138 return inaccuracy_;
00139 }
00141 inline void setInaccuracy(int level) {
00142 inaccuracy_ = level;
00143 }
00144
00155 void setWhatDepth(int value) ;
00157 void setWhatDepthInSub(int value) ;
00159 inline int whatDepth() const {
00160 return depthCutGenerator_;
00161 }
00163 inline int whatDepthInSub() const {
00164 return depthCutGeneratorInSub_;
00165 }
00166
00168 inline bool normal() const {
00169 return (switches_&1) != 0;
00170 }
00172 inline void setNormal(bool value) {
00173 switches_ &= ~1;
00174 switches_ |= value ? 1 : 0;
00175 }
00177 inline bool atSolution() const {
00178 return (switches_&2) != 0;
00179 }
00181 inline void setAtSolution(bool value) {
00182 switches_ &= ~2;
00183 switches_ |= value ? 2 : 0;
00184 }
00188 inline bool whenInfeasible() const {
00189 return (switches_&4) != 0;
00190 }
00194 inline void setWhenInfeasible(bool value) {
00195 switches_ &= ~4;
00196 switches_ |= value ? 4 : 0;
00197 }
00199 inline bool timing() const {
00200 return (switches_&64) != 0;
00201 }
00203 inline void setTiming(bool value) {
00204 switches_ &= ~64;
00205 switches_ |= value ? 64 : 0;
00206 timeInCutGenerator_ = 0.0;
00207 }
00209 inline double timeInCutGenerator() const {
00210 return timeInCutGenerator_;
00211 }
00212 inline void incrementTimeInCutGenerator(double value) {
00213 timeInCutGenerator_ += value;
00214 }
00216 inline CglCutGenerator * generator() const {
00217 return generator_;
00218 }
00220 inline int numberTimesEntered() const {
00221 return numberTimes_;
00222 }
00223 inline void setNumberTimesEntered(int value) {
00224 numberTimes_ = value;
00225 }
00226 inline void incrementNumberTimesEntered(int value = 1) {
00227 numberTimes_ += value;
00228 }
00230 inline int numberCutsInTotal() const {
00231 return numberCuts_;
00232 }
00233 inline void setNumberCutsInTotal(int value) {
00234 numberCuts_ = value;
00235 }
00236 inline void incrementNumberCutsInTotal(int value = 1) {
00237 numberCuts_ += value;
00238 }
00240 inline int numberElementsInTotal() const {
00241 return numberElements_;
00242 }
00243 inline void setNumberElementsInTotal(int value) {
00244 numberElements_ = value;
00245 }
00246 inline void incrementNumberElementsInTotal(int value = 1) {
00247 numberElements_ += value;
00248 }
00250 inline int numberColumnCuts() const {
00251 return numberColumnCuts_;
00252 }
00253 inline void setNumberColumnCuts(int value) {
00254 numberColumnCuts_ = value;
00255 }
00256 inline void incrementNumberColumnCuts(int value = 1) {
00257 numberColumnCuts_ += value;
00258 }
00260 inline int numberCutsActive() const {
00261 return numberCutsActive_;
00262 }
00263 inline void setNumberCutsActive(int value) {
00264 numberCutsActive_ = value;
00265 }
00266 inline void incrementNumberCutsActive(int value = 1) {
00267 numberCutsActive_ += value;
00268 }
00269 inline void setSwitchOffIfLessThan(int value) {
00270 switchOffIfLessThan_ = value;
00271 }
00272 inline int switchOffIfLessThan() const {
00273 return switchOffIfLessThan_;
00274 }
00276 inline bool needsOptimalBasis() const {
00277 return (switches_&128) != 0;
00278 }
00280 inline void setNeedsOptimalBasis(bool yesNo) {
00281 switches_ &= ~128;
00282 switches_ |= yesNo ? 128 : 0;
00283 }
00285 inline bool mustCallAgain() const {
00286 return (switches_&8) != 0;
00287 }
00289 inline void setMustCallAgain(bool yesNo) {
00290 switches_ &= ~8;
00291 switches_ |= yesNo ? 8 : 0;
00292 }
00294 inline bool switchedOff() const {
00295 return (switches_&16) != 0;
00296 }
00298 inline void setSwitchedOff(bool yesNo) {
00299 switches_ &= ~16;
00300 switches_ |= yesNo ? 16 : 0;
00301 }
00303 inline bool ineffectualCuts() const {
00304 return (switches_&512) != 0;
00305 }
00307 inline void setIneffectualCuts(bool yesNo) {
00308 switches_ &= ~512;
00309 switches_ |= yesNo ? 512 : 0;
00310 }
00312 inline bool whetherToUse() const {
00313 return (switches_&1024) != 0;
00314 }
00316 inline void setWhetherToUse(bool yesNo) {
00317 switches_ &= ~1024;
00318 switches_ |= yesNo ? 1024 : 0;
00319 }
00321 inline int numberCutsAtRoot() const {
00322 return numberCutsAtRoot_;
00323 }
00324 inline void setNumberCutsAtRoot(int value) {
00325 numberCutsAtRoot_ = value;
00326 }
00328 inline int numberActiveCutsAtRoot() const {
00329 return numberActiveCutsAtRoot_;
00330 }
00331 inline void setNumberActiveCutsAtRoot(int value) {
00332 numberActiveCutsAtRoot_ = value;
00333 }
00335 inline int numberShortCutsAtRoot() const {
00336 return numberShortCutsAtRoot_;
00337 }
00339 inline void setModel(CbcModel * model) {
00340 model_ = model;
00341 }
00343 inline bool globalCutsAtRoot() const {
00344 return (switches_&32) != 0;
00345 }
00347 inline void setGlobalCutsAtRoot(bool yesNo) {
00348 switches_ &= ~32;
00349 switches_ |= yesNo ? 32 : 0;
00350 }
00352 inline bool globalCuts() const {
00353 return (switches_&256) != 0;
00354 }
00356 inline void setGlobalCuts(bool yesNo) {
00357 switches_ &= ~256;
00358 switches_ |= yesNo ? 256 : 0;
00359 }
00361
00362 private:
00365
00366
00367 OsiCuts savedCuts_;
00369 double timeInCutGenerator_;
00371 CbcModel *model_;
00372
00373
00374 CglCutGenerator * generator_;
00375
00377 char * generatorName_;
00378
00382 int whenCutGenerator_;
00386 int whenCutGeneratorInSub_;
00389 int switchOffIfLessThan_;
00390
00394 int depthCutGenerator_;
00395
00400 int depthCutGeneratorInSub_;
00401
00403 int inaccuracy_;
00405 int numberTimes_;
00407 int numberCuts_;
00409 int numberElements_;
00411 int numberColumnCuts_;
00413 int numberCutsActive_;
00415 int numberCutsAtRoot_;
00417 int numberActiveCutsAtRoot_;
00419 int numberShortCutsAtRoot_;
00421 int switches_;
00422 };
00423
00424
00425 # define SCANCUTS 1000
00426
00427 # define SCANCUTS_PROBING 1000
00428
00429 #endif
00430