Base class for constraint/variabe pools. More...
#include <ogdf/lib/abacus/pool.h>
Public Types | |
enum | RANKING { NO_RANK , RANK , ABS_RANK } |
Determines how th rank of a constraint/variable is computed. More... | |
Public Member Functions | |
Pool (Master *master) | |
Initializes an empty pool. | |
virtual | ~Pool () |
virtual PoolSlot< BaseType, CoType > * | insert (BaseType *cv)=0 |
Tries to insert a constraint/variable in the pool. | |
int | number () const |
Returns the current number of items in the pool. | |
void | removeConVar (PoolSlot< BaseType, CoType > *slot) |
Removes the constraint/variable stored in a pool slot and adds the slot to the list of free slots. | |
virtual int | separate (double *z, Active< CoType, BaseType > *active, Sub *sub, CutBuffer< BaseType, CoType > *cutBuffer, double minAbsViolation=0.001, int ranking=0)=0 |
Checks if a pair of a vector and an active constraint/variable set violates any item in the pool. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
Protected Member Functions | |
virtual PoolSlot< BaseType, CoType > * | getSlot ()=0 |
Tries to find a free slot in the pool. | |
virtual void | hardDeleteConVar (PoolSlot< BaseType, CoType > *slot) |
Removes a constraint/variable from the pool and adds the slot to the set of free slots. | |
virtual void | putSlot (PoolSlot< BaseType, CoType > *slot)=0 |
Makes an PoolSlot again available for later calls of getSlot(). | |
virtual int | softDeleteConVar (PoolSlot< BaseType, CoType > *slot) |
Removes the constraint/variable stored in slot from the pool if it can be deleted. | |
Protected Attributes | |
Master * | master_ |
A pointer to the corresponding master of the optimization. | |
int | number_ |
The current number of constraints in the pool. | |
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". | |
Base class for constraint/variabe pools.
Every constraint and variable has to to be stored in a pool. This class implements an abstract template class for a pool, which can be used to store objects of the class Variable or of the class Constraint. A constraint or variable is not directly stored in the pool, but in an PoolSlot. Hence, a pool is a collection of pool slots.
A pool has two template arguments: the BaseType and the CoType. Only two scenarios make sense in the current context. For a pool storing constraints the BaseType is Constraint and the CoType is Variable. For a pool storing variables the BaseType is Variable and the corresponding CoType is Constraint.
The class Pool is an abstract class from which concrete classes have to be derived, implementing the data structures for the storage of pool slots. We provide already in the class StandardPool a simple but convenient implementation of a pool. We refer to all constraints and variables via the class PoolSlotRef.
Determines how th rank of a constraint/variable is computed.
The enumeration RANKING indicates how the rank of a constraint/variable in a pool separation is determined. This enumeration is not used at the moment because we cannot use the enumeration as the type of a function parameter in a derived class.
Enumerator | |
---|---|
NO_RANK | No rank is computed. |
RANK | The violation computed by the function violated() of the classes Constraint or Variable is used as rank. |
ABS_RANK | The absolute value of the violation is taken as rank. |
|
inline |
|
inlinevirtual |
|
protectedpure virtual |
Tries to find a free slot in the pool.
This function is protected since it should only be used by insert(). The data structure managing the free poolslots can be individually defined for each derived pool class.
Implemented in abacus::StandardPool< BaseType, CoType >, abacus::StandardPool< abacus::Constraint, abacus::Variable >, and abacus::StandardPool< abacus::Variable, abacus::Constraint >.
|
inlineprotectedvirtual |
Removes a constraint/variable from the pool and adds the slot to the set of free slots.
slot | A pointer to the pool slot from wich the constraint/variable should be deleted. |
Reimplemented in abacus::NonDuplPool< BaseType, CoType >.
|
pure virtual |
Tries to insert a constraint/variable in the pool.
cv | The constraint/variable being inserted. |
Implemented in abacus::NonDuplPool< BaseType, CoType >, and abacus::StandardPool< BaseType, CoType >.
|
inline |
|
protectedpure virtual |
Makes an PoolSlot again available for later calls of getSlot().
If somebody else refers to this constraint the function should abort with an error message.
slot | The slot made available for further use. |
Implemented in abacus::StandardPool< BaseType, CoType >.
|
pure virtual |
Checks if a pair of a vector and an active constraint/variable set violates any item in the pool.
If the pool is a constraint pool, then the vector is an LP-solution and the active set is the set of active variables. Otherwise, if the pool is a variable pool, then the vector contains the dual variables and the active set is the set of associated active constraints.
z | The vector for which violation is checked. |
active | The constraint/variable set associated with z. |
sub | The subproblem for which validity of the violated item is required. |
cutBuffer | The violated constraints/variables are added to this buffer. |
minAbsViolation | A violated constraint/variable is only added to the cutBuffer if the absolute value of its violation is at least minAbsViolation. The default value is 0.001. |
ranking | If 1, the violation is associated with a rank of item in the buffer, if 2 the absolute violation is used, if 0 no rank is associated with the item. |
Implemented in abacus::StandardPool< BaseType, CoType >.
|
inlineprotectedvirtual |
Removes the constraint/variable stored in slot from the pool if it can be deleted.
If the constraint/variable can be removed, the slot is added to the set of free slots.
slot | A pointer to the pool slot from wich the constraint/variable should be deleted. |
Reimplemented in abacus::NonDuplPool< BaseType, CoType >.
|
protected |