Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

separator.inc
Go to the documentation of this file.
1 
29 #pragma once
30 
34 
35 namespace abacus {
36 
37 
38 template <class BaseType, class CoType>
41 {
42  if(newCons_.full()) {
43  delete cv;
44  return Full;
45  }
46 
47  if(pool_&&pool_->present(cv)) {
48  delete cv;
49  nDuplications_++;
50  return Duplication;
51  }
52 
53  if(hash_&&find(cv)) {
54  delete cv;
55  nDuplications_++;
56  return Duplication;
57  }
58 
59 
60  newCons_.push(cv);
61  if(hash_)
62  hash_->insert(cv->hashKey(),cv);
63  return Added;
64 }
65 
66 
67 template <class BaseType, class CoType>
69 {
70  if(!hash_)
71  return 0;
72  return hash_->nCollisions();
73 }
74 
75 
76 template <class BaseType, class CoType>
77 bool Separator<BaseType, CoType>::find(BaseType *cv)
78 {
79  int key = cv->hashKey();
80 
81  BaseType **cand = hash_->initializeIteration(key);
82 
83  while(cand) {
84  if (cv->equal(*cand)) return true;
85  cand = hash_->next(key);
86  }
87  return false;
88 }
89 
90 }
abacus::Added
@ Added
Definition: separator.h:40
abacus::Separator::nCollisions
int nCollisions() const
Returns the number of collisions in the hash table.
constraint.h
constraint.
abacus
Definition: abacusroot.h:48
variable.h
variable.
abacus::Full
@ Full
Definition: separator.h:40
abacus::Separator::cutFound
Separator_CUTFOUND cutFound(BaseType *cv)
Passes a cut (constraint or variable) to the buffer.
separator.h
separator.
abacus::Separator_CUTFOUND
Separator_CUTFOUND
Definition: separator.h:40
abacus::Separator::find
bool find(BaseType *cv)
abacus::Duplication
@ Duplication
Definition: separator.h:40
Minisat::Internal::find
static bool find(V &ts, const T &t)
Definition: Alg.h:47