Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

abacus::Active< BaseType, CoType > Class Template Reference

Implements the sets of active constraints and variables which are associated with each subproblem. More...

#include <ogdf/lib/abacus/active.h>

Public Member Functions

 Active (const Active< BaseType, CoType > &rhs)
 Copy constructor. More...
 
 Active (Master *master, Active *a, int max)
 Creates a set of active items, initialized to at most max items from a. More...
 
 Active (Master *master, int max)
 Creates an empty set of active items. More...
 
 ~Active ()
 
void incrementRedundantAge (int i)
 Increments the number ofiterations the item i is already redundant by 1. More...
 
void insert (ArrayBuffer< PoolSlot< BaseType, CoType > * > &ps)
 Adds constraints/variables to the active items set. More...
 
void insert (PoolSlot< BaseType, CoType > *ps)
 Adds a constraint/variable to the active items set. More...
 
int max () const
 Returns the maximum number of storable active items (without reallocation). More...
 
int number () const
 Returns the current number of active items. More...
 
BaseType * operator[] (int i)
 Access to the i-th active item. More...
 
const BaseType * operator[] (int i) const
 Access to the i-th active item. More...
 
PoolSlotRef< BaseType, CoType > * poolSlotRef (int i)
 Returns the i-th entry in the Array active. More...
 
const PoolSlotRef< BaseType, CoType > * poolSlotRef (int i) const
 Returns the i-th entry in the Array active. More...
 
void realloc (int newSize)
 Changes the maximum number of active items which can be stored. More...
 
int redundantAge (int i) const
 Returns the number of iterations a constraint/variable is already redundant. More...
 
void remove (ArrayBuffer< int > &del)
 Removes items from the list of active items. More...
 
void resetRedundantAge (int i)
 Sets the number of iterations item i is redundant to 0. More...
 

Private Member Functions

const Active< BaseType, CoType > & operator= (const Active< BaseType, CoType > &rhs)
 

Private Attributes

Array< PoolSlotRef< BaseType, CoType > * > active_
 The array storing references to the pool slots of the active items. More...
 
Mastermaster_
 A pointer to corresponding master of the optimization. More...
 
int n_
 The number of active items. More...
 
Array< int > redundantAge_
 The number of iterations a constraint is already redundant. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const Active< BaseType, CoType > &rhs)
 Output operator for active sets. More...
 

Detailed Description

template<class BaseType, class CoType>
class abacus::Active< BaseType, CoType >

Implements the sets of active constraints and variables which are associated with each subproblem.

This parameterized class implements the sets of active constraints and variables which are associated with each subproblem. Note, also an inactive subproblem can have an active set of constraints and variables, e.g., the sets with which its unprocessed sons in the enumeration tree are initialized.

If an active set of constraints is instantiated then the BaseType should be Constraint and the CoType should be Variable, for an active set of variables this is vice versa.

Definition at line 43 of file active.h.

Constructor & Destructor Documentation

◆ Active() [1/3]

template<class BaseType , class CoType >
abacus::Active< BaseType, CoType >::Active ( Master master,
int  max 
)
inline

Creates an empty set of active items.

Parameters
masterA pointer to the corresponding master of the optimization.
maxThe maximal number of active constraints/variables.

Definition at line 70 of file active.h.

◆ Active() [2/3]

template<class BaseType , class CoType >
abacus::Active< BaseType, CoType >::Active ( Master master,
Active< BaseType, CoType > *  a,
int  max 
)

Creates a set of active items, initialized to at most max items from a.

Parameters
masterA pointer to the corresponding master of the optimization.
aAt most max active constraints/variables are taken from this set.
maxThe maximal number of active constraints/variables.

◆ Active() [3/3]

template<class BaseType , class CoType >
abacus::Active< BaseType, CoType >::Active ( const Active< BaseType, CoType > &  rhs)

Copy constructor.

Parameters
rhsThe active set that is copied.

◆ ~Active()

template<class BaseType , class CoType >
abacus::Active< BaseType, CoType >::~Active ( )

Member Function Documentation

◆ incrementRedundantAge()

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::incrementRedundantAge ( int  i)
inline

Increments the number ofiterations the item i is already redundant by 1.

Parameters
iThe index of the constraint/variable.

Definition at line 194 of file active.h.

◆ insert() [1/2]

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::insert ( ArrayBuffer< PoolSlot< BaseType, CoType > * > &  ps)

Adds constraints/variables to the active items set.

Parameters
psThe buffer storing the pool slots of all constraints/variables that are added.

◆ insert() [2/2]

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::insert ( PoolSlot< BaseType, CoType > *  ps)

Adds a constraint/variable to the active items set.

Parameters
psThe pool slot storing the constraint/variable being added.

◆ max()

template<class BaseType , class CoType >
int abacus::Active< BaseType, CoType >::max ( ) const
inline

Returns the maximum number of storable active items (without reallocation).

Definition at line 110 of file active.h.

◆ number()

template<class BaseType , class CoType >
int abacus::Active< BaseType, CoType >::number ( ) const
inline

Returns the current number of active items.

Definition at line 106 of file active.h.

◆ operator=()

template<class BaseType , class CoType >
const Active<BaseType, CoType>& abacus::Active< BaseType, CoType >::operator= ( const Active< BaseType, CoType > &  rhs)
private

◆ operator[]() [1/2]

template<class BaseType , class CoType >
BaseType* abacus::Active< BaseType, CoType >::operator[] ( int  i)
inline

Access to the i-th active item.

Parameters
iThe number of the active item.
Returns
A pointer to the i-th active item, or 0 if this item has been removed in the meantime.

Definition at line 119 of file active.h.

◆ operator[]() [2/2]

template<class BaseType , class CoType >
const BaseType* abacus::Active< BaseType, CoType >::operator[] ( int  i) const
inline

Access to the i-th active item.

Parameters
iThe number of the active item.
Returns
A const pointer to the i-th active item, or 0 if this item has been removed in the meantime.

Definition at line 135 of file active.h.

◆ poolSlotRef() [1/2]

template<class BaseType , class CoType >
PoolSlotRef<BaseType, CoType>* abacus::Active< BaseType, CoType >::poolSlotRef ( int  i)
inline

Returns the i-th entry in the Array active.

Parameters
iThe index of the active item.

Definition at line 149 of file active.h.

◆ poolSlotRef() [2/2]

template<class BaseType , class CoType >
const PoolSlotRef<BaseType, CoType>* abacus::Active< BaseType, CoType >::poolSlotRef ( int  i) const
inline

Returns the i-th entry in the Array active.

Parameters
iThe index of the active item.

Definition at line 157 of file active.h.

◆ realloc()

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::realloc ( int  newSize)

Changes the maximum number of active items which can be stored.

Parameters
newSizeThe new maximal number of active items.

◆ redundantAge()

template<class BaseType , class CoType >
int abacus::Active< BaseType, CoType >::redundantAge ( int  i) const
inline

Returns the number of iterations a constraint/variable is already redundant.

Definition at line 186 of file active.h.

◆ remove()

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::remove ( ArrayBuffer< int > &  del)

Removes items from the list of active items.

Parameters
delThe numbers of the items that should be removed. These numbers must be upward sorted.

◆ resetRedundantAge()

template<class BaseType , class CoType >
void abacus::Active< BaseType, CoType >::resetRedundantAge ( int  i)
inline

Sets the number of iterations item i is redundant to 0.

Parameters
iThe index of the constraint/variable.

Definition at line 202 of file active.h.

Friends And Related Function Documentation

◆ operator<<

template<class BaseType , class CoType >
std::ostream& operator<< ( std::ostream &  out,
const Active< BaseType, CoType > &  rhs 
)
friend

Output operator for active sets.

The output operator writes all active constraints and variables to an output stream.

If an associated pool slot is void, or the item is newer than the one we refer to, then "void" is written.

Parameters
outThe output stream.
rhsThe active set being output.
Returns
A reference to the output stream.

Member Data Documentation

◆ active_

template<class BaseType , class CoType >
Array<PoolSlotRef<BaseType, CoType> *> abacus::Active< BaseType, CoType >::active_
private

The array storing references to the pool slots of the active items.

Definition at line 210 of file active.h.

◆ master_

template<class BaseType , class CoType >
Master* abacus::Active< BaseType, CoType >::master_
private

A pointer to corresponding master of the optimization.

Definition at line 207 of file active.h.

◆ n_

template<class BaseType , class CoType >
int abacus::Active< BaseType, CoType >::n_
private

The number of active items.

Definition at line 209 of file active.h.

◆ redundantAge_

template<class BaseType , class CoType >
Array<int> abacus::Active< BaseType, CoType >::redundantAge_
private

The number of iterations a constraint is already redundant.

Definition at line 211 of file active.h.


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