Minotaur 0.4.1
Docs for developers
|
Implement a generic branch-and-bound algorithm on a single cpu. More...
#include <BranchAndBound.h>
Public Member Functions | |
BranchAndBound () | |
Default constructor. | |
BranchAndBound (EnvPtr env, ProblemPtr problem) | |
Constructor for a given Problem and Environment. | |
virtual | ~BranchAndBound () |
Destroy. | |
void | addPreRootHeur (HeurPtr h) |
Add a heuristic that will be called before root node. More... | |
double | getPerGap () |
Return the percentage gap between the lower and upper bounds. More... | |
double | getLb () |
Return the lower bound from the search tree. More... | |
NodeProcessorPtr | getNodeProcessor () |
Return a pointer to NodeProcessor used in branch-and-bound. | |
NodeRelaxerPtr | getNodeRelaxer () |
Return a pointer to NodeRelaxer used in branch-and-bound. | |
SolutionPtr | getSolution () |
SolveStatus | getStatus () |
Return the final status. | |
TreeManagerPtr | getTreeManager () |
Return a pointer to the tree manager. The client can then directly query the TreeManager for its size and other attributes. | |
double | getUb () |
Return the upper bound for the solution value from the search tree. More... | |
UInt | numProcNodes () |
Return number of nodes processed while solving. | |
void | setLogLevel (LogLevel level) |
Set log level. More... | |
void | setNodeProcessor (NodeProcessorPtr p) |
Set the NodeProcessor that processes each node. More... | |
void | setNodeRelaxer (NodeRelaxerPtr nr) |
Set the NodeRelaxer for setting-up relaxations at each node. More... | |
void | shouldCreateRoot (bool b) |
Switch to turn on/off root-node creation. More... | |
void | solve () |
Start solving the Problem using branch-and-bound. | |
double | totalTime () |
Return total time taken. | |
void | writeStats (std::ostream &out) |
Write statistics to the ostream out. | |
void | writeStats () |
Write statistics to the logger. | |
Implement a generic branch-and-bound algorithm on a single cpu.
void BranchAndBound::addPreRootHeur | ( | HeurPtr | h | ) |
Add a heuristic that will be called before root node.
[in] | h | The heuristic that should be called. This heuristic will be called after all previously added heuristic. |
double BranchAndBound::getLb | ( | ) |
Return the lower bound from the search tree.
This bound is defined as the minimum of the bounds from all active nodes. It may not be a bound on the optimal solution value.
double BranchAndBound::getPerGap | ( | ) |
Return the percentage gap between the lower and upper bounds.
Gap percentage is calculated as , where
is the upper bound,
is the lower bound and
is a small constant to avoid division by zero.
double BranchAndBound::getUb | ( | ) |
Return the upper bound for the solution value from the search tree.
This bound may or may not correspond to a feasible solution of the problem. It may be obtained from a feasible solution of a relaxation of the problem.
void BranchAndBound::setLogLevel | ( | LogLevel | level | ) |
Set log level.
[in] | level | The desired log level for this class. |
void BranchAndBound::setNodeProcessor | ( | NodeProcessorPtr | p | ) |
Set the NodeProcessor that processes each node.
[in] | p | The desired node-processor. |
void BranchAndBound::setNodeRelaxer | ( | NodeRelaxerPtr | nr | ) |
Set the NodeRelaxer for setting-up relaxations at each node.
[in] | nr | The desired node-relaxer. |
void BranchAndBound::shouldCreateRoot | ( | bool | b | ) |
Switch to turn on/off root-node creation.
Sometimes a client may set up a root node on its own and may not want the default root node.
[in] | b | True if root node should be created, false otherwise. |