Implements a branching rule for setting a binary variable to its lower or upper bound. More...
#include <ogdf/lib/abacus/setbranchrule.h>
Public Member Functions | |
SetBranchRule (Master *master, int variable, FSVarStat::STATUS status) | |
Creates a branching rule for setting binary variable according to status. | |
virtual | ~SetBranchRule () |
virtual bool | branchOnSetVar () override |
Redefined for returning true, as this branching rule is setting a binary variable. | |
virtual void | extract (LpSub *lp) override |
Overloaded to modify directly the linear programming relaxation. | |
virtual int | extract (Sub *sub) override |
Modifies a subproblem by setting the branching variable. | |
bool | setToUpperBound () const |
Returns true if the branching variable is set to the upper bound, false otherwise. | |
virtual void | unExtract (LpSub *lp) override |
Should undo the modifictions of the linear programming relaxtion |lp|. | |
int | variable () const |
Returns the number of the branching variable. | |
Public Member Functions inherited from abacus::BranchRule | |
BranchRule (Master *master) | |
Initializes a branching rule. | |
virtual | ~BranchRule () |
virtual void | initialize (Sub *sub) |
Called from the constructor of a subproblem. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
Private Attributes | |
double | oldLpBound_ |
The bound of the branching variable in the LP before it is temporarily modified for testing the quality of this branching rule. | |
FSVarStat::STATUS | status_ |
The status of the branching variable. | |
int | variable_ |
The branching variable. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const SetBranchRule &rhs) |
Output operator for set branching rules. | |
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 char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". | |
Protected Attributes inherited from abacus::BranchRule | |
Master * | master_ |
A pointer to the corresponding master of the optimization. | |
Implements a branching rule for setting a binary variable to its lower or upper bound.
Definition at line 42 of file setbranchrule.h.
|
inline |
Creates a branching rule for setting binary variable according to status.
master | A pointer to the corresponding master of the optimization. |
variable | The branching variable. |
status | The status the variable is set to (SetToLowerBound or SetToUpperBound). |
Definition at line 51 of file setbranchrule.h.
|
inlinevirtual |
Definition at line 55 of file setbranchrule.h.
Redefined for returning true, as this branching rule is setting a binary variable.
Reimplemented from abacus::BranchRule.
Definition at line 98 of file setbranchrule.h.
Overloaded to modify directly the linear programming relaxation.
This required to evaluate the quality of a branching rule with linear programming methods. The changes have to be undone with the function unextract() before the next linear program is solved.
lp | A pointer to the linear programming relaxation of a subproblem. |
Reimplemented from abacus::BranchRule.
Modifies a subproblem by setting the branching variable.
sub | The subproblem being modified. |
Implements abacus::BranchRule.
|
inline |
Returns true if the branching variable is set to the upper bound, false otherwise.
Definition at line 104 of file setbranchrule.h.
Should undo the modifictions of the linear programming relaxtion |lp|.
This function has to be redefined in a derived class if extract(LpSub*) is redefined there.
lp | A pointer to a the linear programming relaxtion of a subproblem. |
Reimplemented from abacus::BranchRule.
|
inline |
Returns the number of the branching variable.
Definition at line 110 of file setbranchrule.h.
|
friend |
Output operator for set branching rules.
Writes the number of the branching variable and its status to the output stream out.
out | The output stream. |
rhs | The branching rule being output. |
|
private |
The bound of the branching variable in the LP before it is temporarily modified for testing the quality of this branching rule.
The previous LP bound.
Definition at line 123 of file setbranchrule.h.
|
private |
The status of the branching variable.
Definition at line 117 of file setbranchrule.h.
|
private |
The branching variable.
Definition at line 116 of file setbranchrule.h.