Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

fsvarstat.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 
34 namespace abacus {
35 
36 class AbacusGlobal;
37 
38 
40 
47 public:
48 
50  enum STATUS {
51  Free,
53  Set,
57  FixedToUpperBound
58  };
59 
61 
64  FSVarStat(AbacusGlobal *glob) : glob_(glob), status_(Free) { }
65 
67 
72  FSVarStat(AbacusGlobal *glob, STATUS status) : glob_(glob), status_(status), value_(0.0)
73  {
74  if (status == Fixed || status == Set) {
75  Logger::ifout() << "FSVarStat::FSVarStat(): value to set/fix missing\n";
77  }
78  }
79 
81 
86  FSVarStat(AbacusGlobal *glob, STATUS status, double value) : glob_(glob), status_(status), value_(value)
87  {
88  if (status != Fixed && status != Set) {
89  Logger::ifout() << "FSVarStat::FSVarStat(): wrong status for this constructor\n";
91  }
92  }
93 
95 
98  FSVarStat(FSVarStat *fsVarStat) : glob_(fsVarStat->glob_), status_(fsVarStat->status_), value_(fsVarStat->value_) { }
99 
100 
102 
111  friend OGDF_EXPORT std::ostream &operator<<(std::ostream& out, const FSVarStat &rhs);
112 
114  STATUS status() const { return status_; }
115 
117 
123  void status(STATUS stat) { status_ = stat; }
124 
126 
130  void status(STATUS stat, double val) {
131  status_ = stat;
132  value_ = val;
133  }
134 
136 
139  void status(const FSVarStat *stat) {
140  status_ = stat->status_;
141  value_ = stat->value_;
142  }
143 
145  double value() const { return value_; }
146 
148 
151  void value(double val) { value_ = val; }
152 
154  bool fixed() const;
155 
157  bool set() const;
158 
160  bool fixedOrSet() const {
161  return (status_ != Free);
162  }
163 
165 
176  bool contradiction(FSVarStat *fsVarStat) const;
177 
179 
187  bool contradiction(STATUS status, double value = 0) const;
188 
189 private:
190 
192 
194 
196 
199  double value_;
200 
202 };
203 
204 }
abacus::FSVarStat::status_
STATUS status_
The status of the variable.
Definition: fsvarstat.h:193
abacus::FSVarStat::SetToUpperBound
@ SetToUpperBound
The variable is set to its upper bound.
Definition: fsvarstat.h:54
abacus::FSVarStat::status
void status(const FSVarStat *stat)
Assigns the status as in stat.
Definition: fsvarstat.h:139
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:114
abacus::FSVarStat
Status of fixed and set variables.
Definition: fsvarstat.h:46
abacus
Definition: abacusroot.h:48
abacus::FSVarStat::Free
@ Free
The variable is neither fixed nor set.
Definition: fsvarstat.h:51
OGDF_NEW_DELETE
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition: memory.h:84
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob, STATUS status, double value)
Initializes the status explicitely to Fixed or Set.
Definition: fsvarstat.h:86
abacus::FSVarStat::value
double value() const
Returns the value of fixing or setting if the variable has status Fixed or Set.
Definition: fsvarstat.h:145
abacus::FSVarStat::value_
double value_
The value the variable is fixed/set to.
Definition: fsvarstat.h:199
ogdf::AlgorithmFailureException
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition: exceptions.h:243
abacus::FSVarStat::Fixed
@ Fixed
The variable is fixed to a value which can be accessed with the member function value().
Definition: fsvarstat.h:56
abacus::FSVarStat::SetToLowerBound
@ SetToLowerBound
The variable is set to its lower bound.
Definition: fsvarstat.h:52
abacus::FSVarStat::status
void status(STATUS stat)
Assigns a new status.
Definition: fsvarstat.h:123
abacus::FSVarStat::STATUS
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
Definition: fsvarstat.h:50
abacus::FSVarStat::FixedToLowerBound
@ FixedToLowerBound
The variable is fixed to its lower bound.
Definition: fsvarstat.h:55
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob)
Initializes the status to Free.
Definition: fsvarstat.h:64
abacus::FSVarStat::glob_
AbacusGlobal * glob_
A pointer to the corresponding global object.
Definition: fsvarstat.h:191
abacus::AbacusRoot
Base class of all other classes of ABACUS.
Definition: abacusroot.h:68
abacus::FSVarStat::status
void status(STATUS stat, double val)
Assigns a new status also for the statuses Fixed and Set.
Definition: fsvarstat.h:130
abacus::FSVarStat::FSVarStat
FSVarStat(AbacusGlobal *glob, STATUS status)
Initializes the status to status.
Definition: fsvarstat.h:72
OGDF_THROW_PARAM
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition: exceptions.h:67
abacus::FSVarStat::FSVarStat
FSVarStat(FSVarStat *fsVarStat)
Initializes the status as in fsVarStat.
Definition: fsvarstat.h:98
abacus::FSVarStat::fixedOrSet
bool fixedOrSet() const
Returns false if the status is Free, true otherwise.
Definition: fsvarstat.h:160
ogdf::Logger::ifout
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
Definition: Logger.h:216
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::AlgorithmFailureCode::FsVarStat
@ FsVarStat
abacus::AbacusGlobal
Global data and functions.
Definition: global.h:57
abacus::FSVarStat::value
void value(double val)
Assigns a new value of fixing or setting.
Definition: fsvarstat.h:151
abacus::FSVarStat::Set
@ Set
The variable is set to a value which can be accessed with the member function value().
Definition: fsvarstat.h:53