Status of fixed and set variables. More...
#include <ogdf/lib/abacus/fsvarstat.h>
Public Types | |
enum | STATUS { Free, SetToLowerBound, Set, SetToUpperBound, FixedToLowerBound, Fixed, FixedToUpperBound } |
The enumeration defining the different statuses of variables from the point of view of fixing and setting. More... | |
Public Member Functions | |
FSVarStat (AbacusGlobal *glob) | |
Initializes the status to Free. More... | |
FSVarStat (AbacusGlobal *glob, STATUS status) | |
Initializes the status to status. More... | |
FSVarStat (AbacusGlobal *glob, STATUS status, double value) | |
Initializes the status explicitely to Fixed or Set. More... | |
FSVarStat (FSVarStat *fsVarStat) | |
Initializes the status as in fsVarStat. More... | |
bool | contradiction (FSVarStat *fsVarStat) const |
Returns whether there is a contradiction. More... | |
bool | contradiction (STATUS status, double value=0) const |
Returns whether there is a contradiction. More... | |
bool | fixed () const |
Returns true if the status is FixedToLowerBound, Fixed, orFixedToUpperBound; false otherwise. More... | |
bool | fixedOrSet () const |
Returns false if the status is Free, true otherwise. More... | |
bool | set () const |
Returns true if the status is SetToLowerBound, Set, or SetToUpperBound; false otherwise. More... | |
STATUS | status () const |
Returns the status of fixing or setting. More... | |
void | status (const FSVarStat *stat) |
Assigns the status as in stat. More... | |
void | status (STATUS stat) |
Assigns a new status. More... | |
void | status (STATUS stat, double val) |
Assigns a new status also for the statuses Fixed and Set. More... | |
double | value () const |
Returns the value of fixing or setting if the variable has status Fixed or Set. More... | |
void | value (double val) |
Assigns a new value of fixing or setting. More... | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. More... | |
Private Attributes | |
AbacusGlobal * | glob_ |
A pointer to the corresponding global object. More... | |
STATUS | status_ |
The status of the variable. More... | |
double | value_ |
The value the variable is fixed/set to. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const FSVarStat &rhs) |
Output operator. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from abacus::AbacusRoot | |
static bool | ascii2bool (const string &str) |
Converts the string str to a boolean value. More... | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. More... | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. More... | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". More... | |
Status of fixed and set variables.
If a variable is fixed to a value, then this means that it keeps this value "forever". If it is set, then the variable keeps the value in the subproblem where the setting is performed and in the subproblems of the subtree rooted at this subproblem.
Definition at line 46 of file fsvarstat.h.
The enumeration defining the different statuses of variables from the point of view of fixing and setting.
Enumerator | |
---|---|
Free | The variable is neither fixed nor set. |
SetToLowerBound | The variable is set to its lower bound. |
Set | The variable is set to a value which can be accessed with the member function value(). |
SetToUpperBound | The variable is set to its upper bound. |
FixedToLowerBound | The variable is fixed to its lower bound. |
Fixed | The variable is fixed to a value which can be accessed with the member function value(). |
FixedToUpperBound | The variable is fixed to its upper bound. |
Definition at line 50 of file fsvarstat.h.
|
inline |
Initializes the status to Free.
glob | A pointer to a global object. |
Definition at line 64 of file fsvarstat.h.
|
inline |
Initializes the status to status.
glob | A pointer to a global object. |
status | The initial status that must neither be Fixed nor Set. For these two statuses the next constructor has to be used. |
Definition at line 72 of file fsvarstat.h.
|
inline |
Initializes the status explicitely to Fixed or Set.
glob | A pointer to a global object. |
status | The initial status that must be Fixed or Set. |
value | The value associated with the status Fixed or Set. |
Definition at line 86 of file fsvarstat.h.
|
inline |
Initializes the status as in fsVarStat.
fsVarStat | The status is initialized with a copy of *fsVarStat. |
Definition at line 98 of file fsvarstat.h.
bool abacus::FSVarStat::contradiction | ( | FSVarStat * | fsVarStat | ) | const |
Returns whether there is a contradiction.
We say there is a contradiction between two status if they are fixed/set to different bounds or values. However, two statuses are not contradiction if one of them is "fixed" and the other one is "set", if this fixing/setting refers to the same bound or value.
fsVarStat | A pointer to the status with which contradiction is is tested. |
bool abacus::FSVarStat::contradiction | ( | STATUS | status, |
double | value = 0 |
||
) | const |
Returns whether there is a contradiction.
status | The status with which contradiction is checked. |
value | The value with which contradiction is checked. The default value of value is 0. |
bool abacus::FSVarStat::fixed | ( | ) | const |
Returns true if the status is FixedToLowerBound, Fixed, orFixedToUpperBound; false otherwise.
|
inline |
Returns false if the status is Free, true otherwise.
Definition at line 160 of file fsvarstat.h.
bool abacus::FSVarStat::set | ( | ) | const |
Returns true if the status is SetToLowerBound, Set, or SetToUpperBound; false otherwise.
|
inline |
Returns the status of fixing or setting.
Definition at line 114 of file fsvarstat.h.
|
inline |
Assigns the status as in stat.
stat | A pointer to the object that status and value is copied. |
Definition at line 139 of file fsvarstat.h.
|
inline |
Assigns a new status.
For specifying also a value in case of the statuses Fixed or Set the next version of this function can be use.
stat | The new status. |
Definition at line 123 of file fsvarstat.h.
|
inline |
Assigns a new status also for the statuses Fixed and Set.
stat | The new status. |
val | A value associated with the new status. |
Definition at line 130 of file fsvarstat.h.
|
inline |
Returns the value of fixing or setting if the variable has status Fixed or Set.
Definition at line 145 of file fsvarstat.h.
|
inline |
Assigns a new value of fixing or setting.
val | The new value. |
Definition at line 151 of file fsvarstat.h.
|
friend |
Output operator.
The output operator writes the status and, if the status is Fixed or Set, also its value on an output stream.
out | The output stream. |
rhs | The variable status being output. |
|
private |
A pointer to the corresponding global object.
Definition at line 191 of file fsvarstat.h.
|
private |
The status of the variable.
Definition at line 193 of file fsvarstat.h.
|
private |
The value the variable is fixed/set to.
This member is only used for the statuses Fixed and Set.
Definition at line 199 of file fsvarstat.h.