6 #ifndef CMR_CC_LPCUTS_H 7 #define CMR_CC_LPCUTS_H 18 #include <concorde/INCLUDE/tsp.h> 32 TourGraph(
const std::vector<double> &tour_edges,
33 const std::vector<Graph::Edge> &edges,
34 const std::vector<int> &perm);
46 CCtsp_lpgraph* pass_ptr() {
return &L; }
47 double* tour_array() {
return &d_tour[0]; }
48 int node_count()
const {
return L.ncount; }
51 std::vector<double> d_tour;
61 LPcutList(CCtsp_lpcut_in *head,
int count) noexcept;
66 void push_front(CCtsp_lpcut_in *new_head);
70 int size()
const {
return cutcount; }
71 bool empty()
const {
return cutcount == 0; }
73 CCtsp_lpcut_in *begin() {
return head_cut.get(); }
74 const CCtsp_lpcut_in *begin()
const {
return head_cut.get(); }
83 void operator()(CCtsp_lpcut_in *cut)
const {
84 for(
auto it = cut; it; it = cut){
86 CCtsp_free_lpcut_in(it);
87 CC_IFFREE(it, CCtsp_lpcut_in);
91 std::unique_ptr<CCtsp_lpcut_in, hungry_delete> head_cut;
101 std::vector<double> &supp_ecap,
103 elist(supp_elist), ecap(supp_ecap), TG(_TG), cutq(_cutq) {}
106 virtual bool find_cuts() = 0;
108 bool filter_primal =
true;
111 std::vector<int> &elist;
112 std::vector<double> &ecap;
122 LocalCuts(std::vector<int> &elist, std::vector<double> &ecap,
124 CCsepBase(elist, ecap, TG, cutq), random_seed(seed) {}
128 static constexpr
int MaxChunkSize = 16;
131 bool spheres =
false;
149 template <CCsepCall sep_fn,
bool check_filter_primal, const
char *fn_name>
159 CCtsp_lpcut_in *head = NULL;
160 std::string err_msg(fn_name); err_msg +=
" failed";
163 if (sep_fn(&head, &cutcount, TG.node_count(), ecap.size(),
164 &elist[0], &ecap[0]))
165 throw std::runtime_error(err_msg);
172 if (check_filter_primal && filter_primal)
173 cutq.filter_primal(TG);
175 return !cutq.empty();
183 constexpr
char seg_fname[] =
"CCtsp_segment_cuts";
185 constexpr
char con_fname[] =
"CCtsp_connect_cuts";
186 constexpr
char ex_fname[] =
"CCtsp_exact_subtours";
187 constexpr
char f2m_fname[] =
"CCtsp_fastblossom";
188 constexpr
char gh2m_fname[] =
"CCtsp_ghfastblossom";
189 constexpr
char blk_fname[] =
"CCtsp_block_combs";
216 int ncount,
int ecount,
int *elist,
double *ecap)
218 return CCtsp_block_combs(c, cutcount, ncount, ecount, elist, ecap, 1);
Deleter to clear the linked list.
Definition: cc_lpcuts.hpp:82
decltype(&CCtsp_segment_cuts) CCsepCall
Alias declaration for Concorde separator call prototype.
Definition: cc_lpcuts.hpp:135
Primal separation of non-template local cuts via standard heuristics.
Definition: cc_lpcuts.hpp:120
Header for classes/structures/functions to work with graphs.
Management of Concorde lpcut_in linked list.
Definition: cc_lpcuts.hpp:56
int BlkCombCall(CCtsp_lpcut_in **c, int *cutcount, int ncount, int ecount, int *elist, double *ecap)
Wrapper function because CCtsp_block_combs takes a silent parameter.
Definition: cc_lpcuts.hpp:215
bool find_cuts()
Call the separation routine, returning true iff cuts are found.
Definition: cc_lpcuts.hpp:156
Class template for straightforward Concorde separation routines.
Definition: cc_lpcuts.hpp:150
The namespace for this project.
Definition: abc_nodesel.hpp:20
Abstract base class for calling Concorde separation routines.
Definition: cc_lpcuts.hpp:98
Wrapper to Concorde CCtsp_lpgraph for pricing cuts at tours.
Definition: cc_lpcuts.hpp:28