6.6 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.

#include <convar.h>

Inheritance diagram for ABA_CONVAR::


PIC


Public Member Functions

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.

Protected Attributes

Private Member Functions

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.

Friends

6.6.1 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.

6.6.2 Constructor & Destructor Documentation

6.6.2.1 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.

6.6.2.2 virtual ABA_CONVAR::~ABA_CONVAR () [virtual]

The destructor.

6.6.3 Member Function Documentation

6.6.3.1 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.

6.6.3.2 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.

6.6.3.3 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.

6.6.3.4 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.

6.6.3.5 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.

6.6.3.6 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.

6.6.3.7 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.

6.6.3.8 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.

6.6.3.9 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.

6.6.3.10 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.

6.6.3.11 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.

6.6.3.12 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.

6.6.3.13 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.

6.6.3.14 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.

6.6.3.15 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.

6.6.3.16 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.

6.6.3.17 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.

6.6.3.18 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.

6.6.3.19 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.

6.6.3.20 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.

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

Adds an additional lock to the constraint/variable.

Definition at line 494 of file convar.h.

6.6.3.22 void ABA_CONVAR::unlock () [private]

Removes one lock from the constraint/variable.

6.6.3.23 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.

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

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

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

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

6.6.4 Friends And Related Function Documentation

6.6.4.1 friend class ABA_POOLSLOT< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 80 of file convar.h.

6.6.4.2 friend class ABA_POOLSLOT< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 81 of file convar.h.

6.6.4.3 friend class ABA_POOLSLOTREF< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 82 of file convar.h.

6.6.4.4 friend class ABA_POOLSLOTREF< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 83 of file convar.h.

6.6.4.5 friend class ABA_STANDARDPOOL< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 84 of file convar.h.

6.6.4.6 friend class ABA_STANDARDPOOL< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 85 of file convar.h.

6.6.4.7 friend class ABA_CUTBUFFER< ABA_CONSTRAINT, ABA_VARIABLE > [friend]

Definition at line 86 of file convar.h.

6.6.4.8 friend class ABA_CUTBUFFER< ABA_VARIABLE, ABA_CONSTRAINT > [friend]

Definition at line 87 of file convar.h.

6.6.4.9 friend class ABA_SUB [friend]

Definition at line 88 of file convar.h.

6.6.5 Member Data Documentation

6.6.5.1 ABA_MASTER*ABA_CONVAR::master_ [protected]

A pointer to the corresponding master of the optimization.

Definition at line 333 of file convar.h.

6.6.5.2 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.

6.6.5.3 bool ABA_CONVAR::expanded_ [protected]

true, if expanded version of constraint/variables available.

Definition at line 342 of file convar.h.

6.6.5.4 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.

6.6.5.5 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.

6.6.5.6 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.

6.6.5.7 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.

6.6.5.8 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: