Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

tailoff.h
Go to the documentation of this file.
1 
30 #pragma once
31 
32 #include <ogdf/lib/abacus/ring.h>
33 #include <ogdf/lib/abacus/master.h>
34 
35 #pragma GCC visibility push(default)
36 namespace abacus {
37 
38 
40 
58 class TailOff : public AbacusRoot {
59  friend class Sub;
60 public:
61 
63 
66  TailOff(Master *master) : master_(master)
67  {
68  if (master->tailOffNLp() > 0)
69  lpHistory_ = new AbaRing<double>(master->tailOffNLp());
70  else
71  lpHistory_ = nullptr;
72  }
73 
75 
79  TailOff(Master *master, int NLp) : master_(master)
80  {
81  if (NLp > 0)
82  lpHistory_ = new AbaRing<double>(NLp);
83  else
84  lpHistory_ = nullptr;
85  }
86 
88  ~TailOff() { delete lpHistory_; }
89 
90 
92 
100  friend std::ostream &operator<<(std::ostream &out, const TailOff &rhs);
101 
103 
110  virtual bool tailOff() const;
111 
113 
125  int diff(int nLps, double &d) const;
126 
127 protected:
128 
130 
137  void update(double value) {
138  if (lpHistory_)
139  lpHistory_->insert(value);
140  }
141 
142 
144 
152  void reset() {
153  if (lpHistory_)
154  lpHistory_->clear();
155  }
156 
157 
160 
163 };
164 
165 }
166 #pragma GCC visibility pop
abacus::AbaRing< double >
abacus::TailOff::TailOff
TailOff(Master *master)
The constructor takes the length of the tailing off history from Master::tailOffNLp().
Definition: tailoff.h:66
abacus
Definition: ILPClusterPlanarity.h:50
abacus::AbaRing::insert
void insert(Type elem)
Inserts a new element into the ring.
abacus::TailOff::reset
void reset()
Clears the solution history.
Definition: tailoff.h:152
abacus::TailOff::tailOff
virtual bool tailOff() const
Checks whether there is a tailing-off effect.
abacus::AbacusRoot
Base class of all other classes of ABACUS.
Definition: abacusroot.h:69
abacus::AbaRing::clear
void clear()
Empties the ring.
abacus::Master::tailOffNLp
int tailOffNLp() const
Returns the number of linear programs considered in the tailing off analysis.
Definition: master.h:647
abacus::TailOff::update
void update(double value)
A new LP-solution value can be stored by calling the function update().
Definition: tailoff.h:137
abacus::TailOff::lpHistory_
AbaRing< double > * lpHistory_
The LP-values considered in the tailing off analysis.
Definition: tailoff.h:162
ring.h
ring.
abacus::TailOff::TailOff
TailOff(Master *master, int NLp)
An alternative constructor takes the length of the tailing off history from the parameter NLp.
Definition: tailoff.h:79
abacus::TailOff
Tailing off manager.
Definition: tailoff.h:58
master.h
the master of the optimization.
abacus::Sub
The subproblem.
Definition: sub.h:69
abacus::TailOff::master_
Master * master_
A pointer to the corresponding master of the optimization.
Definition: tailoff.h:159
abacus::TailOff::diff
int diff(int nLps, double &d) const
Can be used to retrieve the difference between the last and a previous LP-solution in percent.
abacus::TailOff::~TailOff
~TailOff()
The destructor.
Definition: tailoff.h:88
abacus::TailOff::operator<<
friend std::ostream & operator<<(std::ostream &out, const TailOff &rhs)
The output operator.
abacus::Master
The master of the optimization.
Definition: master.h:70