Stores constraints and variables. More...
#include <ogdf/lib/abacus/active.h>
Public Member Functions | |
PoolSlot (Master *master, Pool< BaseType, CoType > *pool, BaseType *convar=0) | |
Creates a pool slot and inserts convar. More... | |
~PoolSlot () | |
BaseType * | conVar () const |
Returns a pointer to the constraint/variable in the pool slot. More... | |
Private Member Functions | |
PoolSlot (const PoolSlot< BaseType, CoType > &rhs) | |
void | hardDelete () |
Deletes the constraint/variable in the slot. More... | |
void | insert (BaseType *convar) |
Inserts a constraint/variable in the slot and updates the version number. More... | |
Master * | master () |
Returns a pointer to the corresponding master of the optimization. More... | |
const Master * | master () const |
Returns a const pointer to the corresponding master of the optimization. More... | |
const PoolSlot< BaseType, CoType > & | operator= (const PoolSlot< BaseType, CoType > &rhs) |
void | removeConVarFromPool () |
Removes the constraint contained in this slot from its pool. More... | |
int | softDelete () |
Tries to remove the item from the slot. More... | |
unsigned long | version () const |
Return the version number of the constraint/variable in the slot. More... | |
Private Attributes | |
BaseType * | conVar_ |
A pointer to the constraint/variable. More... | |
Master * | master_ |
A pointer to the corresponding master of the optimization. More... | |
Pool< BaseType, CoType > * | pool_ |
A pointer to the corresponding pool. More... | |
unsigned long | version_ |
The version of the constraint in the slot. More... | |
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.
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. |
abacus::PoolSlot< BaseType, CoType >::~PoolSlot | ( | ) |
|
private |
|
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.
|
friend |
Definition at line 82 of file poolslot.h.
|
friend |
Definition at line 93 of file poolslot.h.
|
friend |
Definition at line 94 of file poolslot.h.
|
friend |
Definition at line 91 of file poolslot.h.
|
friend |
Definition at line 92 of file poolslot.h.
|
friend |
Definition at line 80 of file poolslot.h.
|
friend |
Definition at line 87 of file poolslot.h.
|
friend |
Definition at line 88 of file poolslot.h.
|
friend |
Definition at line 79 of file poolslot.h.
|
friend |
Definition at line 85 of file poolslot.h.
|
friend |
Definition at line 86 of file poolslot.h.
|
friend |
Definition at line 81 of file poolslot.h.
|
friend |
Definition at line 89 of file poolslot.h.
|
friend |
Definition at line 90 of file poolslot.h.
|
friend |
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.
|
private |
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.