Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
cutbuffer.h
Go to the documentation of this file.
1
30#pragma once
31
33
34namespace abacus {
35
36template<class BaseType, class CoType> class PoolSlot;
37template<class BaseType, class CoType> class PoolSlotRef;
38
39
41
51template<class BaseType, class CoType>
52class CutBuffer : public AbacusRoot {
53
54 friend class Sub;
55
56public:
57
59
63 CutBuffer(Master *master, int size) :
64 master_(master),
65 n_(0),
66 psRef_(size),
68 rank_(size),
70 { }
71
73
81
83 int size() const { return psRef_.size(); }
84
86 int number() const { return n_; }
87
89 int space() const { return size() - n_; }
90
92
108
110
125
127
131
134 return psRef_[i]->slot();
135 }
136
137private:
138
140
149
151
155 void sort(int threshold);
156
157
159 int n_;
160
163
170
173
175
179
181
184};
185
186}
187
Base class of all other classes of ABACUS.
Definition abacusroot.h:68
Cut buffers.
Definition cutbuffer.h:52
int insert(PoolSlot< BaseType, CoType > *slot, bool keepInPool, double rank)
Adds a slot with rank to the buffer.
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th PoolSlot that is buffered.
Definition cutbuffer.h:133
int space() const
Returns the number of items which can still be inserted into the buffer.
Definition cutbuffer.h:89
int size() const
Returns the maximal number of items that can be buffered.
Definition cutbuffer.h:83
~CutBuffer()
The destructor.
bool ranking_
This flag is true if a rank for each buffered item is available.
Definition cutbuffer.h:178
CutBuffer(Master *master, int size)
Creates a cut buffer with capacity size.
Definition cutbuffer.h:63
Array< PoolSlotRef< BaseType, CoType > * > psRef_
References to the pool slots of the buffered constraints/variables.
Definition cutbuffer.h:162
int number() const
Returns the number of buffered items.
Definition cutbuffer.h:86
Array< double > rank_
This array stores optionally the rank of the buffered items.
Definition cutbuffer.h:172
CutBuffer(const CutBuffer< BaseType, CoType > &rhs)
int n_
The number of buffered items.
Definition cutbuffer.h:159
void remove(ArrayBuffer< int > &index)
Removes the elements specified by index from the buffer.
int insert(PoolSlot< BaseType, CoType > *slot, bool keepInPool)
Adds a slot to the buffer.
void sort(int threshold)
Sorts the items according to their ranks.
Master * master_
A pointer to the corresponding master of the optimization.
Definition cutbuffer.h:158
const CutBuffer< BaseType, CoType > & operator=(const CutBuffer< BaseType, CoType > &rhs)
Array< bool > keepInPool_
If keepInPool_[i] is true for a buffered constraint/variables, then it is not removed from its pool a...
Definition cutbuffer.h:169
void extract(int max, ArrayBuffer< PoolSlot< BaseType, CoType > * > &newSlots)
Takes the first max items from the buffer and clears the buffer.
The master of the optimization.
Definition master.h:69
Stores constraints and variables.
Definition poolslot.h:77
The subproblem.
Definition sub.h:68
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:56
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:214
the master of the optimization.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()