ABA_CUTBUFFER< BaseType, CoType > Class Template Reference

template class implements a buffer for constraints and variables which are generated during the cutting plane or column generation phase. More...

#include <cutbuffer.h>

Inheritance diagram for ABA_CUTBUFFER< BaseType, CoType >:

ABA_ABACUSROOT List of all members.

Public Member Functions

 ABA_CUTBUFFER (ABA_MASTER *master, int size)
 ~ABA_CUTBUFFER ()
int size () const
int number () const
int space () const
int insert (ABA_POOLSLOT< BaseType, CoType > *slot, bool keepInPool)
int insert (ABA_POOLSLOT< BaseType, CoType > *slot, bool keepInPool, double rank)
 In addition to the previous version of the function insert() this version also adds a rank to the item such that all buffered items can be sorted with the function sort().
void remove (ABA_BUFFER< int > &index)
ABA_POOLSLOT< BaseType, CoType > * slot (int i)

Private Member Functions

void extract (int max, ABA_BUFFER< ABA_POOLSLOT< BaseType, CoType > * > &newSlots)
void sort (int threshold)
 ABA_CUTBUFFER (const ABA_CUTBUFFER< BaseType, CoType > &rhs)
const ABA_CUTBUFFER< BaseType,
CoType > & 
operator= (const ABA_CUTBUFFER< BaseType, CoType > &rhs)

Private Attributes

ABA_MASTERmaster_
int n_
ABA_ARRAY< ABA_POOLSLOTREF<
BaseType, CoType > * > 
psRef_
ABA_ARRAY< bool > keepInPool_
 If keepInPool_[i] is true for a buffered constraint/variables, then it is not removed from its pool although it might be discarded in extract().
ABA_ARRAY< double > rank_
bool ranking_
 This flag is true if a rank for each buffered item is available. As soon as an item without rank is inserted it becomes false.

Friends

class ABA_SUB

Detailed Description

template<class BaseType, class CoType>
class ABA_CUTBUFFER< BaseType, CoType >

template class implements a buffer for constraints and variables which are generated during the cutting plane or column generation phase.

Definition at line 49 of file cutbuffer.h.


Constructor & Destructor Documentation

template<class BaseType, class CoType>
ABA_CUTBUFFER< BaseType, CoType >::ABA_CUTBUFFER ( ABA_MASTER master,
int  size 
)

The constructor.

Parameters:
master A pointer to the corresponding master of the optimization.
size The maximal number of constraints/variables which can be buffered.

template<class BaseType, class CoType>
ABA_CUTBUFFER< BaseType, CoType >::~ABA_CUTBUFFER (  ) 

The destructor.

If there are still items buffered when this object is destructed then we have to unset the locks of the buffered items. This can happen if in the feasibility test constraints are generated but for some reason (e.g., due to tailing off) the optimization of the subproblem is terminated.

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


Member Function Documentation

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

Returns:
The maximal number of items that can be buffered.

template<class BaseType, class CoType>
int ABA_CUTBUFFER< BaseType, CoType >::number (  )  const

Returns:
The number of buffered items.

template<class BaseType, class CoType>
int ABA_CUTBUFFER< BaseType, CoType >::space (  )  const

Returns:
The number of items which can still be inserted into the buffer.

template<class BaseType, class CoType>
int ABA_CUTBUFFER< BaseType, CoType >::insert ( ABA_POOLSLOT< BaseType, CoType > *  slot,
bool  keepInPool 
)

Adds a slot to the buffer.

The member ranking_ has to be set to false, because since no rank is added together with this item a ranking of all items is impossible. Such that newly generated items cannot be removed immediately in a cleaning up process of the pool we set a lock which will be removed in the function extract().

Returns:
0 If the item can be inserted.

1 If the buffer is already full.

Parameters:
slot The inserted pool slot.
keepInPool If the flag keepInPool is true, then the item stored in the slot is not removed from the pool, even if it is discarded in extract(). Items regenerated from a pool should always have this flag set to true.

template<class BaseType, class CoType>
int ABA_CUTBUFFER< BaseType, CoType >::insert ( ABA_POOLSLOT< BaseType, CoType > *  slot,
bool  keepInPool,
double  rank 
)

In addition to the previous version of the function insert() this version also adds a rank to the item such that all buffered items can be sorted with the function sort().

Returns:
0 If the item can be inserted.

1 If the buffer is already full.

Parameters:
rank A rank associated with the constraint/variable.

template<class BaseType, class CoType>
void ABA_CUTBUFFER< BaseType, CoType >::remove ( ABA_BUFFER< int > &  index  ) 

Removes the specified elements from the buffer.

Parameters:
index The numbers of the elements which should be removed.

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

Returns:
A pointer to the i-th ABA_POOLSLOT that is buffered.

template<class BaseType, class CoType>
void ABA_CUTBUFFER< BaseType, CoType >::extract ( int  max,
ABA_BUFFER< ABA_POOLSLOT< BaseType, CoType > * > &  newSlots 
) [private]

Takes the first max items from the buffer and clears the buffer.

Constraints or variables stored in slots which are not extracted are also removed from their pools if keepInPool has not been set to true at insertion time.

Parameters:
max The maximal number of extracted items.
newSlots The extracted items are inserted into this buffer.

template<class BaseType, class CoType>
void ABA_CUTBUFFER< BaseType, CoType >::sort ( int  threshold  )  [private]

Sorts the items according to their ranks.

Parameters:
threshold Only if more than threshold items are buffered, the sorting is performed.

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


Friends And Related Function Documentation

template<class BaseType, class CoType>
friend class ABA_SUB [friend]

Definition at line 50 of file cutbuffer.h.


Member Data Documentation

template<class BaseType, class CoType>
ABA_MASTER* ABA_CUTBUFFER< BaseType, CoType >::master_ [private]

A pointer to the corresponding master of the optimization.

Definition at line 150 of file cutbuffer.h.

template<class BaseType, class CoType>
int ABA_CUTBUFFER< BaseType, CoType >::n_ [private]

The number of buffered items.

Definition at line 154 of file cutbuffer.h.

template<class BaseType, class CoType>
ABA_ARRAY<ABA_POOLSLOTREF<BaseType, CoType>*> ABA_CUTBUFFER< BaseType, CoType >::psRef_ [private]

References to the pool slots of the buffered constraints/variables.

Definition at line 158 of file cutbuffer.h.

template<class BaseType, class CoType>
ABA_ARRAY<bool> ABA_CUTBUFFER< BaseType, CoType >::keepInPool_ [private]

If keepInPool_[i] is true for a buffered constraint/variables, then it is not removed from its pool although it might be discarded in extract().

Definition at line 164 of file cutbuffer.h.

template<class BaseType, class CoType>
ABA_ARRAY<double> ABA_CUTBUFFER< BaseType, CoType >::rank_ [private]

This array stores optionally the rank of the buffered items.

Definition at line 168 of file cutbuffer.h.

template<class BaseType, class CoType>
bool ABA_CUTBUFFER< BaseType, CoType >::ranking_ [private]

This flag is true if a rank for each buffered item is available. As soon as an item without rank is inserted it becomes false.

Definition at line 173 of file cutbuffer.h.


The documentation for this class was generated from the following file:
Generated on Tue Aug 14 18:09:56 2007 for ABACUS by  doxygen 1.5.1