Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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