/home/coin/SVN-release/CoinAll-1.1.0/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, bool 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_;}
00128 
00139   void setWhatDepth(int value) ;
00141   void setWhatDepthInSub(int value) ;
00143   inline int whatDepth() const
00144   { return depthCutGenerator_;}
00146   inline int whatDepthInSub() const
00147   { return depthCutGeneratorInSub_;}
00148 
00150   inline bool normal() const
00151   { return normal_;}
00153   inline void setNormal(bool value) 
00154   { normal_=value;}
00156   inline bool atSolution() const
00157   { return atSolution_;}
00159   inline void setAtSolution(bool value) 
00160   { atSolution_=value;}
00164   inline bool whenInfeasible() const
00165   { return whenInfeasible_;}
00169   inline void setWhenInfeasible(bool value) 
00170   { whenInfeasible_=value;}
00172   inline bool timing() const
00173   { return timing_;}
00175   inline void setTiming(bool value) 
00176   { timing_=value; timeInCutGenerator_=0.0;}
00178   inline double timeInCutGenerator() const
00179   { return timeInCutGenerator_;}
00180   inline void incrementTimeInCutGenerator(double value)
00181   { timeInCutGenerator_ += value;}
00183   inline CglCutGenerator * generator() const
00184   { return generator_;}
00186   inline int numberTimesEntered() const
00187   { return numberTimes_;}
00188   inline void setNumberTimesEntered(int value)
00189   { numberTimes_ = value;}
00190   inline void incrementNumberTimesEntered(int value=1)
00191   { numberTimes_ += value;}
00193   inline int numberCutsInTotal() const
00194   { return numberCuts_;}
00195   inline void setNumberCutsInTotal(int value)
00196   { numberCuts_ = value;}
00197   inline void incrementNumberCutsInTotal(int value=1)
00198   { numberCuts_ += value;}
00200   inline int numberColumnCuts() const
00201   { return numberColumnCuts_;}
00202   inline void setNumberColumnCuts(int value)
00203   { numberColumnCuts_ = value;}
00204   inline void incrementNumberColumnCuts(int value=1)
00205   { numberColumnCuts_ += value;}
00207   inline int numberCutsActive() const
00208   { return numberCutsActive_;}
00209   inline void setNumberCutsActive(int value)
00210   { numberCutsActive_ = value;}
00211   inline void incrementNumberCutsActive(int value=1)
00212   { numberCutsActive_ += value;}
00213   inline void setSwitchOffIfLessThan(int value) 
00214   { switchOffIfLessThan_ = value;}
00215   inline int switchOffIfLessThan() const
00216   { return switchOffIfLessThan_;}
00218   inline bool needsOptimalBasis() const
00219   { return generator_->needsOptimalBasis();}
00221   inline bool mustCallAgain() const
00222   { return mustCallAgain_;}
00224   inline void setMustCallAgain(bool yesNo)
00225   { mustCallAgain_=yesNo;}
00227   inline bool switchedOff() const
00228   { return switchedOff_;}
00230   inline void setSwitchedOff(bool yesNo)
00231   { switchedOff_=yesNo;}
00233   inline int numberCutsAtRoot() const
00234   { return numberCutsAtRoot_;}
00235   inline void setNumberCutsAtRoot(int value)
00236   { numberCutsAtRoot_ = value;}
00238   inline int numberActiveCutsAtRoot() const
00239   { return numberActiveCutsAtRoot_;}
00240   inline void setNumberActiveCutsAtRoot(int value)
00241   { numberActiveCutsAtRoot_ = value;}
00243   inline void setModel(CbcModel * model)
00244   { model_ = model;}
00246   
00247 private:
00249   CbcModel *model_;
00250 
00251   // The CglCutGenerator object
00252   CglCutGenerator * generator_;
00253 
00257   int whenCutGenerator_;
00261   int whenCutGeneratorInSub_;
00264   int switchOffIfLessThan_;
00265 
00269   int depthCutGenerator_;
00270 
00275   int depthCutGeneratorInSub_;
00276 
00278   char * generatorName_;
00279 
00281   bool normal_;
00282 
00284   bool atSolution_;
00285 
00287   bool whenInfeasible_;
00289   bool mustCallAgain_;
00291   bool switchedOff_;
00293   bool timing_;
00295   double timeInCutGenerator_;
00296   
00298   int numberTimes_;
00300   int numberCuts_;
00302   int numberColumnCuts_;
00304   int numberCutsActive_;
00306   int numberCutsAtRoot_;
00308   int numberActiveCutsAtRoot_;
00309 };
00319 class CbcCutModifier {
00320 public:
00322   CbcCutModifier ();
00323 
00324   // Copy constructor 
00325   CbcCutModifier ( const CbcCutModifier &);
00326    
00328   virtual ~CbcCutModifier();
00329 
00331   CbcCutModifier & operator=(const CbcCutModifier& rhs);
00333   virtual CbcCutModifier * clone() const = 0;
00334 
00341   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) =0;
00343   virtual void generateCpp( FILE * fp) {}
00344 protected:
00345   
00346 };
00347 
00360 class CbcCutSubsetModifier  : public CbcCutModifier {
00361 public:
00363   CbcCutSubsetModifier ();
00364 
00366   CbcCutSubsetModifier (int firstOdd);
00367 
00368   // Copy constructor 
00369   CbcCutSubsetModifier ( const CbcCutSubsetModifier &);
00370    
00372   virtual ~CbcCutSubsetModifier();
00373 
00375   CbcCutSubsetModifier & operator=(const CbcCutSubsetModifier& rhs);
00377   virtual CbcCutModifier * clone() const ;
00378 
00385   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) ;
00387   virtual void generateCpp( FILE * fp) {}
00388 protected:
00391   int firstOdd_;
00392 };
00393 
00394 #endif

Generated on Sun Nov 14 14:06:30 2010 for Coin-All by  doxygen 1.4.7