Minotaur 0.4.1
Docs for developers
NodeStack.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
15#ifndef MINOTAURNODESTACK_H
16#define MINOTAURNODESTACK_H
17
18#include "ActiveNodeStore.h"
19
20namespace Minotaur {
21
22 typedef std::deque<NodePtr> NodePtrStack;
23 typedef NodePtrStack::iterator NodeStackIter;
24 typedef NodePtrStack::const_iterator NodeStackConstIter;
25
31 class NodeStack : public ActiveNodeStore {
32
33 public:
35 NodeStack();
36
38 virtual ~NodeStack();
39
44 virtual bool isEmpty() const;
45
51 virtual double getBestLB() const;
52
54 virtual UInt getDeepestLevel() const;
55
57 virtual void pop();
58
60 virtual void write(std::ostream &out) const;
61
63 virtual void push(NodePtr n);
64
66 virtual NodePtr top() const { return (nodes_.front()); }
67
69 virtual size_t getSize() const { return (nodes_.size()); }
70
72 NodeStackIter nodesBegin();
73
75 NodeStackIter nodesEnd();
76
77 private:
79 NodePtrStack nodes_;
80 };
81 typedef NodeStack *NodeStackPtr;
82} //namespace Minotaur
83#endif
Declare the base class ActiveNodeStore for storing active nodes of the branch-and-bound tree.
Save and retrieve active nodes.
Definition: ActiveNodeStore.h:31
Definition: NodeStack.h:31
virtual void write(std::ostream &out) const
Write in order the node ID and the depth of each active node.
Definition: NodeStack.cpp:78
virtual void pop()
Remove the best node from the heap.
Definition: NodeStack.cpp:65
virtual bool isEmpty() const
Return true if there are no active nodes in the heap, otherwise return false.
Definition: NodeStack.cpp:35
virtual UInt getDeepestLevel() const
The maximum depth is the depth of the topmost node in the stack.
Definition: NodeStack.cpp:58
virtual void push(NodePtr n)
Add a node to the set of active nodes.
Definition: NodeStack.cpp:71
NodeStackIter nodesBegin()
Get iterator to the first node in the heap.
NodeStackIter nodesEnd()
Get iterator to the last node in the heap.
virtual double getBestLB() const
Find the minimum lower bound of all the active nodes in the stack. This function is expensive and mus...
Definition: NodeStack.cpp:42
NodeStack()
Constructor.
Definition: NodeStack.cpp:23
virtual size_t getSize() const
Get the number of active nodes in the heap.
Definition: NodeStack.h:69
virtual NodePtr top() const
Get access to the best node in this heap.
Definition: NodeStack.h:66
virtual ~NodeStack()
Destroy.
Definition: NodeStack.cpp:29
Definition: Node.h:54
Definition: ActiveNodeStore.h:20
unsigned int UInt
Unsigned integer.
Definition: Types.h:30

Minotaur source code documented by Doxygen 1.9.4 on Thu Apr 24 2025