Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

nonduplpool.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include <ogdf/lib/abacus/hash.h>
35 #include <ogdf/lib/abacus/master.h>
39 #include <ogdf/lib/abacus/sub.h>
40 #include <ogdf/lib/abacus/bheap.h>
41 
42 #pragma GCC visibility push(default)
43 namespace abacus {
44 
46 
58 template<class BaseType, class CoType>
59 class NonDuplPool : public StandardPool<BaseType, CoType> {
60 public:
61 
63 
70  NonDuplPool(Master *master, int size, bool autoRealloc = false)
71  : StandardPool<BaseType, CoType>(master, size, autoRealloc), hash_(size), nDuplications_(0)
72  { }
73 
75  virtual ~NonDuplPool() {
76 #ifdef OGDF_DEBUG
77  Logger::ifout() << "Number of duplicated constraints: " <<
78  nDuplications_ << std::endl;
79 #endif
80  }
81 
83 
94  virtual PoolSlot<BaseType, CoType> *insert(BaseType *cv);
95 
97 
105  virtual PoolSlot<BaseType, CoType> *present(BaseType *cv);
106 
108 
116  virtual const PoolSlot<BaseType, CoType> *present(const BaseType *cv) const;
117 
119 
126  virtual void increase(int size) {
128  hash_.resize(size);
129  }
130 
132 
145  void statistics(int &nDuplications, int &nCollisions) const {
146  nDuplications = nDuplications_;
147  nCollisions = hash_.nCollisions();
148 }
149 
150 private:
151 
162 
170 
173 
177 
178 
179  NonDuplPool(const NonDuplPool &rhs);
180  const NonDuplPool &operator=(const NonDuplPool &rhs);
181 };
182 
183 }
184 
186 #pragma GCC visibility pop
sub.h
abacus::NonDuplPool
Standard pools without constraint duplication.
Definition: nonduplpool.h:59
cutbuffer.h
cutbuffer.
abacus::NonDuplPool::present
virtual PoolSlot< BaseType, CoType > * present(BaseType *cv)
Checks if constraint/variables cv is already contained in the pool.
constraint.h
constraint.
abacus
Definition: ILPClusterPlanarity.h:50
abacus::NonDuplPool::operator=
const NonDuplPool & operator=(const NonDuplPool &rhs)
abacus::StandardPool::increase
virtual void increase(int size)
Enlarges the pool to store up to size items.
abacus::NonDuplPool::increase
virtual void increase(int size)
Enlarges the pool to store up to size items.
Definition: nonduplpool.h:126
abacus::StandardPool
Standard pools.
Definition: ILPClusterPlanarity.h:52
bheap.h
abacus::NonDuplPool::statistics
void statistics(int &nDuplications, int &nCollisions) const
Returns some statistic information in nDuplicates and nCollisions.
Definition: nonduplpool.h:145
nonduplpool.inc
abacus::StandardPool::size
int size() const
Return the maximal number of constraints/variables that can be inserted in the pool.
Definition: standardpool.h:122
abacus::NonDuplPool::NonDuplPool
NonDuplPool(Master *master, int size, bool autoRealloc=false)
Creates an empty pool.
Definition: nonduplpool.h:70
abacus::AbaHash
Hash tables.
Definition: hash.h:39
abacus::NonDuplPool::~NonDuplPool
virtual ~NonDuplPool()
The destructor.
Definition: nonduplpool.h:75
abacus::NonDuplPool::hardDeleteConVar
virtual void hardDeleteConVar(PoolSlot< BaseType, CoType > *slot)
Has to be redefined because the pool slot has to be removed from the hash table.
variable.h
variable.
abacus::NonDuplPool::insert
virtual PoolSlot< BaseType, CoType > * insert(BaseType *cv)
Insert constraint/variable cv in the pool.
standardpool.h
standard pool.
ogdf::Logger::ifout
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition: Logger.h:218
master.h
the master of the optimization.
poolslot.h
poolslot.
abacus::NonDuplPool::hash_
AbaHash< unsigned, PoolSlot< BaseType, CoType > * > hash_
A hash table for a fast access to the pool slot storing a constraint/variable.
Definition: nonduplpool.h:172
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:40
hash.h
hash table.
abacus::NonDuplPool::softDeleteConVar
virtual int softDeleteConVar(PoolSlot< BaseType, CoType > *slot)
Has to be redefined because the slot has to be removed from the hash table if the constraint/variable...
abacus::Master
The master of the optimization.
Definition: master.h:70
abacus::NonDuplPool::nDuplications_
int nDuplications_
The number of insertions of constraints/variables that were rejected since the constraint/variable is...
Definition: nonduplpool.h:176
abacus::StandardPool::slot
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th slot in the pool.
Definition: standardpool.h:128