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 #pragma GCC visibility push(default)
36 namespace abacus {
37 
38 
39 template<class BaseType, class CoType>
40 class StandardPool;
41 
42 template<class BaseType, class CoType>
43 std::ostream& operator<< (std::ostream &out, const StandardPool<BaseType,CoType> &rhs);
44 
45 
47 
57 template<class BaseType, class CoType>
58 class StandardPool:public Pool<BaseType,CoType> {
59 public:
60 
62 
71  StandardPool(Master*master,int size,bool autoRealloc= false);
72 
74 
78  virtual ~StandardPool();
79 
81 
89  friend std::ostream& operator<< <> (std::ostream &out, const StandardPool &rhs);
90 
92 
102  virtual PoolSlot<BaseType,CoType> *insert(BaseType*cv);
103 
105 
110  virtual void increase(int size);
111 
113 
119  int cleanup();
120 
122  int size() const { return pool_.size(); }
123 
125 
128  PoolSlot<BaseType,CoType> *slot(int i) { return pool_[i]; }
129 
131 
158  virtual int separate(
159  double *x,
160  Active<CoType,BaseType> *active,
161  Sub*sub,
162  CutBuffer<BaseType,CoType> *cutBuffer,
163  double minAbsViolation = 0.001,
164  int ranking = 0);
165 
166 protected:
167 
169 
173  int removeNonActive(int maxRemove);
174 
176 
182  return (freeSlots_.empty()) ? nullptr : freeSlots_.popFrontRet();
183  }
184 
186 
192  if (slot->conVar()) {
193  Logger::ifout() << "StandardPool::putSlot(): you cannot put a non-void slot.\n";
195  }
196  freeSlots_.pushFront(slot);
197  }
198 
201 
206 
207 private:
208 
209  StandardPool(const StandardPool&rhs);
210  const StandardPool&operator= (const StandardPool&rhs);
211 };
212 
213 }
214 
216 #pragma GCC visibility pop
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:199
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:46
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:122
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:181
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:69
abacus::StandardPool::putSlot
virtual void putSlot(PoolSlot< BaseType, CoType > *slot)
Inserts the slot in the list of free slots.
Definition: standardpool.h:191
standardpool.inc
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:40
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:205
abacus::StandardPool::freeSlots_
ogdf::SListPure< PoolSlot< BaseType, CoType > * > freeSlots_
The linked lists of unused slots.
Definition: standardpool.h:200
abacus::StandardPool::slot
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th slot in the pool.
Definition: standardpool.h:128