#include <convar.h>
Inheritance diagram for ABA_CONVAR:
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_SUB * | sub () 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.
| |
bool | expanded () const |
void | _expand () |
void | _compress () |
virtual void | print (ostream &out) |
Protected Attributes | |
ABA_MASTER * | master_ |
const ABA_SUB * | sub_ |
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 |
Definition at line 79 of file convar.h.
ABA_CONVAR::ABA_CONVAR | ( | ABA_MASTER * | master, | |
const ABA_SUB * | sub, | |||
bool | dynamic, | |||
bool | local | |||
) |
The constructor.
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.
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.
false otherwise.
bool ABA_CONVAR::local | ( | ) | const [inline] |
bool ABA_CONVAR::global | ( | ) | const [inline] |
virtual bool ABA_CONVAR::dynamic | ( | ) | const [virtual] |
false otherwise.
bool ABA_CONVAR::expanded | ( | ) | const [inline] |
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.
out | The output stream. |
Reimplemented in ABA_COLVAR, ABA_NUMCON, and ABA_ROWCON.
const ABA_SUB * ABA_CONVAR::sub | ( | ) | const [inline] |
void ABA_CONVAR::sub | ( | ABA_SUB * | sub | ) | [inline] |
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.
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.
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.
false otherwise.
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.
void ABA_CONVAR::activate | ( | ) | [inline, private] |
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.
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.
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] |
void ABA_CONVAR::lock | ( | ) | [inline, private] |
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.
friend class ABA_POOLSLOT< ABA_CONSTRAINT, ABA_VARIABLE > [friend] |
friend class ABA_POOLSLOT< ABA_VARIABLE, ABA_CONSTRAINT > [friend] |
friend class ABA_POOLSLOTREF< ABA_CONSTRAINT, ABA_VARIABLE > [friend] |
friend class ABA_POOLSLOTREF< ABA_VARIABLE, ABA_CONSTRAINT > [friend] |
friend class ABA_STANDARDPOOL< ABA_CONSTRAINT, ABA_VARIABLE > [friend] |
friend class ABA_STANDARDPOOL< ABA_VARIABLE, ABA_CONSTRAINT > [friend] |
friend class ABA_CUTBUFFER< ABA_CONSTRAINT, ABA_VARIABLE > [friend] |
friend class ABA_CUTBUFFER< ABA_VARIABLE, ABA_CONSTRAINT > [friend] |
ABA_MASTER* ABA_CONVAR::master_ [protected] |
const ABA_SUB* ABA_CONVAR::sub_ [protected] |
bool ABA_CONVAR::expanded_ [protected] |
int ABA_CONVAR::nReferences_ [protected] |
The number of references to the pool slot the constraint is stored ABA_POOLSLOTREF.
bool ABA_CONVAR::dynamic_ [protected] |
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.
int ABA_CONVAR::nLocks_ [protected] |
bool ABA_CONVAR::local_ [protected] |