|
| ConVar (Master *master, const Sub *sub, bool dynamic, bool local) |
| Creates an instance of type ConVar.
|
|
virtual | ~ConVar () |
|
bool | active () const |
| Checks if the constraint/variable is active in at least one active subproblem.
|
|
virtual bool | dynamic () const |
| Return true if the constraint/variable is dynamic.
|
|
virtual bool | equal (const ConVar *cv) const |
| Should compare if the constraint/variable is identical (in a mathematical sense) with the constraint/variable cv.
|
|
bool | global () const |
| Returns true if the constraint/variable is globally valid, false otherwise.
|
|
virtual unsigned | hashKey () const |
| Should provide a key for the constraint/variable that can be used to insert it into a hash table.
|
|
bool | local () const |
| Returns true if the constraint/variable is only locally valid, false otherwise.
|
|
virtual const char * | name () const |
| Should return the name of the constraint/variable.
|
|
virtual void | print (std::ostream &out) const |
| Writes the constraint/variable to the output stream out.
|
|
virtual double | rank () const |
| The function should return a rank associated with the constraint/variable.
|
|
const Sub * | sub () const |
| Returns a const pointer to the subproblem associated with the constraint/variable.
|
|
void | sub (Sub *sub) |
| Associates a new subproblem with the constraint/variable.
|
|
|
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 |
| Returns true if the expanded format of a constraint/variable is available, false otherwise.
|
|
virtual void | expand () const |
| Expands a constraint/variable.
|
|
virtual void | compress () const |
| Compresses a constraint/variable.
|
|
virtual bool | deletable () const |
| Returns true if the constraint/variable can be destructed.
|
|
virtual | ~AbacusRoot () |
| The destructor.
|
|
|
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.
|
|
bool | expanded_ |
| true, if expanded version of constraint/variables available.
|
|
bool | local_ |
| true if the constraint/variable is only locally valid
|
|
Master * | master_ |
| A pointer to the corresponding master of the optimization.
|
|
int | nActive_ |
| The number of active subproblems of which the constraint/variable belongs to the set of active constraints/variables.
|
|
int | nLocks_ |
| The number of locks which have been set on the constraint/variable.
|
|
int | nReferences_ |
| The number of references to the pool slot the constraint is stored in.
|
|
const Sub * | sub_ |
| A pointer to the subproblem associated with the constraint/variable.
|
|
|
void | _compress () const |
| Removes the expanded format of the constraint/variable.
|
|
void | _expand () const |
| Tries to generate the expanded format of the constraint/variable.
|
|
void | activate () |
| Must be called if the constraint/variable is added to the active formulation of an active subproblem.
|
|
void | addReference () |
| Indicates that there is a new reference to the pool slot storing this constraint/variable.
|
|
void | deactivate () |
| Counterpart of activate().
|
|
int | nReferences () const |
| Returns the number of references to the pool slot PoolSlotRef storing this constraint/variable.
|
|
void | removeReference () |
| Is the counterpart of the function addReference() and indicates the removal of a reference to this constraint.
|
|
|
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 |
| Returns true if at least one lock is set on the constraint/variable, false otherwise.
|
|
void | lock () |
| Adds an additional lock to the constraint/variable.
|
|
void | unlock () |
| Removes one lock from the constraint/variable.
|
|
Common base class for constraints (Constraint) and variables (Variable).
ConVar is the common base class for constraints and variables, which are implemented in the derived classes Constraint and Variable, respectively. It might seem a bit strange to implement a common base class for these two objects. Besides several technical reasons, there is linear programming duality which motivates this point of view. E.g., the separation problem for the primal problem is equivalent to the pricing problem for the dual problem.
ConVar is not the base class for constraints and variables as they are used in the interface to the linear programming solver. There are the classes Row and Column for this purpose. ConVar is the father of a class hierarchy for abstract constraints and variables which are used in the branch-and-bound algorithm.
Definition at line 65 of file convar.h.
Compresses a constraint/variable.
The default implementation does nothing. It should be redefined in derived classes. Attention: Data that is compacted/compressed needs to be marked as mutable, as this function is supposed to be applicable for const objects! Compressing/expanding is NOT expected to change the "outer" status of this class, and compression/expansion is done automatically on the fly on an as-needed basis.
Definition at line 167 of file convar.h.
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 NonDuplPool.
The default implementation shows a warning and throws an exception. This function is not a pure virtual function because in the default version of ABACUS it is not required.
- Parameters
-
cv | The constraint/variable that should be compared with this object. |
- Returns
- true If the constraint/variable represented by this object represents the same item as the constraint/variable cv, false otherwise.
Expands a constraint/variable.
The default implementation does nothing. It should be redefined in derived classes. Attention: Data that is compacted/compressed needs to be marked as mutable, as this function is supposed to be applicable for const objects! Compressing/expanding is NOT expected to change the "outer" status of this class, and compression/expansion is done automatically on the fly on an as-needed basis.
Definition at line 157 of file convar.h.
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 NonDuplPool.
The default implementation just throws an exception. This function is not a pure virtual function because in the default version of ABACUS 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.
- Returns
- An integer providing a hash key for the constraint/variable.
Reimplemented in ogdf::MinSteinerTreeDirectedCut< T >::DirectedCutConstraint.
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 g++. 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 NonDuplPool.
The default implementation shows a warning and throws an exception. This function is not a pure virtual function because in the default version of ABACUS it is not required.
- Returns
- The name of the constraint/variable.
Reimplemented in ogdf::MinSteinerTreeDirectedCut< T >::DirectedCutConstraint.
virtual void abacus::ConVar::print |
( |
std::ostream & |
out | ) |
const |
|
virtual |
Writes the constraint/variable to the output stream out.
This function is used since the output operator cannot be declared virtual. The default implementation only writes "ConVar::print() is only a dummy."
. 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
-
Reimplemented in abacus::ColVar, abacus::NumCon, and abacus::RowCon.