6.30 ABA_STANDARDPOOL< BaseType, CoType > Class Template Reference

class provides a very simple implementation of a pool which is sufficient for a large class of applications. pool slots stored in array, set of free slots is managed by a linear list

#include <standardpool.h>

Inheritance diagram for ABA_STANDARDPOOL< BaseType, CoType >::


PIC


Public Member Functions

Protected Member Functions

Protected Attributes

Private Member Functions

Friends

6.30.1 Detailed Description

template<class BaseType, class CoType> class ABA_STANDARDPOOL< BaseType, CoType >

class provides a very simple implementation of a pool which is sufficient for a large class of applications. pool slots stored in array, set of free slots is managed by a linear list

Definition at line 58 of file standardpool.h.

6.30.2 Constructor & Destructor Documentation

6.30.2.1 template<class BaseType, class CoType> ABA_STANDARDPOOL< BaseType, CoType >::ABA_STANDARDPOOL (ABA_MASTER * master, int size, bool autoRealloc = false)

The constructor for an empty pool.

All slots are inserted in the linked list of free slots.

Parameters:

master
A pointer to the corresponding master of the optimization.
size
The maximal number of items which can be inserted in the pool without reallocation.
autoRealloc
If this argument is true an automatic reallocation is performed if the pool is full.

6.30.2.2 template<class BaseType, class CoType> virtual ABA_STANDARDPOOL< BaseType, CoType >::~ABA_STANDARDPOOL ()

The destructor deletes all slots. The destructor of a pool slot deletes then also the respective constraint or variable.

6.30.2.3 template<class BaseType, class CoType> ABA_STANDARDPOOL< BaseType, CoType >::ABA_STANDARDPOOL (const ABA_STANDARDPOOL< BaseType, CoType > & rhs) [private]

6.30.3 Member Function Documentation

6.30.3.1 template<class BaseType, class CoType> virtual ABA_POOLSLOT<BaseType,CoType>* ABA_STANDARDPOOL< BaseType, CoType >::insert (BaseType * cv) [virtual]

Tries to insert a constraint/variable in the pool.

If there is no free slot available, we try to generate free slots by removing redundant items, i.e., items which have no reference to them. If this fails, we either perform an automatic reallocation of the pool or remove non-active items.

Returns:

A pointer to the pool slot where the item has been inserted, or 0 if the insertion failed.

Parameters:

cv
The constraint/variable being inserted.

Implements ABA_POOL< BaseType, CoType >.

Reimplemented in ABA_NONDUPLPOOL< BaseType, CoType >.

6.30.3.2 template<class BaseType, class CoType> virtual void ABA_STANDARDPOOL< BaseType, CoType >::increase (int size) [virtual]

Enlarges the pool to store.

To avoid fatal errors we do not allow decreasing the size of the pool.

Parameters:

size
The new size of the pool.

Reimplemented in ABA_NONDUPLPOOL< BaseType, CoType >.

6.30.3.3 template<class BaseType, class CoType> int ABA_STANDARDPOOL< BaseType, CoType >::cleanup ()

Scans the pool, removes all deletable items, i.e., those items without having references, and adds the corresponding slots to the list of free slots.

Returns:

The number of “cleaned” slots.

6.30.3.4 template<class BaseType, class CoType> int ABA_STANDARDPOOL< BaseType, CoType >::size () const

Returns:

The maximal number of constraints/variables that can be inserted in the pool.

6.30.3.5 template<class BaseType, class CoType> ABA_POOLSLOT<BaseType,CoType>*ABA_STANDARDPOOL< BaseType, CoType >::slot (int i)

Returns:

A pointer to the i-th slot in the pool.

Parameters:

i
The number of the slot being accessed.

6.30.3.6 template<class BaseType, class CoType> virtual int ABA_STANDARDPOOL< BaseType, CoType >::separate (double * x, ABA_ACTIVE< CoType, BaseType > * active, ABA_SUB * sub, ABA_CUTBUFFER< BaseType, CoType > * cutBuffer, double minAbsViolation = 0.001, int ranking = 0) [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 the set of active variables. Otherwise, if the pool is a variable pool, then the vector stores the values of the dual variables and the active set the associated active constraints.

Before a constraint or variable is generated we check if it is valid for the subproblem sub.

The function defines the pure virtual function of the base class ABA_POOL.

This is a very simple version of the pool separation. Future versions might scan a priority queue of the available constraints until a limited number of constraints is tested or separated.

Returns:

The number of violated items.

Parameters:

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 3 the function ABA_CONVAR::rank() is used, if 0 no rank is associated with the item.

Implements ABA_POOL< BaseType, CoType >.

6.30.3.7 template<class BaseType, class CoType> int ABA_STANDARDPOOL< BaseType, CoType >::removeNonActive (int maxRemove) [protected]

Tries to remove at most maxRemove inactive items from the pool.

A minimum heap of the items with the reference counter as key is built up and items are removed in this order.

6.30.3.8 template<class BaseType, class CoType> virtual ABA_POOLSLOT<BaseType,CoType>* ABA_STANDARDPOOL< BaseType, CoType >::getSlot () [protected, virtual]

Returns a free slot, or 0 if no free slot is available. A returned slot is removed from the list of free slots.

This function defines the pure virtual function of the base class ABA_POOL.

Implements ABA_POOL< BaseType, CoType >.

6.30.3.9 template<class BaseType, class CoType> virtual void ABA_STANDARDPOOL< BaseType, CoType >::putSlot (ABA_POOLSLOT< BaseType, CoType > * slot) [protected, virtual]

Inserts the slot in the list of free slots.

It is an error to insert a slot which is not empty.

This function defines the pure virtual function of the base class ABA_POOL.

Implements ABA_POOL< BaseType, CoType >.

6.30.3.10 template<class BaseType, class CoType> const ABA_STANDARDPOOL& ABA_STANDARDPOOL< BaseType, CoType >::operator= (const ABA_STANDARDPOOL< BaseType, CoType > & rhs) [private]

6.30.4 Friends And Related Function Documentation

6.30.4.1 template<class BaseType, class CoType> ostream& operator<< (ostream & out, const ABA_STANDARDPOOL< BaseType, CoType > & rhs) [friend]

The output operator calls the output operator of each item of a non-void pool slot.

Returns:

A reference to the output stream.

Parameters:

out
The output stream.
rhs
The pool being output.

6.30.5 Member Data Documentation

6.30.5.1 template<class BaseType, class CoType> ABA_ARRAY<ABA_POOLSLOT<BaseType,CoType> *> ABA_STANDARDPOOL< BaseType, CoType >::pool_ [protected]

The array with the pool slots.

Definition at line 235 of file standardpool.h.

6.30.5.2 template<class BaseType, class CoType> ABA_LIST<ABA_POOLSLOT<BaseType,CoType> *> ABA_STANDARDPOOL< BaseType, CoType >::freeSlots_ [protected]

The linked lists of unused slots.

Definition at line 239 of file standardpool.h.

6.30.5.3 template<class BaseType, class CoType> bool ABA_STANDARDPOOL< BaseType, CoType >::autoRealloc_ [protected]

If the pool becomes full and this member is true, then an automatic reallocation is performed.

Definition at line 245 of file standardpool.h.

The documentation for this class was generated from the following file: