12 #include "cut_structs.hpp" 17 #include <unordered_map> 22 #include <concorde/INCLUDE/tsp.h> 39 Clique(
const CCtsp_lpclique &cc_cliq,
40 const std::vector<int> &saved_tour,
41 const std::vector<int> &saved_perm,
42 const std::vector<int> ¤t_tour);
46 const std::vector<int> &saved_tour,
47 const std::vector<int> &saved_perm,
48 const std::vector<int> & current_tour);
51 Clique(
const std::vector<int> &nodes,
const std::vector<int> &perm,
54 using Ptr = std::shared_ptr<Clique>;
63 std::vector<int>
node_list(
const std::vector<int> &saved_tour)
const;
71 if (seg.contains(index))
97 const std::vector<int> &saved_tour,
98 const std::vector<int> &saved_perm,
99 const std::vector<int> ¤t_tour);
102 const std::array<Clique, 2> &
set_pair()
const {
return sets; }
104 using Ptr = std::shared_ptr<Tooth>;
107 {
return sets == rhs.
sets; }
122 struct hash<
CMR::Sep::Clique> {
129 val = (val * 65537) + (seg.start * 4099) + seg.end;
137 struct hash<
CMR::Sep::Tooth> {
145 val = (val * 65537) + (seg.start * 4099) + seg.end;
170 CliqueBank(
const std::vector<int> &tour,
const std::vector<int> &perm);
176 Clique::Ptr add_clique(
const CCtsp_lpclique &cc_cliq,
177 const std::vector<int> &tour);
181 const std::vector<int> &tour);
184 Clique::Ptr add_clique(
const std::vector<int> &nodes);
187 Clique::Ptr add_tour_clique(
const std::vector<int> &tour_nodes);
196 {
return bank.size(); }
201 using Itr = CliqueHash::iterator;
202 using ConstItr = CliqueHash::const_iterator;
204 Itr begin() {
return bank.begin(); }
205 Itr end() {
return bank.end(); }
207 ConstItr begin()
const {
return bank.begin(); }
208 ConstItr end()
const {
return bank.end(); }
210 const std::vector<int> &ref_tour()
const {
return saved_tour; }
211 const std::vector<int> &ref_perm()
const {
return saved_perm; }
228 ToothBank(
const std::vector<int> &tour,
const std::vector<int> &perm);
235 const std::vector<int> &tour);
241 {
return bank.size(); }
244 using ToothHash = std::unordered_map<Tooth, Tooth::Ptr>;
246 using Itr = ToothHash::iterator;
250 {
return bank.begin(); }
253 {
return bank.begin(); }
256 {
return bank.end(); }
259 {
return bank.end(); }
262 {
return saved_tour; }
265 {
return saved_perm; }
Clique()=default
Default construct an empty Clique.
bool operator==(const Tooth &rhs) const
Equality operator.
Definition: cliq.hpp:106
size_t operator()(const CMR::Sep::Tooth &T) const
Call operator for hashing a Tooth.
Definition: cliq.hpp:139
Itr begin()
Begin iterator.
Definition: cliq.hpp:249
const std::vector< int > saved_perm
Permutation vector for saved_tour.
Definition: cliq.hpp:216
CliqueHash bank
Hash table of Clique and Clique::Ptr.
Definition: cliq.hpp:217
ConstItr end() const
Const past the end iterator.
Definition: cliq.hpp:258
Storage of a repository of Teeth, for use in building a HyperGraph.
Definition: cliq.hpp:225
int seg_count() const
How many segments are used to represent the Clique.
Definition: cliq.hpp:57
Vertex set structure used in tooth inequalities for domino parity cuts.
Definition: cliq.hpp:91
const std::vector< int > saved_perm
Permutation vec for saved_tour.
Definition: cliq.hpp:269
std::vector< Segment > seglist
A vector of start and endpoints of tour intervals stored as Segment.
Definition: cliq.hpp:78
int size() const
Number of teeth in the bank.
Definition: cliq.hpp:240
ToothHash bank
Hash table of Tooth to Tooth::Ptr.
Definition: cliq.hpp:270
std::unordered_map< Clique, Clique::Ptr > CliqueHash
Alias declaration for Clique hash table.
Definition: cliq.hpp:199
std::shared_ptr< Clique > Ptr
shared_ptr alias declaration.
Definition: cliq.hpp:54
int size() const
The number of unique Cliques in the bank.
Definition: cliq.hpp:195
const std::vector< int > & ref_perm() const
Const ref to saved perm for dereferencing.
Definition: cliq.hpp:264
const std::vector< Segment > & seg_list() const
A constant reference to the list of segments in the Clique.
Definition: cliq.hpp:60
bool operator==(const Clique &rhs) const
Equality operator.
Definition: cliq.hpp:65
Itr end()
Past the end iterator.
Definition: cliq.hpp:255
const std::array< Clique, 2 > & set_pair() const
Constant reference to the defining sets.
Definition: cliq.hpp:102
Utility functions, macros, and structures.
size_t operator()(const CMR::Sep::Clique &clq) const
Call operator for hashing a Clique.
Definition: cliq.hpp:124
ToothHash::iterator Itr
Iterator alias.
Definition: cliq.hpp:246
Storage of a repository of Cliques, for use in building a HyperGraph.
Definition: cliq.hpp:167
bool contains(const int index) const
Returns true iff the Clique contains index.
Definition: cliq.hpp:69
const std::vector< int > saved_tour
Saved tour for dereferencing.
Definition: cliq.hpp:268
Class for storing segment lists representing edges of a hypergraph.
Definition: cliq.hpp:34
std::shared_ptr< Tooth > Ptr
Pointer alias declaration.
Definition: cliq.hpp:104
ToothHash::const_iterator ConstItr
Const iterator alias.
Definition: cliq.hpp:247
Representing simple tooth inequalities.
Definition: cut_structs.hpp:39
The namespace for this project.
Definition: abc_nodesel.hpp:20
std::array< Clique, 2 > sets
Teeth are represented as a pair of Cliques for the handle and body.
Definition: cliq.hpp:111
ConstItr begin() const
Const begin iterator.
Definition: cliq.hpp:252
const std::vector< int > saved_tour
Saved tour for dereferencing.
Definition: cliq.hpp:215
std::unordered_map< Tooth, Tooth::Ptr > ToothHash
Alias declaration for Tooth hash table.
Definition: cliq.hpp:244
std::vector< int > node_list(const std::vector< int > &saved_tour) const
A list of literal nodes represented by the Clique.
Definition: cliq.cpp:183
const std::vector< int > & ref_tour() const
Const ref to saved tour for dereferencing.
Definition: cliq.hpp:261
Simple utility struct for storing an interval of nodes.
Definition: util.hpp:198