Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

fsvarstat.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 
34 #pragma GCC visibility push(default)
35 namespace abacus {
36 
37 class AbacusGlobal;
38 
39 
41 
48 public:
49 
51  enum STATUS {
52  Free,
54  Set,
58  FixedToUpperBound
59  };
60 
62 
65  FSVarStat(AbacusGlobal *glob) : glob_(glob), status_(Free) { }
66 
68 
73  FSVarStat(AbacusGlobal *glob, STATUS status) : glob_(glob), status_(status), value_(0.0)
74  {
75  if (status == Fixed || status == Set) {
76  Logger::ifout() << "FSVarStat::FSVarStat(): value to set/fix missing\n";
78  }
79  }
80 
82 
87  FSVarStat(AbacusGlobal *glob, STATUS status, double value) : glob_(glob), status_(status), value_(value)
88  {
89  if (status != Fixed && status != Set) {
90  Logger::ifout() << "FSVarStat::FSVarStat(): wrong status for this constructor\n";
92  }
93  }
94 
96 
99  FSVarStat(FSVarStat *fsVarStat) : glob_(fsVarStat->glob_), status_(fsVarStat->status_), value_(fsVarStat->value_) { }
100 
101 
103 
112  friend OGDF_EXPORT std::ostream &operator<<(std::ostream& out, const FSVarStat &rhs);
113 
115  STATUS status() const { return status_; }
116 
118 
124  void status(STATUS stat) { status_ = stat; }
125 
127 
131  void status(STATUS stat, double val) {
132  status_ = stat;
133  value_ = val;
134  }
135 
137 
140  void status(const FSVarStat *stat) {
141  status_ = stat->status_;
142  value_ = stat->value_;
143  }
144 
146  double value() const { return value_; }
147 
149 
152  void value(double val) { value_ = val; }
153 
155  bool fixed() const;
156 
158  bool set() const;
159 
161  bool fixedOrSet() const {
162  return (status_ != Free);
163  }
164 
166 
177  bool contradiction(FSVarStat *fsVarStat) const;
178 
180 
188  bool contradiction(STATUS status, double value = 0) const;
189 
190 private:
191 
193 
195 
197 
200  double value_;
201 
203 };
204 
205 }
206 #pragma GCC visibility pop
abacus::FSVarStat::status_
STATUS status_
The status of the variable.
Definition: fsvarstat.h:194
abacus::FSVarStat::SetToUpperBound
@ SetToUpperBound
The variable is set to its upper bound.
Definition: fsvarstat.h:55
abacus::FSVarStat::status
void status(const FSVarStat *stat)
Assigns the status as in stat.
Definition: fsvarstat.h:140
abacus::operator<<
std::ostream & operator<<(std::ostream &out, const Active< BaseType, CoType > &rhs)
abacusroot.h
abacus::FSVarStat::status
STATUS status() const
Returns the status of fixing or setting.
Definition: fsvarstat.h:115
abacus::FSVarStat
Status of fixed and set variables.
Definition: fsvarstat.h:47
abacus
Definition: ILPClusterPlanarity.h:50
abacus::FSVarStat::Free
@ Free
The variable is neither fixed nor set.
Definition: fsvarstat.h:52
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:85
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob, STATUS status, double value)
Initializes the status explicitely to Fixed or Set.
Definition: fsvarstat.h:87
abacus::FSVarStat::value
double value() const
Returns the value of fixing or setting if the variable has status Fixed or Set.
Definition: fsvarstat.h:146
abacus::FSVarStat::value_
double value_
The value the variable is fixed/set to.
Definition: fsvarstat.h:200
ogdf::AlgorithmFailureException
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition: exceptions.h:247
abacus::FSVarStat::Fixed
@ Fixed
The variable is fixed to a value which can be accessed with the member function value().
Definition: fsvarstat.h:57
abacus::FSVarStat::SetToLowerBound
@ SetToLowerBound
The variable is set to its lower bound.
Definition: fsvarstat.h:53
abacus::FSVarStat::status
void status(STATUS stat)
Assigns a new status.
Definition: fsvarstat.h:124
abacus::FSVarStat::STATUS
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
Definition: fsvarstat.h:51
abacus::FSVarStat::FixedToLowerBound
@ FixedToLowerBound
The variable is fixed to its lower bound.
Definition: fsvarstat.h:56
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob)
Initializes the status to Free.
Definition: fsvarstat.h:65
abacus::FSVarStat::glob_
AbacusGlobal * glob_
A pointer to the corresponding global object.
Definition: fsvarstat.h:192
abacus::AbacusRoot
Base class of all other classes of ABACUS.
Definition: abacusroot.h:69
abacus::FSVarStat::status
void status(STATUS stat, double val)
Assigns a new status also for the statuses Fixed and Set.
Definition: fsvarstat.h:131
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob, STATUS status)
Initializes the status to status.
Definition: fsvarstat.h:73
OGDF_THROW_PARAM
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition: exceptions.h:71
abacus::FSVarStat::FSVarStat
FSVarStat(FSVarStat *fsVarStat)
Initializes the status as in fsVarStat.
Definition: fsvarstat.h:99
abacus::FSVarStat::fixedOrSet
bool fixedOrSet() const
Returns false if the status is Free, true otherwise.
Definition: fsvarstat.h:161
ogdf::Logger::ifout
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition: Logger.h:218
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition: config.h:117
ogdf::AlgorithmFailureCode::FsVarStat
@ FsVarStat
abacus::AbacusGlobal
Global data and functions.
Definition: global.h:58
abacus::FSVarStat::value
void value(double val)
Assigns a new value of fixing or setting.
Definition: fsvarstat.h:152
abacus::FSVarStat::Set
@ Set
The variable is set to a value which can be accessed with the member function value().
Definition: fsvarstat.h:54