41template<
class BaseType,
class CoType>
51 for (
int i = 0; i <
size; i++) {
53 freeSlots_.pushBack(pool_[i]);
58template<
class BaseType,
class CoType>
59StandardPool<BaseType, CoType>::~StandardPool()
63 for (
int i = 0; i < s; i++)
68template<
class BaseType,
class CoType>
69std::ostream &
operator<<(std::ostream &out,
const StandardPool<BaseType, CoType> &rhs)
71 const int s = rhs.size();
73 for (
int i = 0; i < s; i++) {
74 if (rhs.pool_[i]->conVar()) {
76 rhs.pool_[i]->conVar()->print(out);
85template<
class BaseType,
class CoType>
90 if (slot ==
nullptr) {
93 increase((
int) (
size()*1.1 + 1));
95 if (removeNonActive(
size()/10 + 1) == 0)
103 ++Pool<BaseType, CoType>::number_;
108template<
class BaseType,
class CoType>
109void StandardPool<BaseType, CoType>::increase(
int size)
114 Logger::ifout() <<
"StandardPool::increase(): the pool size cannot be decreased.\n";
122 freeSlots_.pushBack(pool_[i]);
127template<
class BaseType,
class CoType>
128int StandardPool<BaseType, CoType>::cleanup()
134 if(this->softDeleteConVar(pool_[i]) == 0)
139 if (i != Pool<BaseType, CoType>::number())
143 pool_[i] = pool_[Pool<BaseType, CoType>::number()];
144 pool_[Pool<BaseType, CoType>::number()] =
CMslot;
150 Logger::ilout(Logger::Level::Minor) <<
"StandardPool::cleanup(): " <<
nDeleted <<
" items removed." << std::endl;
155template<
class BaseType,
class CoType>
156int StandardPool<BaseType, CoType>::removeNonActive(
int maxRemove)
159 ArrayBuffer<int> elems(
size(),
false);
160 ArrayBuffer<int>
keys(
size(),
false);
162 const int s =
size();
164 for (
int i = 0; i < s; i++) {
166 if (
cv && !
cv->active() && !
cv->locked()) {
168 keys.push(
cv->nReferences());
182 this->hardDeleteConVar(pool_[c]);
186 Logger::ilout(Logger::Level::Minor) <<
nRemoved <<
" inactive items removed from pool." << std::endl;
192template<
class BaseType,
class CoType>
193int StandardPool<BaseType, CoType>::separate(
195 Active<CoType, BaseType> *active,
197 CutBuffer<BaseType, CoType> *cutBuffer,
198 double minAbsViolation,
202 int oldSep = cutBuffer->number();
204 Logger::ilout(Logger::Level::Minor) <<
"StandardPool::separate(): " <<
"size = " <<
size() <<
" n = " << Pool<BaseType, CoType>::number_;
207 const int s =
size();
209 for (
int i = 0; i < s; i++) {
212 if (
cv && !
cv->active() && (
cv->global() ||
cv->valid(sub)))
215 if (cutBuffer->insert(slot,
true))
219 if (cutBuffer->insert(slot,
true,
violation))
227 if (cutBuffer->insert(slot,
true,
cv->rank()))
233 Logger::ilout(Logger::Level::Minor) <<
" generated = " << cutBuffer->number() -
oldSep << std::endl;
234 return cutBuffer->number() -
oldSep;
StandardPool(Master *master, int size, bool autoRealloc=false)
Creates an empty pool.
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
the master of the optimization.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.