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
35namespace abacus {
36
37
38template<class BaseType, class CoType>
39class StandardPool;
40
41template<class BaseType, class CoType>
42std::ostream& operator<< (std::ostream &out, const StandardPool<BaseType,CoType> &rhs);
43
44
46
56template<class BaseType, class CoType>
57class StandardPool:public Pool<BaseType,CoType> {
58public:
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
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,
160 Sub*sub,
162 double minAbsViolation = 0.001,
163 int ranking = 0);
164
165protected:
166
168
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
206private:
207
210};
211
212}
213
Declaration of singly linked lists and iterators.
Implements the sets of active constraints and variables which are associated with each subproblem.
Definition active.h:62
Cut buffers.
Definition cutbuffer.h:52
The master of the optimization.
Definition master.h:69
Base class for constraint/variabe pools.
Definition pool.h:62
Stores constraints and variables.
Definition poolslot.h:77
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:68
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:241
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition Logger.h:192
Singly linked lists.
Definition SList.h:179
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:54
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)