00001 // Copyright (C) 2000, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 #ifndef CglCutGenerator_H 00004 #define CglCutGenerator_H 00005 00006 #include "OsiCuts.hpp" 00007 #include "OsiSolverInterface.hpp" 00008 00011 struct CglTreeInfo { 00013 int level; 00016 int pass; 00019 int formulation_rows; 00021 bool inTree; 00031 OsiRowCut ** strengthenRow; 00032 CglTreeInfo() : level(-1), pass(-1), formulation_rows(-1), inTree(false), 00033 strengthenRow(NULL) {} 00034 }; 00035 00036 //------------------------------------------------------------------- 00037 // 00038 // Abstract base class for generating cuts. 00039 // 00040 //------------------------------------------------------------------- 00042 00047 class CglCutGenerator { 00048 00049 public: 00050 00057 virtual void generateCuts( const OsiSolverInterface & si, OsiCuts & cs, 00058 const CglTreeInfo info = CglTreeInfo()) const=0; 00060 00061 00064 00065 CglCutGenerator (); 00066 00068 CglCutGenerator ( const CglCutGenerator &); 00069 00071 virtual CglCutGenerator * clone() const = 0; 00072 00074 CglCutGenerator & operator=(const CglCutGenerator& rhs); 00075 00077 virtual ~CglCutGenerator (); 00078 00080 virtual std::string generateCpp( FILE * fp) {return "";}; 00081 00083 virtual void refreshSolver(OsiSolverInterface * solver) {}; 00085 00092 inline int getAggressiveness() const 00093 { return aggressive_;}; 00094 00099 inline void setAggressiveness(int value) 00100 { aggressive_=value;}; 00101 00109 virtual bool mayGenerateRowCutsInTree() const; 00111 virtual bool needsOptimalBasis() const; 00113 00114 // test this class 00115 //static void unitTest(); 00116 00117 // private: 00118 00123 int aggressive_; 00124 }; 00125 00126 00127 #endif