Minotaur 0.4.1
Docs for developers
|
Base class for managing the branch-and-bound tree. More...
#include <TreeManager.h>
Public Member Functions | |
TreeManager (EnvPtr env) | |
Constructor. | |
~TreeManager () | |
Destroy. | |
bool | anyActiveNodesLeft () |
Return true if any active nodes remain in the tree. False otherwise. | |
NodePtr | branch (Branches branches, NodePtr node, WarmStartPtr ws) |
Branch and create new nodes. More... | |
UInt | getActiveNodes () const |
Return the number of active nodes, i.e. nodes that have been created, but not processed yet. | |
double | getCutOff () |
Return the cut off value. It is INFINITY if it is not set. | |
double | getPerGap () |
Return the gap between the lower and upper bound as a percentage. It is calculated as ![]() | |
double | getLb () |
Return the value of the highest lower bound evaluated in the last update of he bound. More... | |
double | getUb () |
Return the best known upper bound. | |
UInt | getSize () const |
Return the size of the tree, including both active and processed nodes. | |
NodePtr | getCandidate () |
Search for the best candidate that can be processed next. More... | |
void | insertRoot (NodePtr node) |
Insert the root node into the tree. More... | |
void | pruneNode (NodePtr node) |
Prune a given node from the tree. More... | |
void | removeActiveNode (NodePtr node) |
Remove a given active node from storage. More... | |
void | setCutOff (double value) |
Set the cut off value for the objective function. More... | |
void | setUb (double value) |
Set the best known objective function value. More... | |
bool | shouldDive () |
Return true if the tree-manager recommends diving. False otherwise. | |
double | updateLb () |
Recalculate and return the lower bound of the tree. More... | |
Base class for managing the branch-and-bound tree.
NodePtr TreeManager::branch | ( | Branches | branches, |
NodePtr | node, | ||
WarmStartPtr | ws | ||
) |
Branch and create new nodes.
[in] | branches | The branching constraints or bounds or disjunctions that are used to create the new nodes after branching. |
[in] | node | The node that we wish to branch upon. |
[in] | ws | The warm starting information that should be linked to in the new nodes. |
NodePtr TreeManager::getCandidate | ( | ) |
Search for the best candidate that can be processed next.
It may prune some of the nodes if their lower bound is more than the upper bound.
double TreeManager::getLb | ( | ) |
Return the value of the highest lower bound evaluated in the last update of he bound.
Since evaluating the lower bound may be expensive or certain types of tree-managers, it may be updated infrequently. Consquently, the value returned here may be lower than the actual lower bound of the tree. Also see updateLb().
void TreeManager::insertRoot | ( | NodePtr | node | ) |
Insert the root node into the tree.
[in] | node | The root node. |
void TreeManager::pruneNode | ( | NodePtr | node | ) |
Prune a given node from the tree.
[in] | node | The node that must be pruned. |
void TreeManager::removeActiveNode | ( | NodePtr | node | ) |
Remove a given active node from storage.
It should be called after the node has been processed.
[in] | node | The node to be removed from storage. |
void TreeManager::setCutOff | ( | double | value | ) |
Set the cut off value for the objective function.
Nodes with lower bound can be pruned.
[in] | value | The cut off value. It can be INFINITY. |
void TreeManager::setUb | ( | double | value | ) |
Set the best known objective function value.
The function does NOT check if the given value is better than the previous. So care should be taken to pass only the best known value. It also updates the cutoff value that is used to prune nodes.
[in] | value | The best known upper bound. |
double TreeManager::updateLb | ( | ) |
Recalculate and return the lower bound of the tree.
If the active nodes are stored in a heap, nothing really needs to be done. For other types of storage, this operation may be expensive. The result is cached into bestLowerBound_.