23 #ifndef AlpsSubTreePool_h_ 24 #define AlpsSubTreePool_h_ 43 if (!subTreeList_.
empty()) {
56 return std::make_pair( static_cast<AlpsKnowledge *>
69 subTreeList_.
push(st);
83 std::vector<AlpsSubTree* > treeVec = subTreeList_.
getContainer();
86 assert(subTreeList_.
size() == 0);
93 std::vector<AlpsSubTree* > subTreeVec = subTreeList_.
getContainer();
95 std::vector<AlpsSubTree* >::iterator pos1, pos2;
97 pos1 = subTreeVec.begin();
98 pos2 = subTreeVec.end();
100 for (; pos1 != pos2; ++pos1) {
101 (*pos1)->calculateQuality();
102 if ((*pos1)->getQuality() < quality) {
103 quality = (*pos1)->getQuality();
double getBestQuality()
Get the quality of the best subtree.
const std::vector< T > & getContainer() const
Return a const reference to the container.
void deleteGuts()
Delete the subtrees in the pool.
const AlpsPriorityQueue< AlpsSubTree * > & getSubTreeList() const
Return the container of subtrees.
The abstract base class of any user-defined class that Alps has to know about in order to encode/deco...
void pop()
Remove the top element from the heap.
void popKnowledge()
Remove a subtree from the pool.
std::pair< AlpsKnowledge *, double > getKnowledge() const
Get a subtree from subtree pool, doesn't remove it from the pool.
The subtree pool is used to store subtrees.
double getQuality() const
Get the quality of this subtree.
void addKnowledge(AlpsKnowledge *subTree, double priority)
Add a subtree to the subtree pool.
virtual ~AlpsSubTreePool()
void setComparison(AlpsSearchStrategy< AlpsSubTree *> &compare)
Set comparison function and resort heap.
void clear()
Remove all elements from the vector.
void push(T x)
Add a element to the heap.
bool hasKnowledge() const
Check whether there is a subtree in the subtree pool.
int getNumKnowledges() const
Query the number of subtrees in the pool.
bool empty() const
Return true for an empty vector.
This class contains the data pertaining to a particular subtree in the search tree.
void setComparison(AlpsSearchStrategy< T > &c)
Set comparison function and resort heap.
size_t size() const
Return the size of the vector.
T top() const
Return the top element of the heap.