Implements a branching rule for setting a binary variable to its lower or upper bound.
More...
#include <ogdf/lib/abacus/setbranchrule.h>
|
static bool | ascii2bool (const string &str) |
| Converts the string str to a boolean value. More...
|
|
static bool | endsWith (const string &str, const string &end) |
| Returns true if str ends with end, false otherwise. More...
|
|
static double | fracPart (double x) |
| Returns the absolute value of the fractional part of x. More...
|
|
static const char * | onOff (bool value) |
| Converts a boolean variable to the strings "on" and "off". More...
|
|
Master * | master_ |
| A pointer to the corresponding master of the optimization. More...
|
|
Implements a branching rule for setting a binary variable to its lower or upper bound.
Definition at line 42 of file setbranchrule.h.
◆ SetBranchRule()
Creates a branching rule for setting binary variable according to status.
- Parameters
-
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.
◆ ~SetBranchRule()
virtual abacus::SetBranchRule::~SetBranchRule |
( |
| ) |
|
|
inlinevirtual |
◆ branchOnSetVar()
virtual bool abacus::SetBranchRule::branchOnSetVar |
( |
| ) |
|
|
inlineoverridevirtual |
Redefined for returning true, as this branching rule is setting a binary variable.
- Returns
- Always true.
Reimplemented from abacus::BranchRule.
Definition at line 98 of file setbranchrule.h.
◆ extract() [1/2]
virtual void abacus::SetBranchRule::extract |
( |
LpSub * |
lp | ) |
|
|
overridevirtual |
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.
- Parameters
-
lp | A pointer to the linear programming relaxation of a subproblem. |
Reimplemented from abacus::BranchRule.
◆ extract() [2/2]
virtual int abacus::SetBranchRule::extract |
( |
Sub * |
sub | ) |
|
|
overridevirtual |
Modifies a subproblem by setting the branching variable.
- Returns
- 0 If the subproblem can be modified according to the branching rule.
-
1 If a contradiction occurs.
- Parameters
-
sub | The subproblem being modified. |
Implements abacus::BranchRule.
◆ setToUpperBound()
bool abacus::SetBranchRule::setToUpperBound |
( |
| ) |
const |
|
inline |
Returns true if the branching variable is set to the upper bound, false otherwise.
Definition at line 104 of file setbranchrule.h.
◆ unExtract()
virtual void abacus::SetBranchRule::unExtract |
( |
LpSub * |
lp | ) |
|
|
overridevirtual |
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.
- Parameters
-
lp | A pointer to a the linear programming relaxtion of a subproblem. |
Reimplemented from abacus::BranchRule.
◆ variable()
int abacus::SetBranchRule::variable |
( |
| ) |
const |
|
inline |
Returns the number of the branching variable.
Definition at line 110 of file setbranchrule.h.
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const SetBranchRule & |
rhs |
|
) |
| |
|
friend |
Output operator for set branching rules.
Writes the number of the branching variable and its status to the output stream out.
- Parameters
-
out | The output stream. |
rhs | The branching rule being output. |
- Returns
- A reference to the output stream.
◆ oldLpBound_
double abacus::SetBranchRule::oldLpBound_ |
|
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.
◆ status_
◆ variable_
int abacus::SetBranchRule::variable_ |
|
private |
The documentation for this class was generated from the following file: