Stores constraints and variables. More...
#include <ogdf/lib/abacus/poolslot.h>
Public Member Functions | |
PoolSlot (Master *master, Pool< BaseType, CoType > *pool, BaseType *convar=0) | |
Creates a pool slot and inserts convar. | |
~PoolSlot () | |
BaseType * | conVar () const |
Returns a pointer to the constraint/variable in the pool slot. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
Private Member Functions | |
PoolSlot (const PoolSlot< BaseType, CoType > &rhs) | |
void | hardDelete () |
Deletes the constraint/variable in the slot. | |
void | insert (BaseType *convar) |
Inserts a constraint/variable in the slot and updates the version number. | |
Master * | master () |
Returns a pointer to the corresponding master of the optimization. | |
const Master * | master () const |
Returns a const pointer to the corresponding master of the optimization. | |
const PoolSlot< BaseType, CoType > & | operator= (const PoolSlot< BaseType, CoType > &rhs) |
void | removeConVarFromPool () |
Removes the constraint contained in this slot from its pool. | |
int | softDelete () |
Tries to remove the item from the slot. | |
unsigned long | version () const |
Return the version number of the constraint/variable in the slot. | |
Private Attributes | |
BaseType * | conVar_ |
A pointer to the constraint/variable. | |
Master * | master_ |
A pointer to the corresponding master of the optimization. | |
Pool< BaseType, CoType > * | pool_ |
A pointer to the corresponding pool. | |
unsigned long | version_ |
The version of the constraint in the slot. | |
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". | |
Stores constraints and variables.
Constraints or variables are not directly stored in a pool, but in pool slots, which form again the basic building blocks of a pool. The reason is that in order to save memory it can be necessary that a constraint or variable in the pool has to be deleted although it is still contained in the active formulation of an inactive subproblem. Of course this deletion can be only done with constraints/variables which can be regenerated or which are not required for the correctness of the algorithm (e.g., for a cutting plane, but not for a variable or constraint of the problem formulation of a general mixed integer optimization problem).
Such that the deletion of a variable or constraint cannot cause a run-time error, we store it in a pool slot. Together with the pointer to the constraint/variable we store also its version number. The version number is initially zero and incremented each time when a new item is inserted in the pool slot. When we refer to a constraint/variable, e.g., from the sets of active constraints or variables, then we point to the slot and memorize the version number (class PoolSlotRef), when this reference has been set up. Later by comparing the version number of PoolSlotRef and the one of the corresponding PoolSlot we can check if still the constraint/variable is contained in the slot which is supposed to be there. Usually, if the expected constraint/variable is missing, it is ignored.
Definition at line 77 of file poolslot.h.
abacus::PoolSlot< BaseType, CoType >::PoolSlot | ( | Master * | master, |
Pool< BaseType, CoType > * | pool, | ||
BaseType * | convar = 0 |
||
) |
Creates a pool slot and inserts convar.
Sets the version number to 1, if a constraint has already been inserted in this slot, 0 otherwise.
master | A pointer to the corresponding master of the optimization. |
pool | The pool this slot belongs to. |
convar | The constraint/variable inserted in this slot if not 0. The default value is 0. |
|
inline |
Returns a pointer to the constraint/variable in the pool slot.
Definition at line 115 of file poolslot.h.
|
inlineprivate |
Deletes the constraint/variable in the slot.
Definition at line 147 of file poolslot.h.
|
private |
Inserts a constraint/variable in the slot and updates the version number.
If the slot still contains a constraint, the program stops.
convar | The constraint/variable that is inserted. |
|
inlineprivate |
Returns a pointer to the corresponding master of the optimization.
Definition at line 161 of file poolslot.h.
|
inlineprivate |
Returns a const pointer to the corresponding master of the optimization.
Definition at line 164 of file poolslot.h.
|
private |
|
inlineprivate |
Removes the constraint contained in this slot from its pool.
Definition at line 153 of file poolslot.h.
|
inlineprivate |
Tries to remove the item from the slot.
This is possible if the function ConVar::deletable() returns true.
Definition at line 134 of file poolslot.h.
|
inlineprivate |
Return the version number of the constraint/variable in the slot.
Definition at line 158 of file poolslot.h.
Definition at line 1 of file poolslot.h.
Definition at line 84 of file poolslot.h.
Definition at line 84 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
Definition at line 1 of file poolslot.h.
Definition at line 84 of file poolslot.h.
Definition at line 84 of file poolslot.h.
Definition at line 1 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
Definition at line 1 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
|
friend |
Definition at line 84 of file poolslot.h.
Definition at line 84 of file poolslot.h.
|
private |
A pointer to the constraint/variable.
Definition at line 167 of file poolslot.h.
|
private |
A pointer to the corresponding master of the optimization.
Definition at line 166 of file poolslot.h.
A pointer to the corresponding pool.
Definition at line 169 of file poolslot.h.
|
private |
The version of the constraint in the slot.
Definition at line 168 of file poolslot.h.