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
34#pragma GCC visibility push(default)
35namespace abacus {
36
37class AbacusGlobal;
38
39
41
48public:
49
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
190private:
191
193
195
197
200 double value_;
201
203};
204
205}
206#pragma GCC visibility pop
Global data and functions.
Definition global.h:58
Base class of all other classes of ABACUS.
Definition abacusroot.h:69
Status of fixed and set variables.
Definition fsvarstat.h:47
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
Definition fsvarstat.h:51
@ FixedToLowerBound
The variable is fixed to its lower bound.
Definition fsvarstat.h:56
@ Fixed
The variable is fixed to a value which can be accessed with the member function value().
Definition fsvarstat.h:57
@ Free
The variable is neither fixed nor set.
Definition fsvarstat.h:52
@ SetToLowerBound
The variable is set to its lower bound.
Definition fsvarstat.h:53
@ Set
The variable is set to a value which can be accessed with the member function value().
Definition fsvarstat.h:54
@ SetToUpperBound
The variable is set to its upper bound.
Definition fsvarstat.h:55
void status(STATUS stat, double val)
Assigns a new status also for the statuses Fixed and Set.
Definition fsvarstat.h:131
FSVarStat(AbacusGlobal *glob, STATUS status)
Initializes the status to status.
Definition fsvarstat.h:73
FSVarStat(FSVarStat *fsVarStat)
Initializes the status as in fsVarStat.
Definition fsvarstat.h:99
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:161
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:124
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:140
void value(double val)
Assigns a new value of fixing or setting.
Definition fsvarstat.h:152
double value_
The value the variable is fixed/set to.
Definition fsvarstat.h:200
AbacusGlobal * glob_
A pointer to the corresponding global object.
Definition fsvarstat.h:192
FSVarStat(AbacusGlobal *glob, STATUS status, double value)
Initializes the status explicitely to Fixed or Set.
Definition fsvarstat.h:87
FSVarStat(AbacusGlobal *glob)
Initializes the status to Free.
Definition fsvarstat.h:65
bool contradiction(FSVarStat *fsVarStat) const
Returns whether there is a contradiction.
STATUS status() const
Returns the status of fixing or setting.
Definition fsvarstat.h:115
double value() const
Returns the value of fixing or setting if the variable has status Fixed or Set.
Definition fsvarstat.h:146
STATUS status_
The status of the variable.
Definition fsvarstat.h:194
Exception thrown when an algorithm realizes an internal bug that prevents it from continuing.
Definition exceptions.h:247
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
Definition memory.h:85
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
Definition exceptions.h:58