Implements the sets of active constraints and variables which are associated with each subproblem. More...
#include <ogdf/lib/abacus/active.h>
Public Member Functions | |
Active (const Active< BaseType, CoType > &rhs) | |
Copy constructor. | |
Active (Master *master, Active *a, int max) | |
Creates a set of active items, initialized to at most max items from a. | |
Active (Master *master, int max) | |
Creates an empty set of active items. | |
~Active () | |
void | incrementRedundantAge (int i) |
Increments the number ofiterations the item i is already redundant by 1. | |
void | insert (ArrayBuffer< PoolSlot< BaseType, CoType > * > &ps) |
Adds constraints/variables to the active items set. | |
void | insert (PoolSlot< BaseType, CoType > *ps) |
Adds a constraint/variable to the active items set. | |
int | max () const |
Returns the maximum number of storable active items (without reallocation). | |
int | number () const |
Returns the current number of active items. | |
BaseType * | operator[] (int i) |
Access to the i-th active item. | |
const BaseType * | operator[] (int i) const |
Access to the i-th active item. | |
PoolSlotRef< BaseType, CoType > * | poolSlotRef (int i) |
Returns the i-th entry in the Array active. | |
const PoolSlotRef< BaseType, CoType > * | poolSlotRef (int i) const |
Returns the i-th entry in the Array active. | |
void | realloc (int newSize) |
Changes the maximum number of active items which can be stored. | |
int | redundantAge (int i) const |
Returns the number of iterations a constraint/variable is already redundant. | |
void | remove (ArrayBuffer< int > &del) |
Removes items from the list of active items. | |
void | resetRedundantAge (int i) |
Sets the number of iterations item i is redundant to 0. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
Private Member Functions | |
const Active< BaseType, CoType > & | operator= (const Active< BaseType, CoType > &rhs) |
Private Attributes | |
Array< PoolSlotRef< BaseType, CoType > * > | active_ |
The array storing references to the pool slots of the active items. | |
Master * | master_ |
A pointer to corresponding master of the optimization. | |
int | n_ |
The number of active items. | |
Array< int > | redundantAge_ |
The number of iterations a constraint is already redundant. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Active< BaseType, CoType > &rhs) |
Output operator for active sets. | |
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. | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". | |
Implements the sets of active constraints and variables which are associated with each subproblem.
This parameterized class implements the sets of active constraints and variables which are associated with each subproblem. Note, also an inactive subproblem can have an active set of constraints and variables, e.g., the sets with which its unprocessed sons in the enumeration tree are initialized.
If an active set of constraints is instantiated then the BaseType should be Constraint and the CoType should be Variable, for an active set of variables this is vice versa.
|
inline |
abacus::Active< BaseType, CoType >::Active | ( | Master * | master, |
Active< BaseType, CoType > * | a, | ||
int | max | ||
) |
Creates a set of active items, initialized to at most max items from a.
master | A pointer to the corresponding master of the optimization. |
a | At most max active constraints/variables are taken from this set. |
max | The maximal number of active constraints/variables. |
Copy constructor.
rhs | The active set that is copied. |
|
inline |
void abacus::Active< BaseType, CoType >::insert | ( | ArrayBuffer< PoolSlot< BaseType, CoType > * > & | ps | ) |
Adds constraints/variables to the active items set.
ps | The buffer storing the pool slots of all constraints/variables that are added. |
Adds a constraint/variable to the active items set.
ps | The pool slot storing the constraint/variable being added. |
|
inline |
|
inline |
|
private |
|
inline |
|
inline |
|
inline |
|
inline |
void abacus::Active< BaseType, CoType >::realloc | ( | int | newSize | ) |
Changes the maximum number of active items which can be stored.
newSize | The new maximal number of active items. |
|
inline |
void abacus::Active< BaseType, CoType >::remove | ( | ArrayBuffer< int > & | del | ) |
Removes items from the list of active items.
del | The numbers of the items that should be removed. These numbers must be upward sorted. |
|
inline |
Output operator for active sets.
The output operator writes all active constraints and variables to an output stream.
If an associated pool slot is void, or the item is newer than the one we refer to, then "void"
is written.
out | The output stream. |
rhs | The active set being output. |
|
private |
|
private |
|
private |