ABA_CONVAR Class Reference

ABA_CONVAR is the common base class for constraints and variables, which are implemented in the derived classes ABA_CONSTRAINT and ABA_VARIABLE, respectively. More...

#include <convar.h>

Inheritance diagram for ABA_CONVAR:

ABA_ABACUSROOT ABA_CONSTRAINT ABA_VARIABLE ABA_NUMCON ABA_ROWCON ABA_COLVAR ABA_NUMVAR ABA_SROWCON List of all members.

Public Member Functions

 ABA_CONVAR (ABA_MASTER *master, const ABA_SUB *sub, bool dynamic, bool local)
virtual ~ABA_CONVAR ()
bool active () const
bool local () const
bool global () const
virtual bool dynamic () const
const ABA_SUBsub () const
void sub (ABA_SUB *sub)
 This version of the function sub() associates a new subproblem with the constraint/variable.
virtual unsigned hashKey ()
 Should provide a key for the constraint/variable that can be used to insert it into a hash table.
virtual const char * name ()
virtual bool equal (ABA_CONVAR *cv)
 Should compare if the constraint/variable is identical (in a mathematical sense) with the constraint/variable cv.
virtual double rank ()
 The function should return a rank associated with the constraint/variable. The default implementation returns 0.
Constraints/Variables often have to be stored in a format different from the format used in the linear program. One reason is to save memory and the other reason is that if constraints and/or variable sets are dynamic, then we require a format to compute the coefficients of later activated variables/constraints.

The disadvantage of such a constraint format is that the computation of a single constraint coefficient can be very time consuming. Often it cannot be done in constant time. Hence we provide a mechanism which converts a constraint/variable to a format enabling efficient computation of coefficients. The following functions provide this feature.


bool expanded () const
void _expand ()
void _compress ()
virtual void print (ostream &out)

Protected Attributes

ABA_MASTERmaster_
const ABA_SUBsub_
 A pointer to the subproblem associated with the constraint/variable. This may be also the 0-pointer.
bool expanded_
int nReferences_
 The number of references to the pool slot the constraint is stored ABA_POOLSLOTREF.
bool dynamic_
 If this member is true then the constraint/variable can be also removed from the active formulation after it is added the first time. For constraints/variables which should be never removed from the active formulation this member should be set to false.
int nActive_
 The number of active subproblems of which the constraint/variable belongs to the set of active constraints/variables.
int nLocks_
bool local_
 This flag is true if the constraint/variable is only locally valid, otherwise it is false.

Private Member Functions

void activate ()
 Must be called if the constraint/variable is added to the active formulation of an active subproblem.
void deactivate ()
 Is the counterpart to activate() and is also called within members of the class ABA_SUB to indicate that the constraint/variable does not belong any more to the active formulation of an active subproblem.
int nReferences () const
 Returns the number of references to the pool slot ABA_POOLSLOTREF storing this constraint/variable.
void addReference ()
 Indicates that there is a new reference to the pool slot storing this constraint/variable.
void removeReference ()
 Is the counterpart of the function addReference() and indicates the removal of a reference to this constraint.
virtual bool deletable () const
virtual void expand ()
virtual void compress ()
If a constraint/variable has just been separated and added to the buffer of currently separated constraints/variables, then this item should not be removed before the buffer is emptied at the beginning of the next iteration. Hence, we provide a locking mechanism for constraints/variables by the following three functions.

bool locked () const
void lock ()
 Adds an additional lock to the constraint/variable.
void unlock ()

Friends

class ABA_POOLSLOT< ABA_CONSTRAINT, ABA_VARIABLE >
class ABA_POOLSLOT< ABA_VARIABLE, ABA_CONSTRAINT >
class ABA_POOLSLOTREF< ABA_CONSTRAINT, ABA_VARIABLE >
class ABA_POOLSLOTREF< ABA_VARIABLE, ABA_CONSTRAINT >
class ABA_STANDARDPOOL< ABA_CONSTRAINT, ABA_VARIABLE >
class ABA_STANDARDPOOL< ABA_VARIABLE, ABA_CONSTRAINT >
class ABA_CUTBUFFER< ABA_CONSTRAINT, ABA_VARIABLE >
class ABA_CUTBUFFER< ABA_VARIABLE, ABA_CONSTRAINT >
class ABA_SUB

Detailed Description

ABA_CONVAR is the common base class for constraints and variables, which are implemented in the derived classes ABA_CONSTRAINT and ABA_VARIABLE, respectively.

Definition at line 79 of file convar.h.


Constructor & Destructor Documentation

ABA_CONVAR::ABA_CONVAR ( ABA_MASTER master,
const ABA_SUB sub,
bool  dynamic,
bool  local 
)

The constructor.

Parameters:
master A pointer to the corresponding master of the optimization.
sub A pointer the subproblem the constraint/variable is associated with. If the item is not associated with any subproblem, then this can also be the 0-pointer.
dynamic If this paramument is true, then the constraint/variable can also be removed again from the set of active constraints/variables after it is added once.
local If local is true, then the constraint/variable is only locally valid.

virtual ABA_CONVAR::~ABA_CONVAR (  )  [virtual]

The destructor.


Member Function Documentation

bool ABA_CONVAR::active (  )  const [inline]

Checks if the constraint/variable is active in at least one active subproblem.

In the parallel implementation this can be more than one subproblem when multithreading occurs. Only those subproblems are taken into account which are related to the pool in which the constraint/variable is stored.

Returns:
true If the constraint/variable is active,

false otherwise.

Definition at line 467 of file convar.h.

bool ABA_CONVAR::local (  )  const [inline]

Returns:
true If the constraint/variable is only locally valid,

false otherwise.

Definition at line 499 of file convar.h.

bool ABA_CONVAR::global (  )  const [inline]

Returns:
true If the constraint/variable is globally valid,

false otherwise.

Definition at line 504 of file convar.h.

virtual bool ABA_CONVAR::dynamic (  )  const [virtual]

Returns:
true If the constraint/variable can be also removed from the set of active constraints/var\-i\-a\-bles after it has been activated,

false otherwise.

bool ABA_CONVAR::expanded (  )  const [inline]

Returns:
true If the expanded format of a constraint/variable is available,

false otherwise.

Definition at line 524 of file convar.h.

void ABA_CONVAR::_expand (  ) 

Tries to generate the expanded format of the constraint/variable.

This will be only possible if the virtual function expand() is redefined for the specific constraint/variable.

void ABA_CONVAR::_compress (  ) 

Removes the expanded format of the constraint/variable.

This will be only possible if the virtual function compress() is redefined for the specific constraint/variable.

virtual void ABA_CONVAR::print ( ostream &  out  )  [virtual]

The function writes the constraint/variable on the stream out.

This function is used since the output operator cannot be declared virtual. The default implementation writes "ABA_CONVAR::print() is only a dummy." on the stream out. We do not declare this function pure virtual since it is not really required, mainly only for debugging. In this case a constraint/variable specific redefinition is strongly recommended.

Normally, the implementation out << *this should be sufficient.

Parameters:
out The output stream.

Reimplemented in ABA_COLVAR, ABA_NUMCON, and ABA_ROWCON.

const ABA_SUB * ABA_CONVAR::sub (  )  const [inline]

Returns:
A pointer to the subproblem associated with the constraint/variable. Note, this can also be the 0-pointer.

Definition at line 514 of file convar.h.

void ABA_CONVAR::sub ( ABA_SUB sub  )  [inline]

This version of the function sub() associates a new subproblem with the constraint/variable.

Parameters:
sub The new subproblem associated with the constraint/variable.

Definition at line 519 of file convar.h.

virtual unsigned ABA_CONVAR::hashKey (  )  [virtual]

Should provide a key for the constraint/variable that can be used to insert it into a hash table.

As usual for hashing, it is not required that any two items have different keys.

This function is required if the constraint/variable is stored in a pool of the class ABA_NONDUPLPOOL.
The default implementation shows a warning and calls exit(). This function is not a pure virtual function because in the default version of \ it is not required.
We do not use double as result type because typical problems in floating point arithmetic might give slightly different hash keys for two constraints that are equal from a mathematical point of view.
The redundant return statement is required to suppress compiler warnings.
Returns:
An integer providing a hash key for the constraint/variable.

virtual const char* ABA_CONVAR::name (  )  [virtual]

Should return the name of the constraint/variable.

This function is required to emulate a simple run time type information (RTTI) that is still missing in /. This function will be removed as soon as RTTI is supported sufficiently.

A user must take care that for each redefined version of this function in a derived class a unique name is returned. Otherwise fatal run time errors can occur. Therefore, we recommend to return always the name of the class.
This function is required if the constraint/variable is stored in a pool of the class ABA_NONDUPLPOOL.
The default implementation shows a warning and calls exit(). This function is not a pure virtual function because in the default version of \ it is not required.
The redundant return statement is required to suppress compiler warnings.
Returns:
The name of the constraint/variable.

virtual bool ABA_CONVAR::equal ( ABA_CONVAR cv  )  [virtual]

Should compare if the constraint/variable is identical (in a mathematical sense) with the constraint/variable cv.

Using RTTI or its emulation provided by the function name()| it is sufficient to implement this functions for constraints/variables of the same type.

This function is required if the constraint/variable is stored in a pool of the class ABA_NONDUPLPOOL.
The default implementation shows a warning and calls exit(). This function is not a pure virtual function because in the default version of \ it is not required.

The redundant return statement is required to suppress compiler warnings.
Returns:
true If the constraint/variable represented by this object represents the same item as the constraint/variable cv,

false otherwise.

Parameters:
cv The constraint/variable that should be compared with this object.

virtual double ABA_CONVAR::rank (  )  [virtual]

The function should return a rank associated with the constraint/variable. The default implementation returns 0.

Returns:
The rank of the constraint/variable.

void ABA_CONVAR::activate (  )  [inline, private]

Must be called if the constraint/variable is added to the active formulation of an active subproblem.

This function is only called within member functions of the class ABA_SUB.

Definition at line 473 of file convar.h.

void ABA_CONVAR::deactivate (  )  [private]

Is the counterpart to activate() and is also called within members of the class ABA_SUB to indicate that the constraint/variable does not belong any more to the active formulation of an active subproblem.

int ABA_CONVAR::nReferences (  )  const [inline, private]

Returns the number of references to the pool slot ABA_POOLSLOTREF storing this constraint/variable.

We require the bookkeeping of the references in order to determine if a constraint/variable can be deleted without causing any harm.

Definition at line 478 of file convar.h.

void ABA_CONVAR::addReference (  )  [inline, private]

Indicates that there is a new reference to the pool slot storing this constraint/variable.

The function is only called from members of the class ABA_POOLSLOTREF.

Definition at line 483 of file convar.h.

void ABA_CONVAR::removeReference (  )  [private]

Is the counterpart of the function addReference() and indicates the removal of a reference to this constraint.

It is only called from members of the class ABA_POOLSLOTREF.

bool ABA_CONVAR::locked (  )  const [inline, private]

Returns:
true if at least one lock is set on the constraint/variable

false otherwise.

Definition at line 488 of file convar.h.

void ABA_CONVAR::lock (  )  [inline, private]

Adds an additional lock to the constraint/variable.

Definition at line 494 of file convar.h.

void ABA_CONVAR::unlock (  )  [private]

Removes one lock from the constraint/variable.

virtual bool ABA_CONVAR::deletable (  )  const [private, virtual]

Returns true if the constraint/variable can be destructed.

This is per default only possible if the reference counter is 0 and no lock is set. The function is declared virtual such that problem specific implementations are possible.

virtual void ABA_CONVAR::expand (  )  [private, virtual]

The default implementation of the function expand() is void. It should be redefined in derived classes.

virtual void ABA_CONVAR::compress (  )  [private, virtual]

Also the default implementation of the function compress() is void. It should be redefined in derived classes.


Friends And Related Function Documentation

friend class ABA_POOLSLOT< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 80 of file convar.h.

friend class ABA_POOLSLOT< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 81 of file convar.h.

friend class ABA_POOLSLOTREF< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 82 of file convar.h.

friend class ABA_POOLSLOTREF< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 83 of file convar.h.

friend class ABA_STANDARDPOOL< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 84 of file convar.h.

friend class ABA_STANDARDPOOL< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 85 of file convar.h.

friend class ABA_CUTBUFFER< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 86 of file convar.h.

friend class ABA_CUTBUFFER< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 87 of file convar.h.

friend class ABA_SUB [friend]

Definition at line 88 of file convar.h.


Member Data Documentation

ABA_MASTER* ABA_CONVAR::master_ [protected]

A pointer to the corresponding master of the optimization.

Definition at line 333 of file convar.h.

const ABA_SUB* ABA_CONVAR::sub_ [protected]

A pointer to the subproblem associated with the constraint/variable. This may be also the 0-pointer.

Definition at line 338 of file convar.h.

bool ABA_CONVAR::expanded_ [protected]

true, if expanded version of constraint/variables available.

Definition at line 342 of file convar.h.

int ABA_CONVAR::nReferences_ [protected]

The number of references to the pool slot the constraint is stored ABA_POOLSLOTREF.

Definition at line 347 of file convar.h.

bool ABA_CONVAR::dynamic_ [protected]

If this member is true then the constraint/variable can be also removed from the active formulation after it is added the first time. For constraints/variables which should be never removed from the active formulation this member should be set to false.

Definition at line 356 of file convar.h.

int ABA_CONVAR::nActive_ [protected]

The number of active subproblems of which the constraint/variable belongs to the set of active constraints/variables.

This value is always 0 after construction and has to be set and reset during the subproblem optimization. This member is mainly used to accelerate pool separation and to control that the same variable is not multiply included into a set of active variables.

Definition at line 368 of file convar.h.

int ABA_CONVAR::nLocks_ [protected]

The number of locks which have been set on the constraint/variable.

Definition at line 372 of file convar.h.

bool ABA_CONVAR::local_ [protected]

This flag is true if the constraint/variable is only locally valid, otherwise it is false.

Definition at line 377 of file convar.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