PBeFS
Parallel Best-First Search
Loading...
Searching...
No Matches
BBQueue< Node, V > Class Template Reference

the open nodes of a B&B, ordered by a key More...

#include <PBeFS/bnb/BranchAndBound.h>

Classes

struct  Item
 an open node More...

Public Member Functions

 BBQueue (Selection s=Selection::best_first)
 constructor, taking the selection the keys are made by
void push (Node &&n, V bound, unsigned depth, V key)
 adds a node with its bound, its depth and its key
const Item & top (void) const
 the next node, which stays in the queue (there must be one)
Item pop (void)
 removes and returns the next node
V best_bound (void) const
 the least bound of the open nodes ( \( +\infty \) if there is none)
std::size_t clear (void)
 removes all the nodes, returning how many there were
template<class F>
std::size_t drain (F &&f)
 removes all the nodes, giving each to f( item ), and returns how many there were
bool empty (void) const noexcept
 true if there is no open node
std::size_t size (void) const noexcept
 the number of open nodes

Detailed Description

template<class Node, class V = double>
class PBeFS_di_unipi_it::BBQueue< Node, V >

the open nodes of a B&B, ordered by a key

The nodes are kept in slots with a free list, since a node is destroyed when it is branched, and the indexed heap pair of ADS on the slots gives the next one, the least key first and, among equal keys, the last pushed (the first pushed with Selection::breadth_first), and the least bound of the open nodes, which the termination test needs when the key of the selection is not the bound. The heaps grow by doubling with the slots.

Constructor & Destructor Documentation

◆ BBQueue()

template<class Node, class V = double>
BBQueue ( Selection s = Selection::best_first)
inlineexplicit

constructor, taking the selection the keys are made by

Member Function Documentation

◆ best_bound()

template<class Node, class V = double>
V best_bound ( void ) const
inlinenodiscard

the least bound of the open nodes ( \( +\infty \) if there is none)

◆ clear()

template<class Node, class V = double>
std::size_t clear ( void )
inline

removes all the nodes, returning how many there were

◆ drain()

template<class Node, class V = double>
template<class F>
std::size_t drain ( F && f)
inline

removes all the nodes, giving each to f( item ), and returns how many there were

◆ empty()

template<class Node, class V = double>
bool empty ( void ) const
inlinenodiscardnoexcept

true if there is no open node

◆ pop()

template<class Node, class V = double>
Item pop ( void )
inline

removes and returns the next node

◆ push()

template<class Node, class V = double>
void push ( Node && n,
V bound,
unsigned depth,
V key )
inline

adds a node with its bound, its depth and its key

◆ size()

template<class Node, class V = double>
std::size_t size ( void ) const
inlinenodiscardnoexcept

the number of open nodes

◆ top()

template<class Node, class V = double>
const Item & top ( void ) const
inlinenodiscard

the next node, which stays in the queue (there must be one)


The documentation for this class was generated from the following file: