Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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.
 
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 charonOff (bool value)
 Converts a boolean variable to the strings "on" and "off".
 
- Protected Attributes inherited from abacus::BranchRule
Mastermaster_
 A pointer to the corresponding master of the optimization.
 

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 Symbol 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: