Minotaur 0.4.1
Docs for developers
ParTreeManager.h
1//
2// Minotaur -- It's only 1/2 bull
3//
4// (C)opyright 2008 - 2025 The Minotaur Team.
5//
6
13#ifndef MINOTAURPARTREEMANAGER_H
14#define MINOTAURPARTREEMANAGER_H
15
16#include <iostream>
17#include <fstream>
18
19#include "Types.h"
20
21namespace Minotaur {
22
23 class ActiveNodeStore;
24 class WarmStart;
25 typedef ActiveNodeStore* ActiveNodeStorePtr;
26 typedef WarmStart* WarmStartPtr;
27
30
31 public:
32 friend class ParBranchAndBound;
33 friend class ParQGBranchAndBound;
34
37
40
42 bool anyActiveNodesLeft();
43
54 NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws);
55
60 UInt getActiveNodes() const;
61
63 double getCutOff();
64
70 double getPerGap();
71
80 double getPerGapPar(double treeLb);
81
91 double getLb();
92
94 double getUb();
95
100 UInt getSize() const;
101
111
117 void insertRoot(NodePtr node);
118
124 void pruneNode(NodePtr node);
125
132 void removeActiveNode(NodePtr node);
133
140 void setCutOff(double value);
141
150 void setUb(double value);
151
153 bool shouldDive();
154
164 double updateLb();
165
166 private:
168 ActiveNodeStorePtr activeNodes_;
169
172 NodePtr aNode_;
173
175 double bestLowerBound_;
176
178 double bestUpperBound_;
179
181 void clearAll();
182
184 double cutOff_;
185
187 bool doVbc_;
188
190 const double etol_;
191
193 TreeSearchOrder searchType_;
194
199 UInt size_;
200
202 Timer *timer_;
203
205 std::string tbRule_;
206
208 std::ofstream vbcFile_;
209
211 bool shouldPrune_(NodePtr node);
212
219 void insertCandidate_(NodePtr node, bool pop_now = false);
220
228 void removeNodeAndUp_(NodePtr node);
229
230
237 void removeNode_(NodePtr node);
238 };
239
241
242}
243#endif
244
Declare important 'types' used in Minotaur.
Save and retrieve active nodes.
Definition: ActiveNodeStore.h:31
Definition: Environment.h:28
Definition: Node.h:54
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: ParBranchAndBound.h:48
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: ParQGBranchAndBound.h:48
Base class for managing the branch-and-bound tree.
Definition: ParTreeManager.h:29
void pruneNode(NodePtr node)
Prune a given node from the tree.
Definition: ParTreeManager.cpp:317
NodePtr branch(Branches branches, NodePtr node, WarmStartPtr ws)
Branch and create new nodes.
Definition: ParTreeManager.cpp:100
double getUb()
Return the best known upper bound.
Definition: ParTreeManager.cpp:250
bool anyActiveNodesLeft()
Return true if any active nodes remain in the tree. False otherwise.
Definition: ParTreeManager.cpp:94
double getLb()
Return the value of the highest lower bound evaluated in the last update of he bound.
Definition: ParTreeManager.cpp:238
~ParTreeManager()
Destroy.
Definition: ParTreeManager.cpp:83
void setUb(double value)
Set the best known objective function value.
Definition: ParTreeManager.cpp:404
void insertRoot(NodePtr node)
Insert the root node into the tree.
Definition: ParTreeManager.cpp:300
double updateLb()
Recalculate and return the lower bound of the tree.
Definition: ParTreeManager.cpp:434
UInt getActiveNodes() const
Return the number of active nodes, i.e. nodes that have been created, but not processed yet.
Definition: ParTreeManager.cpp:159
double getCutOff()
Return the cut off value. It is INFINITY if it is not set.
Definition: ParTreeManager.cpp:190
void removeActiveNode(NodePtr node)
Remove a given active node from storage.
Definition: ParTreeManager.cpp:324
double getPerGap()
Return the gap between the lower and upper bound as a percentage. It is calculated as .
Definition: ParTreeManager.cpp:196
double getPerGapPar(double treeLb)
Return the gap between the lower and upper bound as a percentage, given a lower bound,...
Definition: ParTreeManager.cpp:216
NodePtr getCandidate()
Search for the best candidate that can be processed next.
Definition: ParTreeManager.cpp:165
void setCutOff(double value)
Set the cut off value for the objective function.
Definition: ParTreeManager.cpp:398
UInt getSize() const
Return the size of the tree, including both active and processed nodes.
Definition: ParTreeManager.cpp:244
bool shouldDive()
Return true if the tree-manager recommends diving. False otherwise.
Definition: ParTreeManager.cpp:413
ParTreeManager(EnvPtr env)
Constructor.
Definition: ParTreeManager.cpp:29
Definition: Timer.h:40
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 Thu Apr 24 2025