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 #pragma GCC visibility push(default)
35 namespace abacus {
36 
37 template<class BaseType, class CoType> class PoolSlot;
38 template<class BaseType, class CoType> class PoolSlotRef;
39 
40 
42 
52 template<class BaseType, class CoType>
53 class CutBuffer : public AbacusRoot {
54 
55  friend class Sub;
56 
57 public:
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 
81  ~CutBuffer();
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 
131  void remove(ArrayBuffer<int> &index);
132 
135  return psRef_[i]->slot();
136  }
137 
138 private:
139 
141 
149  void extract(int max, ArrayBuffer<PoolSlot<BaseType, CoType>*> &newSlots);
150 
152 
156  void sort(int threshold);
157 
158 
160  int n_;
161 
164 
171 
174 
176 
179  bool ranking_;
180 
182 
185 };
186 
187 }
188 
190 #pragma GCC visibility pop
ogdf::ArrayBuffer
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition: Array.h:53
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:159
abacus::CutBuffer::number
int number() const
Returns the number of buffered items.
Definition: cutbuffer.h:87
abacus::CutBuffer
Cut buffers.
Definition: convar.h:46
abacus
Definition: ILPClusterPlanarity.h:50
abacus::CutBuffer::slot
PoolSlot< BaseType, CoType > * slot(int i)
Returns a pointer to the i-th PoolSlot that is buffered.
Definition: cutbuffer.h:134
abacus::CutBuffer::rank_
Array< double > rank_
This array stores optionally the rank of the buffered items.
Definition: cutbuffer.h:173
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::CutBuffer::psRef_
Array< PoolSlotRef< BaseType, CoType > * > psRef_
References to the pool slots of the buffered constraints/variables.
Definition: cutbuffer.h:163
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:160
abacus::CutBuffer::sort
void sort(int threshold)
Sorts the items according to their ranks.
abacus::Sub
The subproblem.
Definition: sub.h:69
abacus::PoolSlot
Stores constraints and variables.
Definition: active.h:40
abacus::CutBuffer::CutBuffer
CutBuffer(Master *master, int size)
Creates a cut buffer with capacity size.
Definition: cutbuffer.h:64
abacus::CutBuffer::ranking_
bool ranking_
This flag is true if a rank for each buffered item is available.
Definition: cutbuffer.h:179
abacus::CutBuffer::size
int size() const
Returns the maximal number of items that can be buffered.
Definition: cutbuffer.h:84
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:170
abacus::CutBuffer::space
int space() const
Returns the number of items which can still be inserted into the buffer.
Definition: cutbuffer.h:90
abacus::Master
The master of the optimization.
Definition: master.h:70