7 #ifndef CMR_PROCESS_CUTS_H 8 #define CMR_PROCESS_CUTS_H 13 #include "cut_structs.hpp" 29 template<
typename cut_rep>
38 int q_capacity()
const {
return q_cap; }
41 const cut_rep &
peek_front()
const {
return cut_q.front(); }
42 cut_rep &
peek_front() {
return cut_q.front(); }
48 if(cut_q.size() > q_capacity()) cut_q.pop_back();
51 template <
typename ...Args>
52 void emplace_front(Args &&...args)
54 cut_q.emplace_front(std::forward<Args>(args)...);
55 if (cut_q.size() > q_capacity()) cut_q.pop_back();
61 if(cut_q.size() >= q_capacity()) cut_q.pop_back();
65 template <
typename ...Args>
66 void emplace_back(Args &&...args)
68 if(cut_q.size() >= q_capacity()) cut_q.pop_back();
69 cut_q.emplace_back(std::forward<Args>(args)...);
78 bool empty()
const {
return cut_q.empty(); }
79 int size()
const {
return cut_q.size(); }
83 using Itr =
typename std::list<cut_rep>::iterator;
84 using ConstItr =
typename std::list<cut_rep>::const_iterator;
86 Itr begin() {
return cut_q.begin(); }
87 Itr end() {
return cut_q.end(); }
89 ConstItr begin()
const {
return cut_q.begin(); }
90 ConstItr end()
const {
return cut_q.end(); }
93 std::list<cut_rep> cut_q;
100 const std::vector<int> &perm,
105 const std::vector<int> &tour_nodes,
110 const std::vector<std::vector<int>> &tooth_edges,
114 template<
typename number_type>
119 for(
auto i = 0; i < R.
rmatind.size(); i++){
121 result += x[index] * R.
rmatval[i];
129 const std::vector<double> &tour_edges,
130 const std::vector<double> &lp_vec,
131 const std::vector<Graph::Edge> &edges,
136 const std::vector<double> &tour_edges,
137 const std::vector<double> &lp_vec,
138 const std::vector<Graph::Edge> &edges,
139 int ncount,
const std::vector<int> &handle_delta);
144 const std::vector<double> &tour_edges,
145 const std::vector<double> &lp_vec,
146 const std::vector<Graph::Edge> &edges,
int ncount);
void clear()
Clear the queue.
Definition: process_cuts.hpp:81
Miscellaneous functions, structs/enums, and constants for LPs.
Structure for storing simple DP inequalities.
Definition: cut_structs.hpp:84
Header for classes/structures/functions to work with graphs.
Class template for queue of cuts in some form.
Definition: process_cuts.hpp:30
Graph structures for the edges currently in a CoreLP::Relaxation.
Definition: datagroups.hpp:100
const cut_rep & peek_front() const
A reference to the most recently added cut.
Definition: process_cuts.hpp:41
LP::SparseRow get_row(const CCtsp_lpcut_in &cc_cut, const std::vector< int > &perm, const Graph::CoreGraph &core_graph)
SparseRow corresponding to Concorde cut.
Definition: process_cuts.cpp:30
void push_front(const cut_rep &H)
Push a new cut to the front, popping from the back if at capacity.
Definition: process_cuts.hpp:45
Utility functions, macros, and structures.
void push_back(const cut_rep &H)
Push to the back, popping from back first if at capacity.
Definition: process_cuts.hpp:59
void splice(CutQueue< cut_rep > &Q)
Add the cuts in Q to this list, emptying Q.
Definition: process_cuts.hpp:75
void pop_front()
Pop the front cut.
Definition: process_cuts.hpp:72
CutQueue(const int cap)
Construct a CutQueue with capacity cap.
Definition: process_cuts.hpp:36
std::vector< int > teeth_inds(const ex_blossom &B, const std::vector< double > &tour_edges, const std::vector< double > &lp_vec, const std::vector< Graph::Edge > &edges, int ncount)
Gets the indices of the teeth for an ex_blossom B relative to edges.
std::vector< int > rmatind
Indices of nonzero entries.
Definition: lp_util.hpp:150
std::vector< double > rmatval
Coefficients for indices in rmatind.
Definition: lp_util.hpp:151
The namespace for this project.
Definition: abc_nodesel.hpp:20
CutQueue()
Construct a CutQueue with unlimited capacity.
Definition: process_cuts.hpp:33
Simple struct representing sparse matrix row for passing to LP solver.
Definition: lp_util.hpp:149
Structure for storing blossom inequalities from exact primal separation.
Definition: cut_structs.hpp:17
Wrappers for Concorde cut structures/separators.
double get_activity(const std::vector< number_type > &x, const LP::SparseRow &R)
Function template for determining the activity or lhs of a vector on a row.
Definition: process_cuts.hpp:115
bool bad_blossom(const ex_blossom &B, const std::vector< double > &tour_edges, const std::vector< double > &lp_vec, const std::vector< Graph::Edge > &edges, int ncount)
Returns true if the blossom is invalid for some reason.