CbcCountRowCut.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #ifndef CbcCountRowCut_H
00007 #define CbcCountRowCut_H
00008
00009
00010 class OsiCuts;
00011 class OsiRowCut;
00012 class CbcNodeInfo;
00013
00014
00035 class CbcCountRowCut : public OsiRowCut {
00036
00037 public:
00038
00041
00043 CbcCountRowCut ();
00044
00046 CbcCountRowCut ( const OsiRowCut &);
00047
00049 CbcCountRowCut(const OsiRowCut &, CbcNodeInfo *, int whichOne,
00050 int whichGenerator = -1, int numberPointingToThis = 0);
00051
00058 virtual ~CbcCountRowCut ();
00060
00062 void increment(int change = 1);
00063
00065 int decrement(int change = 1);
00066
00074 void setInfo(CbcNodeInfo *, int whichOne);
00075
00077 inline int numberPointingToThis() {
00078 return numberPointingToThis_;
00079 }
00080
00082 inline int whichCutGenerator() const {
00083 return whichCutGenerator_;
00084 }
00085
00087 bool canDropCut(const OsiSolverInterface * solver, int row) const;
00088
00089 #ifdef CHECK_CUT_COUNTS
00090
00091 int tempNumber_;
00092 #endif
00093
00094 private:
00095
00097 CbcCountRowCut(const CbcCountRowCut &);
00098
00100 CbcCountRowCut & operator=(const CbcCountRowCut& rhs);
00101
00103 CbcNodeInfo * owner_;
00104
00107 int ownerCut_;
00108
00110 int numberPointingToThis_;
00111
00118 int whichCutGenerator_;
00119
00120 };
00130
00131 typedef struct {
00132 int index, next;
00133 } CoinHashLink;
00134 class CbcRowCuts {
00135 public:
00136
00137 CbcRowCuts(int initialMaxSize=0, int hashMultiplier=4 );
00138 ~CbcRowCuts();
00139 CbcRowCuts(const CbcRowCuts& rhs);
00140 CbcRowCuts& operator=(const CbcRowCuts& rhs);
00141 inline OsiRowCut2 * cut(int sequence) const
00142 { return rowCut_[sequence];}
00143 inline int numberCuts() const
00144 { return numberCuts_;}
00145 inline int sizeRowCuts() const
00146 { return numberCuts_;}
00147 inline OsiRowCut * rowCutPtr(int sequence)
00148 { return rowCut_[sequence];}
00149 void eraseRowCut(int sequence);
00150
00151 int addCutIfNotDuplicate(const OsiRowCut & cut,int whichType=0);
00152
00153 int addCutIfNotDuplicateWhenGreedy(const OsiRowCut & cut,int whichType=0);
00154
00155 void addCuts(OsiCuts & cs);
00156
00157 void truncate(int numberAfter);
00158 private:
00159 OsiRowCut2 ** rowCut_;
00161 CoinHashLink *hash_;
00162 int size_;
00163 int hashMultiplier_;
00164 int numberCuts_;
00165 int lastHash_;
00166 };
00167 #endif
00168