MAiNGO
babBase::BabNode Class Reference

Class representing a node in the Branch-and-Bound tree. More...

#include <babNode.h>

Public Member Functions

 BabNode (double pruningScoreIn, const std::vector< double > &lbdsIn, const std::vector< double > &ubdsIn, const int idIn, const unsigned depthIn, const bool holdsIncumbent)
 Constructor for initializing a BabNode using separate vectors containing the bounds. More...
 
 BabNode (double pruningScoreIn, const std::vector< OptimizationVariable > &variablesIn, const int idIn, const unsigned depthIn, const bool holdsIncumbent)
 Constructor for initializing a BabNode using a vector of OptimizationVariable (each of which contains a Bounds object). Used to initialize the root node. More...
 
 BabNode ()
 Default constructor. More...
 
double get_pruning_score () const
 Function for querying the pruning score within this node. More...
 
void set_pruning_score (double pruningScoreIn)
 Function for setting the pruning score within this node. More...
 
std::vector< double > get_lower_bounds () const
 Function for querying the lower bounds on the optimization variables within this node. More...
 
std::vector< double > get_upper_bounds () const
 Function for querying the upper bounds on the optimization variables within this node. More...
 
int get_ID () const
 Function for querying the node ID. More...
 
int get_depth () const
 Function for querying the node depth. More...
 
bool holds_incumbent () const
 Function obtaining information whether the node holds the incumbent. More...
 
void set_holds_incumbent (const bool holdsIncumbent)
 Function for setting the _holdsIncumbent variable. More...
 
void set_upper_bound (const std::vector< double > upperBounds)
 Function for setting the whole upper bound vector. More...
 
void set_upper_bound (const unsigned iVar, const double value)
 Function for setting the whole upper bound vector. More...
 
void set_lower_bound (const std::vector< double > lowerBounds)
 Function for setting the whole upper bound vector. More...
 
void set_lower_bound (const unsigned iVar, const double value)
 Function for setting the whole upper bound vector. More...
 

Private Attributes

Internal variables of a B&B node
std::vector< double > _lowerBounds
 
std::vector< double > _upperBounds
 
int _idNumber
 
unsigned _depth
 
double _pruningScore
 
bool _holdsIncumbent
 

Friends

std::ostream & operator<< (std::ostream &out, const BabNode &node)
 Overloaded operator for easier output. Definition of this operator is in bab.cpp. More...
 

Detailed Description

Class representing a node in the Branch-and-Bound tree.

A BabNode is characterized by a vector containing the configuration for optimization variables (bounds etc.) in this node, as well as an ID (both private members). It also contains a pruning score and a flag that indicates whether it holds the incumbent. Once constructed, a BabNode cannot be modified.

Constructor & Destructor Documentation

◆ BabNode() [1/3]

babBase::BabNode::BabNode ( double  pruningScoreIn,
const std::vector< double > &  lbdsIn,
const std::vector< double > &  ubdsIn,
const int  idIn,
const unsigned  depthIn,
const bool  holdsIncumbent 
)
inline

Constructor for initializing a BabNode using separate vectors containing the bounds.

Parameters
[in]pruningScoreInis the score of the node with respect to its pruning rule, a pruning score higher than a certain threshold will lead to pruning of the node
[in]lbdsInis a vector containing the lower bounds on the optimization variables for this node
[in]ubdsInis a vector containing the upper bounds on the optimization variables for this node
[in]idInis the ID to be associated with this node
[in]depthInis the depth of the node in the tree
[in]holdsIncumbenttells whether the node holds the current incumbent

◆ BabNode() [2/3]

babBase::BabNode::BabNode ( double  pruningScoreIn,
const std::vector< OptimizationVariable > &  variablesIn,
const int  idIn,
const unsigned  depthIn,
const bool  holdsIncumbent 
)
inline

Constructor for initializing a BabNode using a vector of OptimizationVariable (each of which contains a Bounds object). Used to initialize the root node.

Parameters
[in]pruningScoreInis the score of the node with respect to its pruning rule, a pruning score higher than a certain threshold will lead to pruning of the node
[in]variablesInis a vector containing the optimization variables
[in]idInis the ID to be associated with this node
[in]depthInis the depth of the node in the tree
[in]holdsIncumbenttells whether the node holds the current incumbent

◆ BabNode() [3/3]

babBase::BabNode::BabNode ( )
inline

Default constructor.

Member Function Documentation

◆ get_depth()

int babBase::BabNode::get_depth ( ) const
inline

Function for querying the node depth.

◆ get_ID()

int babBase::BabNode::get_ID ( ) const
inline

Function for querying the node ID.

◆ get_lower_bounds()

std::vector<double> babBase::BabNode::get_lower_bounds ( ) const
inline

Function for querying the lower bounds on the optimization variables within this node.

◆ get_pruning_score()

double babBase::BabNode::get_pruning_score ( ) const
inline

Function for querying the pruning score within this node.

◆ get_upper_bounds()

std::vector<double> babBase::BabNode::get_upper_bounds ( ) const
inline

Function for querying the upper bounds on the optimization variables within this node.

◆ holds_incumbent()

bool babBase::BabNode::holds_incumbent ( ) const
inline

Function obtaining information whether the node holds the incumbent.

◆ set_holds_incumbent()

void babBase::BabNode::set_holds_incumbent ( const bool  holdsIncumbent)
inline

Function for setting the _holdsIncumbent variable.

◆ set_lower_bound() [1/2]

void babBase::BabNode::set_lower_bound ( const std::vector< double >  lowerBounds)
inline

Function for setting the whole upper bound vector.

◆ set_lower_bound() [2/2]

void babBase::BabNode::set_lower_bound ( const unsigned  iVar,
const double  value 
)
inline

Function for setting the whole upper bound vector.

◆ set_pruning_score()

void babBase::BabNode::set_pruning_score ( double  pruningScoreIn)
inline

Function for setting the pruning score within this node.

◆ set_upper_bound() [1/2]

void babBase::BabNode::set_upper_bound ( const std::vector< double >  upperBounds)
inline

Function for setting the whole upper bound vector.

◆ set_upper_bound() [2/2]

void babBase::BabNode::set_upper_bound ( const unsigned  iVar,
const double  value 
)
inline

Function for setting the whole upper bound vector.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const BabNode node 
)
friend

Overloaded operator for easier output. Definition of this operator is in bab.cpp.

Parameters
[out]outis the outstream to be written to
[in]nodeis the B&B node to be printed

Member Data Documentation

◆ _depth

unsigned babBase::BabNode::_depth
private

Depth of this node in the B&B tree

◆ _holdsIncumbent

bool babBase::BabNode::_holdsIncumbent
private

Variable telling whether this nodes holds the current incumbent

◆ _idNumber

int babBase::BabNode::_idNumber
private

Node ID

◆ _lowerBounds

std::vector<double> babBase::BabNode::_lowerBounds
private

Lower bounds on optimization variables within this node

◆ _pruningScore

double babBase::BabNode::_pruningScore
private

PruningScore: if PruningScore is higher than a PruningThreshold, the node will be fathomed by and from the BAB-Tree

◆ _upperBounds

std::vector<double> babBase::BabNode::_upperBounds
private

Upper bounds on optimization variables within this node


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