/home/coin/SVN-release/Cbc-2.3.1/Cbc/src/CbcCutGenerator.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2003, International Business Machines
00002 // Corporation and others.  All Rights Reserved.
00003 #ifndef CbcCutGenerator_H
00004 #define CbcCutGenerator_H
00005 
00006 #include "OsiSolverInterface.hpp"
00007 #include "OsiCuts.hpp"
00008 #include "CglCutGenerator.hpp"
00009 
00010 class CbcModel;
00011 class OsiRowCut;
00012 class OsiRowCutDebugger;
00013 
00014 //#############################################################################
00015 
00045 class CbcCutGenerator  {
00046   
00047 public:
00048     
00066   bool generateCuts( OsiCuts &cs, int fullScan,OsiSolverInterface * solver,
00067                      CbcNode * node); 
00069 
00070     
00073 
00074   CbcCutGenerator (); 
00075 
00077   CbcCutGenerator(CbcModel * model,CglCutGenerator * generator,
00078                   int howOften=1, const char * name=NULL,
00079                   bool normal=true, bool atSolution=false, 
00080                   bool infeasible=false,int howOftenInsub=-100,
00081                   int whatDepth=-1, int whatDepthInSub=-1,int switchOffIfLessThan=0);
00082  
00084   CbcCutGenerator (const CbcCutGenerator &);
00085 
00087   CbcCutGenerator & operator=(const CbcCutGenerator& rhs);
00088 
00090   ~CbcCutGenerator ();
00092 
00100   void refreshModel(CbcModel * model);
00101 
00103   inline const char * cutGeneratorName() const
00104   { return generatorName_;}
00105 
00120   void setHowOften(int value) ;
00121 
00123   inline int howOften() const
00124   { return whenCutGenerator_;}
00126   inline int howOftenInSub() const
00127   { return whenCutGeneratorInSub_;}
00129   inline int inaccuracy() const
00130   { return inaccuracy_;}
00132   inline void setInaccuracy(int level)
00133   { inaccuracy_=level;}
00134 
00145   void setWhatDepth(int value) ;
00147   void setWhatDepthInSub(int value) ;
00149   inline int whatDepth() const
00150   { return depthCutGenerator_;}
00152   inline int whatDepthInSub() const
00153   { return depthCutGeneratorInSub_;}
00154 
00156   inline bool normal() const
00157   { return normal_;}
00159   inline void setNormal(bool value) 
00160   { normal_=value;}
00162   inline bool atSolution() const
00163   { return atSolution_;}
00165   inline void setAtSolution(bool value) 
00166   { atSolution_=value;}
00170   inline bool whenInfeasible() const
00171   { return whenInfeasible_;}
00175   inline void setWhenInfeasible(bool value) 
00176   { whenInfeasible_=value;}
00178   inline bool timing() const
00179   { return timing_;}
00181   inline void setTiming(bool value) 
00182   { timing_=value; timeInCutGenerator_=0.0;}
00184   inline double timeInCutGenerator() const
00185   { return timeInCutGenerator_;}
00186   inline void incrementTimeInCutGenerator(double value)
00187   { timeInCutGenerator_ += value;}
00189   inline CglCutGenerator * generator() const
00190   { return generator_;}
00192   inline int numberTimesEntered() const
00193   { return numberTimes_;}
00194   inline void setNumberTimesEntered(int value)
00195   { numberTimes_ = value;}
00196   inline void incrementNumberTimesEntered(int value=1)
00197   { numberTimes_ += value;}
00199   inline int numberCutsInTotal() const
00200   { return numberCuts_;}
00201   inline void setNumberCutsInTotal(int value)
00202   { numberCuts_ = value;}
00203   inline void incrementNumberCutsInTotal(int value=1)
00204   { numberCuts_ += value;}
00206   inline int numberColumnCuts() const
00207   { return numberColumnCuts_;}
00208   inline void setNumberColumnCuts(int value)
00209   { numberColumnCuts_ = value;}
00210   inline void incrementNumberColumnCuts(int value=1)
00211   { numberColumnCuts_ += value;}
00213   inline int numberCutsActive() const
00214   { return numberCutsActive_;}
00215   inline void setNumberCutsActive(int value)
00216   { numberCutsActive_ = value;}
00217   inline void incrementNumberCutsActive(int value=1)
00218   { numberCutsActive_ += value;}
00219   inline void setSwitchOffIfLessThan(int value) 
00220   { switchOffIfLessThan_ = value;}
00221   inline int switchOffIfLessThan() const
00222   { return switchOffIfLessThan_;}
00224   inline bool needsOptimalBasis() const
00225   { return generator_->needsOptimalBasis();}
00227   inline bool mustCallAgain() const
00228   { return mustCallAgain_;}
00230   inline void setMustCallAgain(bool yesNo)
00231   { mustCallAgain_=yesNo;}
00233   inline bool switchedOff() const
00234   { return switchedOff_;}
00236   inline void setSwitchedOff(bool yesNo)
00237   { switchedOff_=yesNo;}
00239   inline int numberCutsAtRoot() const
00240   { return numberCutsAtRoot_;}
00241   inline void setNumberCutsAtRoot(int value)
00242   { numberCutsAtRoot_ = value;}
00244   inline int numberActiveCutsAtRoot() const
00245   { return numberActiveCutsAtRoot_;}
00246   inline void setNumberActiveCutsAtRoot(int value)
00247   { numberActiveCutsAtRoot_ = value;}
00249   inline void setModel(CbcModel * model)
00250   { model_ = model;}
00252   
00253 private:
00255   CbcModel *model_;
00256 
00257   // The CglCutGenerator object
00258   CglCutGenerator * generator_;
00259 
00263   int whenCutGenerator_;
00267   int whenCutGeneratorInSub_;
00270   int switchOffIfLessThan_;
00271 
00275   int depthCutGenerator_;
00276 
00281   int depthCutGeneratorInSub_;
00282 
00284   char * generatorName_;
00285 
00287   bool normal_;
00288 
00290   bool atSolution_;
00291 
00293   bool whenInfeasible_;
00295   bool mustCallAgain_;
00297   bool switchedOff_;
00299   bool globalCutsAtRoot_;
00301   bool timing_;
00303   double timeInCutGenerator_;
00305   int inaccuracy_;
00307   int numberTimes_;
00309   int numberCuts_;
00311   int numberColumnCuts_;
00313   int numberCutsActive_;
00315   int numberCutsAtRoot_;
00317   int numberActiveCutsAtRoot_;
00318 };
00328 class CbcCutModifier {
00329 public:
00331   CbcCutModifier ();
00332 
00333   // Copy constructor 
00334   CbcCutModifier ( const CbcCutModifier &);
00335    
00337   virtual ~CbcCutModifier();
00338 
00340   CbcCutModifier & operator=(const CbcCutModifier& rhs);
00342   virtual CbcCutModifier * clone() const = 0;
00343 
00350   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) =0;
00352   virtual void generateCpp( FILE * fp) {}
00353 protected:
00354   
00355 };
00356 
00369 class CbcCutSubsetModifier  : public CbcCutModifier {
00370 public:
00372   CbcCutSubsetModifier ();
00373 
00375   CbcCutSubsetModifier (int firstOdd);
00376 
00377   // Copy constructor 
00378   CbcCutSubsetModifier ( const CbcCutSubsetModifier &);
00379    
00381   virtual ~CbcCutSubsetModifier();
00382 
00384   CbcCutSubsetModifier & operator=(const CbcCutSubsetModifier& rhs);
00386   virtual CbcCutModifier * clone() const ;
00387 
00394   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) ;
00396   virtual void generateCpp( FILE * fp) {}
00397 protected:
00400   int firstOdd_;
00401 };
00402 // How often to do if mostly switched off (A) 
00403 # define SCANCUTS 1000  
00404 // How often to do if mostly switched off (probing B)
00405 # define SCANCUTS_PROBING 1000  
00406 
00407 #endif

Generated on Mon Sep 14 03:01:34 2009 by  doxygen 1.4.7