Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
standardpool.h
Go to the documentation of this file.
1
30#pragma once
31
32#include <ogdf/basic/SList.h>
34
35#pragma GCC visibility push(default)
36namespace abacus {
37
38
39template<class BaseType, class CoType>
40class StandardPool;
41
42template<class BaseType, class CoType>
43std::ostream& operator<< (std::ostream &out, const StandardPool<BaseType,CoType> &rhs);
44
45
47
57template<class BaseType, class CoType>
58class StandardPool:public Pool<BaseType,CoType> {
59public:
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,
161 Sub*sub,
163 double minAbsViolation = 0.001,
164 int ranking = 0);
165
166protected:
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
207private:
208
211};
212
213}
214
216#pragma GCC visibility pop
Declaration of singly linked lists and iterators.
Implements the sets of active constraints and variables which are associated with each subproblem.
Definition active.h:63
Cut buffers.
Definition cutbuffer.h:53
The master of the optimization.
Definition master.h:70
Base class for constraint/variabe pools.
Definition pool.h:63
Stores constraints and variables.
Definition poolslot.h:78
Standard pools.
Array< PoolSlot< BaseType, CoType > * > pool_
The array with the pool slots.
virtual void putSlot(PoolSlot< BaseType, CoType > *slot)
Inserts the slot in the list of free slots.
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.
const StandardPool & operator=(const StandardPool &rhs)
int size() const
Return the maximal number of constraints/variables that can be inserted in the pool.
bool autoRealloc_
If the pool becomes full and this member is true, then an automatic reallocation is performed.
StandardPool(const StandardPool &rhs)
virtual void increase(int size)
Enlarges the pool to store up to size items.
virtual ~StandardPool()
The destructor.
virtual PoolSlot< BaseType, CoType > * insert(BaseType *cv)
Tries to insert a constraint/variable in the pool.
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th slot in the pool.
ogdf::SListPure< PoolSlot< BaseType, CoType > * > freeSlots_
The linked lists of unused slots.
virtual PoolSlot< BaseType, CoType > * getSlot()
Returns a free slot, or 0 if no free slot is available.
StandardPool(Master *master, int size, bool autoRealloc=false)
Creates an empty pool.
int removeNonActive(int maxRemove)
Tries to remove at most maxRemove inactive items from the pool.
int cleanup()
Cleans-up the pool.
The subproblem.
Definition sub.h:69
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:247
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition Logger.h:218
Singly linked lists.
Definition SList.h:191
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:58
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)