Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

abacus::SetBranchRule Class Reference

Implements a branching rule for setting a binary variable to its lower or upper bound. More...

#include <ogdf/lib/abacus/setbranchrule.h>

+ Inheritance diagram for abacus::SetBranchRule:

Public Member Functions

 SetBranchRule (Master *master, int variable, FSVarStat::STATUS status)
 Creates a branching rule for setting binary variable according to status. More...
 
virtual ~SetBranchRule ()
 
virtual bool branchOnSetVar () override
 Redefined for returning true, as this branching rule is setting a binary variable. More...
 
virtual void extract (LpSub *lp) override
 Overloaded to modify directly the linear programming relaxation. More...
 
virtual int extract (Sub *sub) override
 Modifies a subproblem by setting the branching variable. More...
 
bool setToUpperBound () const
 Returns true if the branching variable is set to the upper bound, false otherwise. More...
 
virtual void unExtract (LpSub *lp) override
 Should undo the modifictions of the linear programming relaxtion |lp|. More...
 
int variable () const
 Returns the number of the branching variable. More...
 
- Public Member Functions inherited from abacus::BranchRule
 BranchRule (Master *master)
 Initializes a branching rule. More...
 
virtual ~BranchRule ()
 
virtual void initialize (Sub *sub)
 Called from the constructor of a subproblem. More...
 
- Public Member Functions inherited from abacus::AbacusRoot
virtual ~AbacusRoot ()
 The destructor. More...
 

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. More...
 
FSVarStat::STATUS status_
 The status of the branching variable. More...
 
int variable_
 The branching variable. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const SetBranchRule &rhs)
 Output operator for set branching rules. More...
 

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. 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...
 
- Protected Attributes inherited from abacus::BranchRule
Mastermaster_
 A pointer to the corresponding master of the optimization. More...
 

Detailed Description

Implements a branching rule for setting a binary variable to its lower or upper bound.

Definition at line 42 of file setbranchrule.h.

Constructor & Destructor Documentation

◆ SetBranchRule()

abacus::SetBranchRule::SetBranchRule ( Master master,
int  variable,
FSVarStat::STATUS  status 
)
inline

Creates a branching rule for setting binary variable according to status.

Parameters
masterA pointer to the corresponding master of the optimization.
variableThe branching variable.
statusThe status the variable is set to (SetToLowerBound or SetToUpperBound).

Definition at line 51 of file setbranchrule.h.

◆ ~SetBranchRule()

virtual abacus::SetBranchRule::~SetBranchRule ( )
inlinevirtual

Definition at line 55 of file setbranchrule.h.

Member Function Documentation

◆ 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
lpA 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
    subThe 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
lpA 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.

Friends And Related Function Documentation

◆ 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
outThe output stream.
rhsThe branching rule being output.
Returns
A reference to the output stream.

Member Data Documentation

◆ 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_

FSVarStat::STATUS abacus::SetBranchRule::status_
private

The status of the branching variable.

Definition at line 117 of file setbranchrule.h.

◆ variable_

int abacus::SetBranchRule::variable_
private

The branching variable.

Definition at line 116 of file setbranchrule.h.


The documentation for this class was generated from the following file: