Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
fsvarstat.h
Go to the documentation of this file.
1
30#pragma once
31
33
34namespace abacus {
35
36class AbacusGlobal;
37
38
40
47public:
48
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
189private:
190
192
194
196
199 double value_;
200
202};
203
204}
Global data and functions.
Definition global.h:57
Base class of all other classes of ABACUS.
Definition abacusroot.h:68
Status of fixed and set variables.
Definition fsvarstat.h:46
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
Definition fsvarstat.h:50
@ FixedToLowerBound
The variable is fixed to its lower bound.
Definition fsvarstat.h:55
@ Fixed
The variable is fixed to a value which can be accessed with the member function value().
Definition fsvarstat.h:56
@ Free
The variable is neither fixed nor set.
Definition fsvarstat.h:51
@ SetToLowerBound
The variable is set to its lower bound.
Definition fsvarstat.h:52
@ Set
The variable is set to a value which can be accessed with the member function value().
Definition fsvarstat.h:53
@ SetToUpperBound
The variable is set to its upper bound.
Definition fsvarstat.h:54
void status(STATUS stat, double val)
Assigns a new status also for the statuses Fixed and Set.
Definition fsvarstat.h:130
FSVarStat(AbacusGlobal *glob, STATUS status)
Initializes the status to status.
Definition fsvarstat.h:72
FSVarStat(FSVarStat *fsVarStat)
Initializes the status as in fsVarStat.
Definition fsvarstat.h:98
bool contradiction(STATUS status, double value=0) const
Returns whether there is a contradiction.
bool fixedOrSet() const
Returns false if the status is Free, true otherwise.
Definition fsvarstat.h:160
bool set() const
Returns true if the status is SetToLowerBound, Set, or SetToUpperBound; false otherwise.
void status(STATUS stat)
Assigns a new status.
Definition fsvarstat.h:123
friend std::ostream & operator<<(std::ostream &out, const FSVarStat &rhs)
Output operator.
bool fixed() const
Returns true if the status is FixedToLowerBound, Fixed, orFixedToUpperBound; false otherwise.
void status(const FSVarStat *stat)
Assigns the status as in stat.
Definition fsvarstat.h:139
void value(double val)
Assigns a new value of fixing or setting.
Definition fsvarstat.h:151
double value_
The value the variable is fixed/set to.
Definition fsvarstat.h:199
AbacusGlobal * glob_
A pointer to the corresponding global object.
Definition fsvarstat.h:191
FSVarStat(AbacusGlobal *glob, STATUS status, double value)
Initializes the status explicitely to Fixed or Set.
Definition fsvarstat.h:86
FSVarStat(AbacusGlobal *glob)
Initializes the status to Free.
Definition fsvarstat.h:64
bool contradiction(FSVarStat *fsVarStat) const
Returns whether there is a contradiction.
STATUS status() const
Returns the status of fixing or setting.
Definition fsvarstat.h:114
double value() const
Returns the value of fixing or setting if the variable has status Fixed or Set.
Definition fsvarstat.h:145
STATUS status_
The status of the variable.
Definition fsvarstat.h:193
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:241
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition memory.h:84
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:54
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()