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 namespace abacus {
36 
37 
39 
57 class TailOff : public AbacusRoot {
58  friend class Sub;
59 public:
60 
62 
65  TailOff(Master *master) : master_(master)
66  {
67  if (master->tailOffNLp() > 0)
68  lpHistory_ = new AbaRing<double>(master->tailOffNLp());
69  else
70  lpHistory_ = nullptr;
71  }
72 
74 
78  TailOff(Master *master, int NLp) : master_(master)
79  {
80  if (NLp > 0)
81  lpHistory_ = new AbaRing<double>(NLp);
82  else
83  lpHistory_ = nullptr;
84  }
85 
87  ~TailOff() { delete lpHistory_; }
88 
89 
91 
99  friend std::ostream &operator<<(std::ostream &out, const TailOff &rhs);
100 
102 
109  virtual bool tailOff() const;
110 
112 
124  int diff(int nLps, double &d) const;
125 
126 protected:
127 
129 
136  void update(double value) {
137  if (lpHistory_)
138  lpHistory_->insert(value);
139  }
140 
141 
143 
151  void reset() {
152  if (lpHistory_)
153  lpHistory_->clear();
154  }
155 
156 
159 
162 };
163 
164 }
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:65
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:151
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:68
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:646
abacus::TailOff::update
void update(double value)
A new LP-solution value can be stored by calling the function update().
Definition: tailoff.h:136
abacus::TailOff::lpHistory_
AbaRing< double > * lpHistory_
The LP-values considered in the tailing off analysis.
Definition: tailoff.h:161
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:78
abacus::TailOff
Tailing off manager.
Definition: tailoff.h:57
master.h
the master of the optimization.
abacus::Sub
The subproblem.
Definition: sub.h:68
abacus::TailOff::master_
Master * master_
A pointer to the corresponding master of the optimization.
Definition: tailoff.h:158
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:87
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:69