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 void setSearchType(TreeSearchOrder newType);
40 TreeSearchOrder getSearchType() const;
41
43 bool anyActiveNodesLeft();
44
55 NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws);
56
61 UInt getActiveNodes() const;
62
64 double getCutOff();
65
71 double getPerGap();
72
82 double getLb();
83
85 double getUb();
86
91 UInt getSize() const;
92
102
108 void insertRoot(NodePtr node);
109
115 void pruneNode(NodePtr node);
116
123 void removeActiveNode(NodePtr node);
124
131 void setCutOff(double value);
132
141 void setUb(double value);
142
144 bool shouldDive();
145
155 double updateLb();
156
157 private:
159 ActiveNodeStorePtr activeNodes_;
160
163 NodePtr aNode_;
164
166 double bestLowerBound_;
167
169 double bestUpperBound_;
170
172 void clearAll();
173
175 double cutOff_;
176
178 bool doVbc_;
179
181 const double etol_;
182
184 TreeSearchOrder searchType_;
185
190 UInt size_;
191
193 Timer *timer_;
194
196 std::ofstream vbcFile_;
197
199 bool shouldPrune_(NodePtr node);
200
207 void insertCandidate_(NodePtr node, bool pop_now = false);
208
216 void removeNodeAndUp_(NodePtr node);
217
224 void removeNode_(NodePtr node);
225 };
226
228
229}
230#endif
231
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:119
void insertRoot(NodePtr node)
Insert the root node into the tree.
Definition: TreeManager.cpp:284
double getUb()
Return the best known upper bound.
Definition: TreeManager.cpp:254
double getLb()
Return the value of the highest lower bound evaluated in the last update of he bound.
Definition: TreeManager.cpp:242
double updateLb()
Recalculate and return the lower bound of the tree.
Definition: TreeManager.cpp:418
void setCutOff(double value)
Set the cut off value for the objective function.
Definition: TreeManager.cpp:382
NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws)
Branch and create new nodes.
Definition: TreeManager.cpp:125
UInt getSize() const
Return the size of the tree, including both active and processed nodes.
Definition: TreeManager.cpp:248
double getPerGap()
Return the gap between the lower and upper bound as a percentage. It is calculated as .
Definition: TreeManager.cpp:221
~TreeManager()
Destroy.
Definition: TreeManager.cpp:108
double getCutOff()
Return the cut off value. It is INFINITY if it is not set.
Definition: TreeManager.cpp:215
UInt getActiveNodes() const
Return the number of active nodes, i.e. nodes that have been created, but not processed yet.
Definition: TreeManager.cpp:184
void removeActiveNode(NodePtr node)
Remove a given active node from storage.
Definition: TreeManager.cpp:308
bool shouldDive()
Return true if the tree-manager recommends diving. False otherwise.
Definition: TreeManager.cpp:397
TreeManager(EnvPtr env)
Constructor.
Definition: TreeManager.cpp:25
void setSearchType(TreeSearchOrder newType)
Set the search type for the tree manager.
Definition: TreeManager.cpp:82
void setUb(double value)
Set the best known objective function value.
Definition: TreeManager.cpp:388
void pruneNode(NodePtr node)
Prune a given node from the tree.
Definition: TreeManager.cpp:301
NodePtr getCandidate()
Search for the best candidate that can be processed next.
Definition: TreeManager.cpp:190
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 Sun Jul 13 2025