separator.inc

Go to the documentation of this file.
00001 
00029 #ifndef ABA_SEPARATOR_INC
00030 #define ABA_SEPARATOR_INC
00031 
00032 #include "abacus/separator.h"
00033 #include "abacus/lpsolution.h"
00034 #include "abacus/constraint.h"
00035 #include "abacus/variable.h"
00036 #include "abacus/hash.h"
00037 #include "abacus/master.h"
00038 
00039   template <class BaseType, class CoType> 
00040   ABA_SEPARATOR<BaseType, CoType>::ABA_SEPARATOR(ABA_LPSOLUTION<CoType,
00041     BaseType> *lpSolution, bool testDuplications, int maxGen
00042 #ifdef ABACUS_PARALLEL
00043     ,bool sendConstraints
00044 #endif
00045           )
00046 
00047   :  
00048   master_(lpSolution->master_), 
00049   lpSol_(lpSolution), 
00050   minAbsViolation_(master_->eps()), 
00051   newCons_(master_,maxGen), 
00052   hash_(0),
00053   nDuplications_(0),
00054 #ifdef ABACUS_PARALLEL
00055   sendConstraints_(sendConstraints),
00056 #endif
00057   pool_(0)
00058   { 
00059   if(testDuplications)
00060     hash_=new ABA_HASH<unsigned, BaseType *>((ABA_GLOBAL*)master_, 3*maxGen);
00061 }
00062 
00063   template <class BaseType, class CoType>
00064   ABA_SEPARATOR<BaseType, CoType>::~ABA_SEPARATOR()
00065   {
00066     delete hash_;
00067   }
00068 
00069   template <class BaseType, class CoType>
00070   ABA_SEPARATOR_CUTFOUND 
00071   ABA_SEPARATOR<BaseType, CoType>::cutFound(BaseType *cv)
00072   {
00073   if(newCons_.full()) {
00074     delete cv;
00075     return Full;
00076   }
00077 
00078   if(pool_&&pool_->present(cv)) {
00079     delete cv;
00080     nDuplications_++;
00081     return Duplication;
00082   }   
00083 
00084   if(hash_&&find(cv)) {
00085     delete cv;
00086     nDuplications_++;
00087     return Duplication;
00088   }
00089    
00090 
00091   newCons_.push(cv);
00092   if(hash_)
00093     hash_->insert(cv->hashKey(),cv);
00094   return Added;
00095   }
00096 
00097   template <class BaseType, class CoType>
00098    ABA_BUFFER<BaseType *> &ABA_SEPARATOR<BaseType, CoType>::cutBuffer() 
00099   {
00100     return newCons_;
00101   }
00102 
00103   template <class BaseType, class CoType>
00104   int ABA_SEPARATOR<BaseType, CoType>::nGen() const
00105   {
00106   return newCons_.number();
00107   }
00108 
00109   template <class BaseType, class CoType>
00110   int ABA_SEPARATOR<BaseType, CoType>::nDuplications() const
00111   {
00112   return nDuplications_;
00113   }
00114 
00115   template <class BaseType, class CoType>
00116   int ABA_SEPARATOR<BaseType, CoType>::nCollisions() const
00117   {
00118   if(!hash_)
00119     return 0;   
00120   return hash_->nCollisions();
00121   }
00122 
00123   template <class BaseType, class CoType>
00124   int ABA_SEPARATOR<BaseType, CoType>::maxGen() const
00125   {
00126   return newCons_.size();
00127   }
00128 
00129   virtual void separate()
00130 
00131   virtual bool terminateSeparation()
00132  
00133   template <class BaseType, class CoType>
00134   bool ABA_SEPARATOR<BaseType, CoType>::find(BaseType *cv) 
00135   {
00136    int key = cv->hashKey();
00137 
00138    BaseType **cand = hash_->initializeIteration(key);
00139 
00140    while(cand) {
00141       if (cv->equal(*cand)) return true;
00142       cand = hash_->next(key);
00143     }
00144     return false;
00145  }
00146 
00147   template <class BaseType, class CoType>
00148   double ABA_SEPARATOR<BaseType, CoType>::minAbsViolation() const
00149   {
00150     return minAbsViolation_;
00151   }
00152 
00153   void minAbsViolation(double minAbsVio)
00154  
00155   ABA_LPSOLUTION<CoType, BaseType> *lpSolution()        
00156 
00157 void watchNonDuplPool(ABA_NONDUPLPOOL<BaseType, CoType> *pool)
00158 
00159 #endif   // ABA_SEPERATOR_INC
00160 
00161 
00162 

Generated on Tue Aug 14 18:09:54 2007 for ABACUS by  doxygen 1.5.1