Alps  2.0.2
AlpsSubTreePool.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the Abstract Library for Parallel Search (ALPS). *
3  * *
4  * ALPS is distributed under the Eclipse Public License as part of the *
5  * COIN-OR repository (http://www.coin-or.org). *
6  * *
7  * Authors: *
8  * *
9  * Yan Xu, Lehigh University *
10  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2023, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 #ifndef AlpsSubTreePool_h_
28 #define AlpsSubTreePool_h_
29 
30 #include "AlpsHelperFunctions.h"
31 #include "AlpsPriorityQueue.h"
32 #include "AlpsKnowledgePool.h"
33 #include "AlpsSubTree.h"
41 
42 public:
44 
48  virtual ~AlpsSubTreePool();
50 
52 
53  virtual int getNumKnowledges() const;
56  virtual std::pair<AlpsKnowledge*, double> getKnowledge() const;
58  virtual bool hasKnowledge() const{ return ! (subTreeList_.empty()); }
60  virtual int getMaxNumKnowledges() const { return INT_MAX; }
62  virtual std::pair<AlpsKnowledge*, double> getBestKnowledge() const;
64  virtual void getAllKnowledges (std::vector<std::pair<AlpsKnowledge*,
65  double> >& kls) const;
67 
69 
70  virtual void addKnowledge(AlpsKnowledge* subTree, double priority);
73  virtual void popKnowledge() { subTreeList_.pop(); }
75 
77 
78  virtual void setMaxNumKnowledges(int num);
81 
83  virtual AlpsPriorityQueue< AlpsSubTree*> const & getSubTreeList() const;
85  void setComparison(AlpsSearchStrategy<AlpsSubTree*>& compare);
87  void deleteGuts();
89  double getBestQuality();
90 
91 private:
96 };
97 
98 #endif
AlpsHelperFunctions.h
AlpsSubTreePool::~AlpsSubTreePool
virtual ~AlpsSubTreePool()
Destructor.
AlpsSubTreePool::getMaxNumKnowledges
virtual int getMaxNumKnowledges() const
Query the quantity limit of knowledges.
Definition: AlpsSubTreePool.h:60
AlpsSubTree.h
AlpsSubTreePool::setMaxNumKnowledges
virtual void setMaxNumKnowledges(int num)
Set the quantity limit of knowledges that can be stored in the pool.
AlpsSubTreePool::setComparison
void setComparison(AlpsSearchStrategy< AlpsSubTree * > &compare)
Set comparison function and resort heap.
AlpsSubTreePool::addKnowledge
virtual void addKnowledge(AlpsKnowledge *subTree, double priority)
Add a subtree to the subtree pool.
AlpsSubTreePool::getSubTreeList
virtual const AlpsPriorityQueue< AlpsSubTree * > & getSubTreeList() const
Return the container of subtrees.
AlpsPriorityQueue::pop
void pop()
Remove the top element from the heap.
Definition: AlpsPriorityQueue.h:72
AlpsSubTreePool::popKnowledge
virtual void popKnowledge()
Remove a subtree from the pool.
Definition: AlpsSubTreePool.h:73
AlpsKnowledgePool
This is an abstract base class, fixing an API for pool types of Alps, AlpsNodePool,...
Definition: AlpsKnowledgePool.h:47
AlpsSubTreePool::getBestQuality
double getBestQuality()
Get the quality of the best subtree.
AlpsSubTreePool
The subtree pool is used to store subtrees.
Definition: AlpsSubTreePool.h:39
AlpsSubTreePool::getBestKnowledge
virtual std::pair< AlpsKnowledge *, double > getBestKnowledge() const
Query the best knowledge in the pool.
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AlpsSubTreePool::AlpsSubTreePool
AlpsSubTreePool()
Default constructor.
AlpsPriorityQueue.h
AlpsKnowledgePool.h
AlpsSubTreePool::subTreeList_
AlpsPriorityQueue< AlpsSubTree * > subTreeList_
Definition: AlpsSubTreePool.h:40
AlpsSubTreePool::deleteGuts
void deleteGuts()
Delete the subtrees in the pool.
AlpsPriorityQueue::empty
bool empty() const
Return true for an empty vector.
Definition: AlpsPriorityQueue.h:78
AlpsSubTreePool::getNumKnowledges
virtual int getNumKnowledges() const
Query the number of subtrees in the pool.
AlpsSubTreePool::getKnowledge
virtual std::pair< AlpsKnowledge *, double > getKnowledge() const
Get a subtree from subtree pool, doesn't remove it from the pool.
AlpsSubTreePool::operator=
AlpsSubTreePool & operator=(const AlpsSubTreePool &)
Disable copy assignment operator.
AlpsSubTreePool::hasKnowledge
virtual bool hasKnowledge() const
Check whether there is a subtree in the subtree pool.
Definition: AlpsSubTreePool.h:58
AlpsSubTreePool::getAllKnowledges
virtual void getAllKnowledges(std::vector< std::pair< AlpsKnowledge *, double > > &kls) const
Get a reference to all the knowledges in the pool.*‍/.
AlpsPriorityQueue< AlpsSubTree * >