00001 00054 #ifndef ABA_SEPARATOR_H 00055 #define ABA_SEPARATOR_H 00056 00057 #include "abacus/hash.h" 00058 #include "abacus/buffer.h" 00059 #include "abacus/lpsolution.h" 00060 #include "abacus/nonduplpool.h" 00061 00062 class ABA_ABACUSROOT; 00063 00064 00065 enum ABA_SEPARATOR_CUTFOUND {Added, Duplication, Full}; 00066 template <class BaseType, class CoType> 00067 class ABA_SEPARATOR : public ABA_ABACUSROOT { 00068 public: 00069 00084 ABA_SEPARATOR(ABA_LPSOLUTION<CoType,BaseType> *lpSolution, 00085 bool nonDuplications, int maxGen=300 00086 #ifdef ABACUS_PARALLEL 00087 ,bool sendConstraints 00088 #endif 00089 ); 00090 00092 virtual ~ABA_SEPARATOR(); 00093 00097 virtual void separate()=0; 00098 00111 ABA_SEPARATOR_CUTFOUND cutFound(BaseType *); 00112 00117 virtual bool terminateSeparation() 00118 {return(nGen()>=maxGen());}; 00119 00122 ABA_BUFFER<BaseType *> &cutBuffer(); 00123 00126 int nGen() const; 00127 00130 int nDuplications() const; 00131 00134 int nCollisions() const; 00135 00138 int maxGen() const; 00139 00142 double minAbsViolation() const; 00143 00145 void minAbsViolation(double minAbsVio) 00146 {minAbsViolation_=minAbsVio;}; 00147 00149 ABA_LPSOLUTION<CoType, BaseType> *lpSolution() 00150 {return lpSol_;}; 00151 00160 void watchNonDuplPool(ABA_NONDUPLPOOL<BaseType, CoType> *pool) 00161 {pool_=pool;}; 00162 protected: 00163 00172 bool find(BaseType *); 00173 ABA_MASTER *master_; 00174 ABA_LPSOLUTION<CoType, BaseType> *lpSol_; 00175 private: 00176 double minAbsViolation_; 00177 ABA_BUFFER<BaseType*> newCons_; 00178 ABA_HASH<unsigned, BaseType*> *hash_; 00179 int nDuplications_; 00180 bool sendConstraints_; 00181 ABA_NONDUPLPOOL<BaseType, CoType> *pool_; 00182 ABA_SEPARATOR(const ABA_SEPARATOR<BaseType, CoType> &rhs); 00183 const ABA_SEPARATOR<BaseType, CoType> 00184 &operator=(const ABA_SEPARATOR<BaseType, CoType> & rhs); 00185 }; 00186 00187 #include "abacus/separator.inc" 00188 00198 #endif // ABA_SEPARATOR_H 00199