ell::util::PriorityQueue< QV, QK, CompareKey > Class Template Reference
#include <PriorityQueue.hh>
Detailed Description
template<class QV, class QK = QueueKey, typename CompareKey = std::less<QK>>
class ell::util::PriorityQueue< QV, QK, CompareKey >
Implements a priority queue of compressed states that are ordered according to their energy (using lexicographical order on compressed string representation as tiebreaker). The top() element corresponds to the state with the smallest energy in the queue.
Definition at line 36 of file PriorityQueue.hh.
Public Types | |
typedef InternalPQtype::const_iterator | const_iterator |
typedef std::pair< iterator, bool > | InsertResult |
typedef InternalPQtype::iterator | iterator |
typedef QK | QueueKey |
typedef QV | QueueValue |
typedef InternalPQtype::size_type | size_type |
Public Member Functions | |
iterator | begin (void) |
const_iterator | begin (void) const |
bool | empty (void) const |
iterator | end (void) |
const_iterator | end (void) const |
void | erase (const QK &key) |
void | erase (const State *s) |
iterator | find (const QK &key) |
const_iterator | find (const QK &key) const |
iterator | find (const State *s) |
const_iterator | find (const State *s) const |
double | getMaxE (void) const |
InsertResult | insert (const QK &key) |
InsertResult | insert (const State *keyState) |
void | pop (void) |
PriorityQueue () | |
void | reduceMaxE (const double maxE) |
size_type | size (void) const |
const_iterator | top (void) const |
virtual | ~PriorityQueue () |
Protected Types | |
typedef std::map< QK, QV, CompareKey > | InternalPQtype |
Protected Attributes | |
InternalPQtype | pq |
Member Typedef Documentation
typedef InternalPQtype::const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::const_iterator |
typedef std::pair<iterator, bool> ell::util::PriorityQueue< QV, QK, CompareKey >::InsertResult |
typedef std::map< QK, QV, CompareKey > ell::util::PriorityQueue< QV, QK, CompareKey >::InternalPQtype [protected] |
shortcut for the internal priority queue data structure
Definition at line 46 of file PriorityQueue.hh.
typedef InternalPQtype::iterator ell::util::PriorityQueue< QV, QK, CompareKey >::iterator |
typedef QK ell::util::PriorityQueue< QV, QK, CompareKey >::QueueKey |
Definition at line 42 of file PriorityQueue.hh.
typedef QV ell::util::PriorityQueue< QV, QK, CompareKey >::QueueValue |
Definition at line 41 of file PriorityQueue.hh.
typedef InternalPQtype::size_type ell::util::PriorityQueue< QV, QK, CompareKey >::size_type |
Constructor & Destructor Documentation
ell::util::PriorityQueue< QV, QK, CompareKey >::PriorityQueue | ( | ) |
construction
virtual ell::util::PriorityQueue< QV, QK, CompareKey >::~PriorityQueue | ( | ) | [virtual] |
destruction
Member Function Documentation
iterator ell::util::PriorityQueue< QV, QK, CompareKey >::begin | ( | void | ) |
returns an iterator to the top() element of the queue
const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::begin | ( | void | ) | const |
returns a constant iterator to the top() element of the queue
bool ell::util::PriorityQueue< QV, QK, CompareKey >::empty | ( | void | ) | const |
Whether or not the queue contains no elements
- Returns:
- true if size()==0 and false otherwise
iterator ell::util::PriorityQueue< QV, QK, CompareKey >::end | ( | void | ) |
returns an iterator behind the last element of the queue
const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::end | ( | void | ) | const |
returns a constant iterator behind the last element of the queue
void ell::util::PriorityQueue< QV, QK, CompareKey >::erase | ( | const QK & | key | ) |
Erases the key/value pair of the given key
- Parameters:
-
key the key to erase the key/value pair of
void ell::util::PriorityQueue< QV, QK, CompareKey >::erase | ( | const State * | s | ) |
Erases the key/value pair representing the given state
- Parameters:
-
s the state of that the key/value pair is to erase
iterator ell::util::PriorityQueue< QV, QK, CompareKey >::find | ( | const QK & | key | ) |
const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::find | ( | const QK & | key | ) | const |
iterator ell::util::PriorityQueue< QV, QK, CompareKey >::find | ( | const State * | s | ) |
const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::find | ( | const State * | s | ) | const |
double ell::util::PriorityQueue< QV, QK, CompareKey >::getMaxE | ( | void | ) | const |
Returns the maximal energy stored in the queue
- Returns:
- the energy of the last queue element
InsertResult ell::util::PriorityQueue< QV, QK, CompareKey >::insert | ( | const QK & | key | ) |
Inserts an empty QueueValue for the given key. The new QueueValue object is created and can be filled afterwards using the provided iterator. NOTE: An already existing QueueValue object for the given key will be overwritten!
- Parameters:
-
key the key a new value is to be inserted
- Returns:
- (first) the iterator to the (newly created) QueueValue object and (second) a boolean that is true if the value was created and NOT already part of the queue.
InsertResult ell::util::PriorityQueue< QV, QK, CompareKey >::insert | ( | const State * | keyState | ) |
Inserts a key/value pair to the queue using the given information. A new QueueValue object is created and can be filled afterwards using the provided iterator. NOTE: An already existing QueueValue object for the given key will be overwritten!
- Parameters:
-
keyState the state that is to be inserted as a key
- Returns:
- (first) the iterator to the (newly created) QueueValue object and (second) a boolean that is true if the value was created and NOT already part of the queue.
void ell::util::PriorityQueue< QV, QK, CompareKey >::pop | ( | void | ) |
deletes the top element of the queue
void ell::util::PriorityQueue< QV, QK, CompareKey >::reduceMaxE | ( | const double | maxE | ) |
Deletes all elements from the queue with key.E > maxE
- Parameters:
-
maxE the energy to that all elements of the queue should be smaller
size_type ell::util::PriorityQueue< QV, QK, CompareKey >::size | ( | void | ) | const |
the number of elements in the queue
- Returns:
- the number of elements
const_iterator ell::util::PriorityQueue< QV, QK, CompareKey >::top | ( | void | ) | const |
returns the top element of the queue which is the top() element
Field Documentation
InternalPQtype ell::util::PriorityQueue< QV, QK, CompareKey >::pq [protected] |
The documentation for this class was generated from the following file:
- src/ell/util/PriorityQueue.hh