Camargue
|
Storage of a repository of Cliques, for use in building a HyperGraph. More...
#include <cliq.hpp>
Public Types | |
using | CliqueHash = std::unordered_map< Clique, Clique::Ptr > |
Alias declaration for Clique hash table. | |
using | Itr = CliqueHash::iterator |
using | ConstItr = CliqueHash::const_iterator |
Public Member Functions | |
CliqueBank (const std::vector< int > &tour, const std::vector< int > &perm) | |
Construct a CliqueBank to be dereferenced by tour and perm . | |
Clique::Ptr | add_clique (const Clique &clq) |
Add a Clique to the bank, and get a reference to it. | |
Clique::Ptr | add_clique (const CCtsp_lpclique &cc_cliq, const std::vector< int > &tour) |
Construct a Clique in place, add it, and get a reference to it. | |
Clique::Ptr | add_clique (int start, int end, const std::vector< int > &tour) |
Construct/add/get a reference to the Clique from endpoints. | |
Clique::Ptr | add_clique (const std::vector< int > &nodes) |
Construct/add/get a reference to a Clique from a node list. | |
Clique::Ptr | add_tour_clique (const std::vector< int > &tour_nodes) |
Add a Clique corresponding to an ordered sequence of nodes. | |
void | steal_clique (Clique::Ptr &clq_ptr, CliqueBank &from_bank) |
Put the pointed Clique in this bank. More... | |
void | del_clique (Clique::Ptr &clq_ptr) |
Decrement the reference count of a Clique, possibly removing it. More... | |
int | size () const |
The number of unique Cliques in the bank. | |
Itr | begin () |
Itr | end () |
ConstItr | begin () const |
ConstItr | end () const |
const std::vector< int > & | ref_tour () const |
const std::vector< int > & | ref_perm () const |
Private Attributes | |
const std::vector< int > | saved_tour |
Saved tour for dereferencing. | |
const std::vector< int > | saved_perm |
Permutation vector for saved_tour. | |
CliqueHash | bank |
Hash table of Clique and Clique::Ptr. | |
Storage of a repository of Cliques, for use in building a HyperGraph.
This class is responsible for dispensing and deleting references to Clique objects, for use in the edges of a HyperGraph. The interface allows a Clique to be passed to the CliqueBank. A pointer to the Clique will be added to the bank if one does not exist already, or else the use count of the pointer will be incremented. This pointer is then returned for other use. The Cliques contained therein are meaningless without reference to a fixed tour and perm vector, which shall be used to construct Clique objects and turn them back into lists of nodes or sparse cut rows.
void CMR::Sep::CliqueBank::del_clique | ( | Clique::Ptr & | clq_ptr | ) |
Decrement the reference count of a Clique, possibly removing it.
The Clique pointed to by clq_ptr
will be nullified, thereby decrementing the reference count of every other reference to it.
If its reference count in the CliqueBank drops to one, it will be erased, decreasing the size of the CliqueBank.
void CMR::Sep::CliqueBank::steal_clique | ( | Clique::Ptr & | clq_ptr, |
CliqueBank & | from_bank | ||
) |
Put the pointed Clique in this bank.
Steals a Clique from a bank and puts it into this CliqueBank, decrementing its use count in the bank it is moved from.
The reference to the Clique will now be owned by this bank.