|
| NonDuplPool (Master *master, int size, bool autoRealloc=false) |
| Creates an empty pool. More...
|
|
virtual | ~NonDuplPool () |
| The destructor. More...
|
|
virtual void | increase (int size) |
| Enlarges the pool to store up to size items. More...
|
|
virtual PoolSlot< BaseType, CoType > * | insert (BaseType *cv) |
| Insert constraint/variable cv in the pool. More...
|
|
virtual PoolSlot< BaseType, CoType > * | present (BaseType *cv) |
| Checks if constraint/variables cv is already contained in the pool. More...
|
|
virtual const PoolSlot< BaseType, CoType > * | present (const BaseType *cv) const |
| Checks if constraint/variables cv is already contained in the pool. More...
|
|
void | statistics (int &nDuplications, int &nCollisions) const |
| Returns some statistic information in nDuplicates and nCollisions. More...
|
|
Public Member Functions inherited from abacus::StandardPool< BaseType, CoType > |
| StandardPool (Master *master, int size, bool autoRealloc=false) |
| Creates an empty pool. More...
|
|
virtual | ~StandardPool () |
| The destructor. More...
|
|
int | cleanup () |
| Cleans-up the pool. More...
|
|
virtual int | separate (double *x, Active< CoType, BaseType > *active, Sub *sub, CutBuffer< BaseType, CoType > *cutBuffer, double minAbsViolation=0.001, int ranking=0) |
| Checks if a pair of a vector and an active constraint/variable set violates any item in the pool. More...
|
|
int | size () const |
| Return the maximal number of constraints/variables that can be inserted in the pool. More...
|
|
PoolSlot< BaseType, CoType > * | slot (int i) |
| Returns a pointer to the i-th slot in the pool. More...
|
|
template<class BaseType, class CoType>
class abacus::NonDuplPool< BaseType, CoType >
Standard pools without constraint duplication.
The class NonDuplPool provides an StandardPool with the additional feature that the same constraint is at most stored once in the pool. For constraints and variables inserted in this pool the virtual member functions name(), hashKey(), and equal() of the base class ConVar have to be defined. Using these three functions, we check at insertation time if a constraint or variable is already stored in the pool.
The implementation is unsafe in the sense that the data structure for registering a constraint is corrupted if a constraint is removed directly from the pool slot without using a function of this class.
Definition at line 58 of file nonduplpool.h.
template<class BaseType , class CoType >
Enlarges the pool to store up to size items.
To avoid fatal errors we do not allow decreasing the size of the pool. This function redefines the virtual function of the base class StandardPool because we have to reallocate the hash table.
- Parameters
-
size | The new size of the pool. |
Reimplemented from abacus::StandardPool< BaseType, CoType >.
Definition at line 125 of file nonduplpool.h.
template<class BaseType , class CoType >
Insert constraint/variable cv in the pool.
Before the function insert() tries to insert a constraint/variable in the pool, it checks if the constraint/variable is already contained in the pool. If the constraint/variable cv is contained in the pool, it is deleted.
- Parameters
-
cv | The constraint/variable being inserted. |
- Returns
- A pointer to the pool slot where the item has been inserted, or a pointer to the pool slot if the item is already contained in the pool, or 0 if the insertion failed.
Reimplemented from abacus::StandardPool< BaseType, CoType >.
template<class BaseType , class CoType >
void abacus::NonDuplPool< BaseType, CoType >::statistics |
( |
int & |
nDuplications, |
|
|
int & |
nCollisions |
|
) |
| const |
|
inline |
Returns some statistic information in nDuplicates and nCollisions.
Determines the number of constraints that have not been inserted into the pool, because an equivalent was already present.
Also the number of collisions in the hash table is computed. If this number is high, it might indicate that your hash function is not chosen very well.
- Parameters
-
nDuplications | The number of constraints that have not been inserted into the pool because an equivalent one was already present. |
nCollisions | The number of collisions in the hash table. |
Definition at line 144 of file nonduplpool.h.