Minotaur 0.4.1
Docs for developers
TreeManager.h
Go to the documentation of this file.
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2008 - 2025 The Minotaur Team.
5//
6
13#ifndef MINOTAURTREEMANAGER_H
14#define MINOTAURTREEMANAGER_H
15
16#include <iostream>
17#include <fstream>
18
19#include "Types.h"
20
21#include "ActiveNodeStore.h"
22#include "Environment.h"
23#include "Node.h"
24#include "WarmStart.h"
25
26namespace Minotaur {
27
30
31 public:
34
37
39 bool anyActiveNodesLeft();
40
51 NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws);
52
57 UInt getActiveNodes() const;
58
60 double getCutOff();
61
67 double getPerGap();
68
78 double getLb();
79
81 double getUb();
82
87 UInt getSize() const;
88
98
104 void insertRoot(NodePtr node);
105
111 void pruneNode(NodePtr node);
112
119 void removeActiveNode(NodePtr node);
120
127 void setCutOff(double value);
128
137 void setUb(double value);
138
140 bool shouldDive();
141
151 double updateLb();
152
153 private:
155 ActiveNodeStorePtr activeNodes_;
156
159 NodePtr aNode_;
160
162 double bestLowerBound_;
163
165 double bestUpperBound_;
166
168 void clearAll();
169
171 double cutOff_;
172
174 bool doVbc_;
175
177 const double etol_;
178
180 TreeSearchOrder searchType_;
181
186 UInt size_;
187
189 Timer *timer_;
190
192 std::ofstream vbcFile_;
193
195 bool shouldPrune_(NodePtr node);
196
203 void insertCandidate_(NodePtr node, bool pop_now = false);
204
212 void removeNodeAndUp_(NodePtr node);
213
220 void removeNode_(NodePtr node);
221 };
222
224
225}
226#endif
227
Declare the base class ActiveNodeStore for storing active nodes of the branch-and-bound tree.
Define the Environment class.
Define base class Node.
Declare important 'types' used in Minotaur.
Save and retrieve active nodes.
Definition: ActiveNodeStore.h:31
Definition: Environment.h:28
Definition: Node.h:54
Definition: Timer.h:40
Base class for managing the branch-and-bound tree.
Definition: TreeManager.h:29
bool anyActiveNodesLeft()
Return true if any active nodes remain in the tree. False otherwise.
Definition: TreeManager.cpp:89
void insertRoot(NodePtr node)
Insert the root node into the tree.
Definition: TreeManager.cpp:254
double getUb()
Return the best known upper bound.
Definition: TreeManager.cpp:224
double getLb()
Return the value of the highest lower bound evaluated in the last update of he bound.
Definition: TreeManager.cpp:212
double updateLb()
Recalculate and return the lower bound of the tree.
Definition: TreeManager.cpp:388
void setCutOff(double value)
Set the cut off value for the objective function.
Definition: TreeManager.cpp:352
NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws)
Branch and create new nodes.
Definition: TreeManager.cpp:95
UInt getSize() const
Return the size of the tree, including both active and processed nodes.
Definition: TreeManager.cpp:218
double getPerGap()
Return the gap between the lower and upper bound as a percentage. It is calculated as .
Definition: TreeManager.cpp:191
~TreeManager()
Destroy.
Definition: TreeManager.cpp:78
double getCutOff()
Return the cut off value. It is INFINITY if it is not set.
Definition: TreeManager.cpp:185
UInt getActiveNodes() const
Return the number of active nodes, i.e. nodes that have been created, but not processed yet.
Definition: TreeManager.cpp:154
void removeActiveNode(NodePtr node)
Remove a given active node from storage.
Definition: TreeManager.cpp:278
bool shouldDive()
Return true if the tree-manager recommends diving. False otherwise.
Definition: TreeManager.cpp:367
TreeManager(EnvPtr env)
Constructor.
Definition: TreeManager.cpp:25
void setUb(double value)
Set the best known objective function value.
Definition: TreeManager.cpp:358
void pruneNode(NodePtr node)
Prune a given node from the tree.
Definition: TreeManager.cpp:271
NodePtr getCandidate()
Search for the best candidate that can be processed next.
Definition: TreeManager.cpp:160
Definition: WarmStart.h:45
Definition: ActiveNodeStore.h:20
unsigned int UInt
Unsigned integer.
Definition: Types.h:30
TreeSearchOrder
Order of tree search.
Definition: Types.h:237

Minotaur source code documented by Doxygen 1.9.4 on Fri May 16 2025