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
34#pragma GCC visibility push(default)
35namespace abacus {
36
37template<class BaseType, class CoType> class PoolSlot;
38template<class BaseType, class CoType> class PoolSlotRef;
39
40
42
52template<class BaseType, class CoType>
53class CutBuffer : public AbacusRoot {
54
55 friend class Sub;
56
57public:
58
60
64 CutBuffer(Master *master, int size) :
65 master_(master),
66 n_(0),
67 psRef_(size),
69 rank_(size),
70 ranking_(true)
71 { }
72
74
82
84 int size() const { return psRef_.size(); }
85
87 int number() const { return n_; }
88
90 int space() const { return size() - n_; }
91
93
108 int insert(PoolSlot<BaseType, CoType> *slot, bool keepInPool);
109
111
125 int insert(PoolSlot<BaseType, CoType> *slot, bool keepInPool, double rank);
126
128
132
135 return psRef_[i]->slot();
136 }
137
138private:
139
141
150
152
156 void sort(int threshold);
157
158
160 int n_;
161
164
171
174
176
180
182
185};
186
187}
188
190#pragma GCC visibility pop
Base class of all other classes of ABACUS.
Definition abacusroot.h:69
Cut buffers.
Definition cutbuffer.h:53
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:134
int space() const
Returns the number of items which can still be inserted into the buffer.
Definition cutbuffer.h:90
int size() const
Returns the maximal number of items that can be buffered.
Definition cutbuffer.h:84
~CutBuffer()
The destructor.
bool ranking_
This flag is true if a rank for each buffered item is available.
Definition cutbuffer.h:179
CutBuffer(Master *master, int size)
Creates a cut buffer with capacity size.
Definition cutbuffer.h:64
Array< PoolSlotRef< BaseType, CoType > * > psRef_
References to the pool slots of the buffered constraints/variables.
Definition cutbuffer.h:163
int number() const
Returns the number of buffered items.
Definition cutbuffer.h:87
Array< double > rank_
This array stores optionally the rank of the buffered items.
Definition cutbuffer.h:173
CutBuffer(const CutBuffer< BaseType, CoType > &rhs)
int n_
The number of buffered items.
Definition cutbuffer.h:160
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:159
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:170
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:70
Stores constraints and variables.
Definition poolslot.h:78
The subproblem.
Definition sub.h:69
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:64
The parameterized class Array implements dynamic arrays of type E.
Definition Array.h:219
the master of the optimization.