/home/coin/SVN-release/Cbc-2.0.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,CbcNode * node); 
00068 
00069     
00072 
00073   CbcCutGenerator (); 
00074 
00076   CbcCutGenerator(CbcModel * model,CglCutGenerator * generator,
00077                   int howOften=1, const char * name=NULL,
00078                   bool normal=true, bool atSolution=false, 
00079                   bool infeasible=false,int howOftenInsub=-100,
00080                   int whatDepth=-1, int whatDepthInSub=-1,int switchOffIfLessThan=0);
00081  
00083   CbcCutGenerator (const CbcCutGenerator &);
00084 
00086   CbcCutGenerator & operator=(const CbcCutGenerator& rhs);
00087 
00089   ~CbcCutGenerator ();
00091 
00099   void refreshModel(CbcModel * model);
00100 
00102   inline const char * cutGeneratorName() const
00103   { return generatorName_;}
00104 
00119   void setHowOften(int value) ;
00120 
00122   inline int howOften() const
00123   { return whenCutGenerator_;}
00125   inline int howOftenInSub() const
00126   { return whenCutGeneratorInSub_;}
00127 
00138   void setWhatDepth(int value) ;
00140   void setWhatDepthInSub(int value) ;
00142   inline int whatDepth() const
00143   { return depthCutGenerator_;}
00145   inline int whatDepthInSub() const
00146   { return depthCutGeneratorInSub_;}
00147 
00149   inline bool normal() const
00150   { return normal_;}
00152   inline void setNormal(bool value) 
00153   { normal_=value;}
00155   inline bool atSolution() const
00156   { return atSolution_;}
00158   inline void setAtSolution(bool value) 
00159   { atSolution_=value;}
00163   inline bool whenInfeasible() const
00164   { return whenInfeasible_;}
00168   inline void setWhenInfeasible(bool value) 
00169   { whenInfeasible_=value;}
00171   inline bool timing() const
00172   { return timing_;}
00174   inline void setTiming(bool value) 
00175   { timing_=value; timeInCutGenerator_=0.0;}
00177   inline double timeInCutGenerator() const
00178   { return timeInCutGenerator_;}
00179   inline void incrementTimeInCutGenerator(double value)
00180   { timeInCutGenerator_ += value;}
00182   inline CglCutGenerator * generator() const
00183   { return generator_;}
00185   inline int numberTimesEntered() const
00186   { return numberTimes_;}
00187   inline void setNumberTimesEntered(int value)
00188   { numberTimes_ = value;}
00189   inline void incrementNumberTimesEntered(int value=1)
00190   { numberTimes_ += value;}
00192   inline int numberCutsInTotal() const
00193   { return numberCuts_;}
00194   inline void setNumberCutsInTotal(int value)
00195   { numberCuts_ = value;}
00196   inline void incrementNumberCutsInTotal(int value=1)
00197   { numberCuts_ += value;}
00199   inline int numberColumnCuts() const
00200   { return numberColumnCuts_;}
00201   inline void setNumberColumnCuts(int value)
00202   { numberColumnCuts_ = value;}
00203   inline void incrementNumberColumnCuts(int value=1)
00204   { numberColumnCuts_ += value;}
00206   inline int numberCutsActive() const
00207   { return numberCutsActive_;}
00208   inline void setNumberCutsActive(int value)
00209   { numberCutsActive_ = value;}
00210   inline void incrementNumberCutsActive(int value=1)
00211   { numberCutsActive_ += value;}
00212   inline void setSwitchOffIfLessThan(int value) 
00213   { switchOffIfLessThan_ = value;}
00214   inline int switchOffIfLessThan() const
00215   { return switchOffIfLessThan_;}
00217   inline bool needsOptimalBasis() const
00218   { return generator_->needsOptimalBasis();}
00220   inline bool mustCallAgain() const
00221   { return mustCallAgain_;}
00223   inline void setMustCallAgain(bool yesNo)
00224   { mustCallAgain_=yesNo;}
00226   inline bool switchedOff() const
00227   { return switchedOff_;}
00229   inline void setSwitchedOff(bool yesNo)
00230   { switchedOff_=yesNo;}
00232   inline int numberCutsAtRoot() const
00233   { return numberCutsAtRoot_;}
00234   inline void setNumberCutsAtRoot(int value)
00235   { numberCutsAtRoot_ = value;}
00237   inline int numberActiveCutsAtRoot() const
00238   { return numberActiveCutsAtRoot_;}
00239   inline void setNumberActiveCutsAtRoot(int value)
00240   { numberActiveCutsAtRoot_ = value;}
00242   inline void setModel(CbcModel * model)
00243   { model_ = model;}
00245   
00246 private:
00248   CbcModel *model_;
00249 
00250   // The CglCutGenerator object
00251   CglCutGenerator * generator_;
00252 
00256   int whenCutGenerator_;
00260   int whenCutGeneratorInSub_;
00263   int switchOffIfLessThan_;
00264 
00268   int depthCutGenerator_;
00269 
00274   int depthCutGeneratorInSub_;
00275 
00277   char * generatorName_;
00278 
00280   bool normal_;
00281 
00283   bool atSolution_;
00284 
00286   bool whenInfeasible_;
00288   bool mustCallAgain_;
00290   bool switchedOff_;
00292   bool timing_;
00294   double timeInCutGenerator_;
00295   
00297   int numberTimes_;
00299   int numberCuts_;
00301   int numberColumnCuts_;
00303   int numberCutsActive_;
00305   int numberCutsAtRoot_;
00307   int numberActiveCutsAtRoot_;
00308 };
00318 class CbcCutModifier {
00319 public:
00321   CbcCutModifier ();
00322 
00323   // Copy constructor 
00324   CbcCutModifier ( const CbcCutModifier &);
00325    
00327   virtual ~CbcCutModifier();
00328 
00330   CbcCutModifier & operator=(const CbcCutModifier& rhs);
00332   virtual CbcCutModifier * clone() const = 0;
00333 
00340   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) =0;
00342   virtual void generateCpp( FILE * fp) {}
00343 protected:
00344   
00345 };
00346 
00359 class CbcCutSubsetModifier  : public CbcCutModifier {
00360 public:
00362   CbcCutSubsetModifier ();
00363 
00365   CbcCutSubsetModifier (int firstOdd);
00366 
00367   // Copy constructor 
00368   CbcCutSubsetModifier ( const CbcCutSubsetModifier &);
00369    
00371   virtual ~CbcCutSubsetModifier();
00372 
00374   CbcCutSubsetModifier & operator=(const CbcCutSubsetModifier& rhs);
00376   virtual CbcCutModifier * clone() const ;
00377 
00384   virtual int modify(const OsiSolverInterface * solver, OsiRowCut & cut) ;
00386   virtual void generateCpp( FILE * fp) {}
00387 protected:
00390   int firstOdd_;
00391 };
00392 
00393 #endif

Generated on Thu May 15 22:07:39 2008 by  doxygen 1.4.7