Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

standardpool.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include <ogdf/basic/SList.h>
33 #include <ogdf/lib/abacus/pool.h>
34 
35 namespace abacus {
36 
37 
38 template<class BaseType, class CoType>
39 class StandardPool;
40 
41 template<class BaseType, class CoType>
42 std::ostream& operator<< (std::ostream &out, const StandardPool<BaseType,CoType> &rhs);
43 
44 
46 
56 template<class BaseType, class CoType>
57 class StandardPool:public Pool<BaseType,CoType> {
58 public:
59 
61 
70  StandardPool(Master*master,int size,bool autoRealloc= false);
71 
73 
77  virtual ~StandardPool();
78 
80 
88  friend std::ostream& operator<< <> (std::ostream &out, const StandardPool &rhs);
89 
91 
101  virtual PoolSlot<BaseType,CoType> *insert(BaseType*cv);
102 
104 
109  virtual void increase(int size);
110 
112 
118  int cleanup();
119 
121  int size() const { return pool_.size(); }
122 
124 
127  PoolSlot<BaseType,CoType> *slot(int i) { return pool_[i]; }
128 
130 
157  virtual int separate(
158  double *x,
159  Active<CoType,BaseType> *active,
160  Sub*sub,
161  CutBuffer<BaseType,CoType> *cutBuffer,
162  double minAbsViolation = 0.001,
163  int ranking = 0);
164 
165 protected:
166 
168 
172  int removeNonActive(int maxRemove);
173 
175 
181  return (freeSlots_.empty()) ? nullptr : freeSlots_.popFrontRet();
182  }
183 
185 
191  if (slot->conVar()) {
192  Logger::ifout() << "StandardPool::putSlot(): you cannot put a non-void slot.\n";
194  }
195  freeSlots_.pushFront(slot);
196  }
197 
200 
205 
206 private:
207 
208  StandardPool(const StandardPool&rhs);
209  const StandardPool&operator= (const StandardPool&rhs);
210 };
211 
212 }
213 
abacus::Active< CoType, BaseType >
abacus::StandardPool::~StandardPool
virtual ~StandardPool()
The destructor.
abacus::StandardPool::pool_
Array< PoolSlot< BaseType, CoType > * > pool_
The array with the pool slots.
Definition: standardpool.h:198
abacus::StandardPool::separate
virtual int separate(double *x, Active< CoType, BaseType > *active, Sub *sub, CutBuffer< BaseType, CoType > *cutBuffer, double minAbsViolation=0.001, int ranking=0)
Checks if a pair of a vector and an active constraint/variable set violates any item in the pool.
abacus::StandardPool::cleanup
int cleanup()
Cleans-up the pool.
abacus::operator<<
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
abacus::CutBuffer
Cut buffers.
Definition: convar.h:45
abacus
Definition: ILPClusterPlanarity.h:50
abacus::StandardPool::increase
virtual void increase(int size)
Enlarges the pool to store up to size items.
abacus::StandardPool
Standard pools.
Definition: ILPClusterPlanarity.h:52
ogdf::AlgorithmFailureException
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition: exceptions.h:247
abacus::StandardPool::StandardPool
StandardPool(Master *master, int size, bool autoRealloc=false)
Creates an empty pool.
abacus::StandardPool::size
int size() const
Return the maximal number of constraints/variables that can be inserted in the pool.
Definition: standardpool.h:121
pool.h
SList.h
Declaration of singly linked lists and iterators.
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::StandardPool::getSlot
virtual PoolSlot< BaseType, CoType > * getSlot()
Returns a free slot, or 0 if no free slot is available.
Definition: standardpool.h:180
ogdf::SListPure
Singly linked lists.
Definition: SList.h:52
OGDF_THROW_PARAM
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition: exceptions.h:71
ogdf::AlgorithmFailureCode::Pool
@ Pool
abacus::StandardPool::removeNonActive
int removeNonActive(int maxRemove)
Tries to remove at most maxRemove inactive items from the pool.
abacus::StandardPool::operator=
const StandardPool & operator=(const StandardPool &rhs)
ogdf::Logger::ifout
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition: Logger.h:218
abacus::Sub
The subproblem.
Definition: sub.h:68
abacus::StandardPool::putSlot
virtual void putSlot(PoolSlot< BaseType, CoType > *slot)
Inserts the slot in the list of free slots.
Definition: standardpool.h:190
standardpool.inc
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:39
abacus::StandardPool::insert
virtual PoolSlot< BaseType, CoType > * insert(BaseType *cv)
Tries to insert a constraint/variable in the pool.
ogdf::AlgorithmFailureCode::StandardPool
@ StandardPool
abacus::StandardPool::autoRealloc_
bool autoRealloc_
If the pool becomes full and this member is true, then an automatic reallocation is performed.
Definition: standardpool.h:204
abacus::StandardPool::freeSlots_
ogdf::SListPure< PoolSlot< BaseType, CoType > * > freeSlots_
The linked lists of unused slots.
Definition: standardpool.h:199
abacus::StandardPool::slot
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th slot in the pool.
Definition: standardpool.h:127