Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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>

+ Inheritance diagram for abacus::Active< BaseType, CoType >:

Public Member Functions

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

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.
 
Mastermaster_
 A pointer to corresponding master of the optimization.
 
int n_
 The number of active items.
 
Array< intredundantAge_
 The number of iterations a constraint is already redundant.
 

Friends

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

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 charonOff (bool value)
 Converts a boolean variable to the strings "on" and "off".
 

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 62 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()

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]

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]

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=()

◆ operator[]() [1/2]

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 Symbol 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_

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: