23 #include <unordered_map> 55 template <
typename numtype>
63 std::vector<Graph::Edge> pool_chunk(std::vector<
PrEdge<double>> &edge_q);
69 int &loop1,
int &loop2);
72 int start_ind,
int &end1,
int &end2);
89 std::unique_ptr<LP::DualGroup<double>> reg_duals;
90 std::unique_ptr<LP::DualGroup<util::Fixed64>> ex_duals;
110 template <
typename numtype>
116 using std::unique_ptr;
120 std::runtime_error err(
"Problem in Pricer::price_edges.");
124 duals = util::make_unique<Dual>(
false,
core_lp,
125 core_lp.external_cuts());
128 vector<numtype> &node_pi = duals->node_pi;
129 vector<numtype> &cut_pi = duals->cut_pi;
130 std::unordered_map<Sep::Clique, numtype> &clique_pi = duals->clique_pi;
133 for (
auto &e : target_edges)
134 e.redcost =
inst.
edgelen(e.end[0], e.end[1]) - node_pi[e.end[0]]
137 for (
auto &e : target_edges)
138 e.redcost = 0 - node_pi[e.end[0]] - node_pi[e.end[1]];
147 vector<Graph::Node> &price_nodelist = price_adjlist.nodelist;
149 const std::vector<int> &def_tour =
ext_cuts.get_cbank().ref_tour();
152 for (
const std::pair<Sep::Clique, numtype> &kv : clique_pi) {
154 numtype pival = kv.second;
157 numtype add_back = pival + pival;
162 if (price_nodelist[nbr.other_end].mark == marker)
163 target_edges[nbr.edge_index].redcost += add_back;
165 price_nodelist[j].mark = marker;
170 const vector<Sep::HyperGraph> &cutlist =
ext_cuts.get_cuts();
172 vector<double> rmatval;
174 for (
int i = 0; i < cutlist.size(); ++i) {
175 numtype pival = cut_pi[i];
178 if (H.cut_type() == CutType::Non)
179 throw std::logic_error(
"Called pricing w Non HyperGraph present.");
181 if (H.cut_type() != CutType::Domino)
191 for (
int j = 0; j < rmatind.size(); ++j)
192 util::add_mult(target_edges[rmatind[j]].redcost,
Miscellaneous functions, structs/enums, and constants for LPs.
Type
Enumeration for the types of HyperGraph inequalities.
Definition: hypergraph.hpp:65
int node_count() const
Number of nodes.
Definition: datagroups.hpp:71
const int gen_max
The max number of edges to generate at a time.
Definition: pricer.hpp:84
PivType
Enum class for categorizing lp solutions.
Definition: lp_util.hpp:34
double edgelen(int end0, int end1) const
Edge length between two nodes in an Instance.
Definition: datagroups.hpp:64
Representing cuts outside the LP solver.
bool feas_recover()
Generate/add edges to recover LP feasibility.
Definition: price_recover.cpp:40
void get_coeffs(const std::vector< EndPt_type > &edges, std::vector< int > &rmatind, std::vector< double > &rmatval) const
Get sparse coefficient row for a list of endpoints.
Definition: hypergraph.hpp:211
Get reduced costs for edges not in the core lp.
Definition: pricer.hpp:32
Hash map for node pairs representing edges.
Definition: edgehash.hpp:24
Wrapper/arithmetic operators for fixed precision arithmetic.
The external storage of a collection of HyperGraph cuts in a Relaxation.
Definition: hypergraph.hpp:126
const Sep::ExternalCuts & ext_cuts
For computing duals.
Definition: pricer.hpp:80
util::EdgeHash edge_hash
Hash table for tracking generated edges.
Definition: pricer.hpp:96
Definition: price_util.hpp:65
Graph structures for the edges currently in a CoreLP::Relaxation.
Definition: datagroups.hpp:100
Graph::CoreGraph & core_graph
Graph data for the core_lp.
Definition: pricer.hpp:82
std::vector< int > gen_elen
Unused dummy parameter to pass.
Definition: pricer.hpp:87
Storing TSP instance data.
Definition: datagroups.hpp:36
std::unique_ptr< edgegen_impl > eg_inside
The edge generator implementation.
Definition: pricer.hpp:92
ERROR HANDLING CLASSES AND ROUTINES.
void price_edges(std::vector< PrEdge< numtype >> &target_edges, std::unique_ptr< LP::DualGroup< numtype >> &duals, bool include_len)
Compute reduced costs for a set of edges.
Definition: pricer.hpp:111
LP::CoreLP & core_lp
The LP relaxation to query/modify.
Definition: pricer.hpp:78
Utility functions, macros, and structures.
Pricer(LP::CoreLP &core, const Data::Instance &_inst, Graph::CoreGraph &core_graph_)
Construct a Pricer using data from an ongoing solution process.
Definition: price_gen.cpp:86
Class for storing segment lists representing edges of a hypergraph.
Definition: cliq.hpp:34
void elim_edges(bool make_opt)
Eliminate edges from the core.
Definition: price_exact.cpp:115
util::Fixed64 exact_lb(bool full)
Compute a lower bound in Fixed64 arithmetic.
Definition: price_exact.cpp:34
ScanStat
Return type for edge pricing routines.
Definition: price_util.hpp:33
const Data::Instance & inst
To get lengths for edges not in core_lp.
Definition: pricer.hpp:79
External representation of a cut added to the lp relaxation.
Definition: hypergraph.hpp:31
The namespace for this project.
Definition: abc_nodesel.hpp:20
std::unique_ptr< edgegen_impl > eg_full
Complete graph generator.
Definition: pricer.hpp:94
Class template for storing dual LP solutions.
Definition: dualgroup.hpp:25
Hash map for graph edges.
ScanStat gen_edges(LP::PivType piv_stat, bool try_elim)
Generate/add edges to core.
Definition: price_gen.cpp:111
std::vector< int > gen_elist
Raw node-node list of generated edges.
Definition: pricer.hpp:86
#define CMR_CATCH_PRINT_THROW(msg, new_ex)
Macro for handling errors in function with multiple failure points.
Definition: err_util.hpp:25
Class for storing the core lp associated to a TSP instance and pivoting.
Definition: core_lp.hpp:33
Definition: price_gen.cpp:39
Representation of a graph as an adjacency list.
Definition: graph.hpp:80
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
Managing Core LP relaxations of TSP instances.
Object used to represent adjacency in a Graph::AdjList.
Definition: graph.hpp:51
A 64-bit fixed precision number type "implemented" as a wrapper to CCbigguy.
Definition: fixed64.hpp:21
Constants and functions related to edge pricing.