Camargue
karp.hpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
7 #ifndef CMR_KARP_H
8 #define CMR_KARP_H
9 
10 #include "datagroups.hpp"
11 
12 #include <vector>
13 
14 namespace CMR {
15 namespace Data {
16 
31 public:
32  KarpPartition() = default;
33 
34  KarpPartition(const Data::Instance &inst, bool make_dummy,
35  bool save_part);
36 
39  : KarpPartition(inst, false, false) {}
40 
41 
43  int num_parts() const { return part_list.size(); }
44 
45  const std::vector<int> &operator[](int i) const
46  { return part_list[i]; }
47 
49  static int bucket_size(const int ncount);
50 
51 private:
53  std::vector<std::vector<int>> part_list;
54 };
55 
56 }
57 }
58 
59 #endif
static int bucket_size(const int ncount)
Maximum partition size as function of number of nodes ncount.
Definition: karp.cpp:113
const std::vector< int > & operator[](int i) const
The nodes of the i th partition.
Definition: karp.hpp:45
Data group structures.
KarpPartition(const Data::Instance &inst)
Construct a partition from an Instance inst.
Definition: karp.hpp:38
Storing TSP instance data.
Definition: datagroups.hpp:36
KarpPartition()=default
Default construct an empty partition.
int num_parts() const
The number of sub-regions into which the data has been partitioned.
Definition: karp.hpp:43
The namespace for this project.
Definition: abc_nodesel.hpp:20
Class for computing and storing Karp partitions.
Definition: karp.hpp:30
std::vector< std::vector< int > > part_list
A ragged matrix storing the partitions.
Definition: karp.hpp:53