Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

abacus::FSVarStat Class Reference

Status of fixed and set variables. More...

#include <ogdf/lib/abacus/fsvarstat.h>

+ Inheritance diagram for abacus::FSVarStat:

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

AbacusGlobalglob_
 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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ STATUS

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.

Constructor & Destructor Documentation

◆ FSVarStat() [1/4]

abacus::FSVarStat::FSVarStat ( AbacusGlobal glob)
inline

Initializes the status to Free.

Parameters
globA pointer to a global object.

Definition at line 64 of file fsvarstat.h.

◆ FSVarStat() [2/4]

abacus::FSVarStat::FSVarStat ( AbacusGlobal glob,
STATUS  status 
)
inline

Initializes the status to status.

Parameters
globA pointer to a global object.
statusThe 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.

◆ FSVarStat() [3/4]

abacus::FSVarStat::FSVarStat ( AbacusGlobal glob,
STATUS  status,
double  value 
)
inline

Initializes the status explicitely to Fixed or Set.

Parameters
globA pointer to a global object.
statusThe initial status that must be Fixed or Set.
valueThe value associated with the status Fixed or Set.

Definition at line 86 of file fsvarstat.h.

◆ FSVarStat() [4/4]

abacus::FSVarStat::FSVarStat ( FSVarStat fsVarStat)
inline

Initializes the status as in fsVarStat.

Parameters
fsVarStatThe status is initialized with a copy of *fsVarStat.

Definition at line 98 of file fsvarstat.h.

Member Function Documentation

◆ contradiction() [1/2]

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.

Parameters
fsVarStatA pointer to the status with which contradiction is is tested.
Returns
true If there is a contradiction between the status of this object and fsVarStat, false otherwise.

◆ contradiction() [2/2]

bool abacus::FSVarStat::contradiction ( STATUS  status,
double  value = 0 
) const

Returns whether there is a contradiction.

Parameters
statusThe status with which contradiction is checked.
valueThe value with which contradiction is checked. The default value of value is 0.
Returns
true If there is a contradiction between the status of this object and (status, value), false otherwise.

◆ fixed()

bool abacus::FSVarStat::fixed ( ) const

Returns true if the status is FixedToLowerBound, Fixed, orFixedToUpperBound; false otherwise.

◆ fixedOrSet()

bool abacus::FSVarStat::fixedOrSet ( ) const
inline

Returns false if the status is Free, true otherwise.

Definition at line 160 of file fsvarstat.h.

◆ set()

bool abacus::FSVarStat::set ( ) const

Returns true if the status is SetToLowerBound, Set, or SetToUpperBound; false otherwise.

◆ status() [1/4]

STATUS abacus::FSVarStat::status ( ) const
inline

Returns the status of fixing or setting.

Definition at line 114 of file fsvarstat.h.

◆ status() [2/4]

void abacus::FSVarStat::status ( const FSVarStat stat)
inline

Assigns the status as in stat.

Parameters
statA pointer to the object that status and value is copied.

Definition at line 139 of file fsvarstat.h.

◆ status() [3/4]

void abacus::FSVarStat::status ( STATUS  stat)
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.

Parameters
statThe new status.

Definition at line 123 of file fsvarstat.h.

◆ status() [4/4]

void abacus::FSVarStat::status ( STATUS  stat,
double  val 
)
inline

Assigns a new status also for the statuses Fixed and Set.

Parameters
statThe new status.
valA value associated with the new status.

Definition at line 130 of file fsvarstat.h.

◆ value() [1/2]

double abacus::FSVarStat::value ( ) const
inline

Returns the value of fixing or setting if the variable has status Fixed or Set.

Definition at line 145 of file fsvarstat.h.

◆ value() [2/2]

void abacus::FSVarStat::value ( double  val)
inline

Assigns a new value of fixing or setting.

Parameters
valThe new value.

Definition at line 151 of file fsvarstat.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const FSVarStat rhs 
)
friend

Output operator.

The output operator writes the status and, if the status is Fixed or Set, also its value on an output stream.

Parameters
outThe output stream.
rhsThe variable status being output.
Returns
A reference to the output stream.

Member Data Documentation

◆ glob_

AbacusGlobal* abacus::FSVarStat::glob_
private

A pointer to the corresponding global object.

Definition at line 191 of file fsvarstat.h.

◆ status_

STATUS abacus::FSVarStat::status_
private

The status of the variable.

Definition at line 193 of file fsvarstat.h.

◆ value_

double abacus::FSVarStat::value_
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.


The documentation for this class was generated from the following file: