Make renumbering transparent to contraction
This commit is contained in:
committed by
Patrick Niklaus
parent
e011c60e12
commit
247f1c120f
@@ -12,8 +12,7 @@ namespace contractor
|
||||
struct ContractorEdgeData
|
||||
{
|
||||
ContractorEdgeData()
|
||||
: weight(0), duration(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0),
|
||||
is_original_via_node_ID(false)
|
||||
: weight(0), duration(0), id(0), originalEdges(0), shortcut(0), forward(0), backward(0)
|
||||
{
|
||||
}
|
||||
ContractorEdgeData(EdgeWeight weight,
|
||||
@@ -24,18 +23,17 @@ struct ContractorEdgeData
|
||||
bool forward,
|
||||
bool backward)
|
||||
: weight(weight), duration(duration), id(id),
|
||||
originalEdges(std::min((1u << 28) - 1u, original_edges)), shortcut(shortcut),
|
||||
forward(forward), backward(backward), is_original_via_node_ID(false)
|
||||
originalEdges(std::min((1u << 29) - 1u, original_edges)), shortcut(shortcut),
|
||||
forward(forward), backward(backward)
|
||||
{
|
||||
}
|
||||
EdgeWeight weight;
|
||||
EdgeWeight duration;
|
||||
unsigned id;
|
||||
unsigned originalEdges : 28;
|
||||
unsigned originalEdges : 29;
|
||||
bool shortcut : 1;
|
||||
bool forward : 1;
|
||||
bool backward : 1;
|
||||
bool is_original_via_node_ID : 1;
|
||||
};
|
||||
|
||||
using ContractorGraph = util::DynamicGraph<ContractorEdgeData>;
|
||||
|
||||
@@ -101,10 +101,9 @@ class GraphContractor
|
||||
std::vector<float> node_levels_,
|
||||
std::vector<EdgeWeight> node_weights_);
|
||||
|
||||
/* Flush all data from the contraction to disc and reorder stuff for better locality */
|
||||
void FlushDataAndRebuildContractorGraph(ThreadDataContainer &thread_data_list,
|
||||
std::vector<RemainingNodeData> &remaining_nodes,
|
||||
std::vector<float> &node_priorities);
|
||||
void RenumberGraph(ThreadDataContainer &thread_data_list,
|
||||
std::vector<RemainingNodeData> &remaining_nodes,
|
||||
std::vector<float> &node_priorities);
|
||||
|
||||
void Run(double core_factor = 1.0);
|
||||
|
||||
@@ -130,22 +129,13 @@ class GraphContractor
|
||||
{
|
||||
const NodeID target = graph.GetTarget(edge);
|
||||
const ContractorGraph::EdgeData &data = graph.GetEdgeData(edge);
|
||||
if (!orig_node_id_from_new_node_id_map.empty())
|
||||
{
|
||||
new_edge.source = orig_node_id_from_new_node_id_map[node];
|
||||
new_edge.target = orig_node_id_from_new_node_id_map[target];
|
||||
}
|
||||
else
|
||||
{
|
||||
new_edge.source = node;
|
||||
new_edge.target = target;
|
||||
}
|
||||
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.source, "Source id invalid");
|
||||
new_edge.source = orig_node_id_from_new_node_id_map[node];
|
||||
new_edge.target = orig_node_id_from_new_node_id_map[target];
|
||||
BOOST_ASSERT_MSG(SPECIAL_NODEID != new_edge.target, "Target id invalid");
|
||||
new_edge.data.weight = data.weight;
|
||||
new_edge.data.duration = data.duration;
|
||||
new_edge.data.shortcut = data.shortcut;
|
||||
if (!data.is_original_via_node_ID && !orig_node_id_from_new_node_id_map.empty())
|
||||
if (data.shortcut)
|
||||
{
|
||||
// tranlate the _node id_ of the shortcutted node
|
||||
new_edge.data.turn_id = orig_node_id_from_new_node_id_map[data.id];
|
||||
@@ -286,17 +276,13 @@ class GraphContractor
|
||||
if (RUNSIMULATION)
|
||||
{
|
||||
const int constexpr SIMULATION_SEARCH_SPACE_SIZE = 1000;
|
||||
dijkstra.Run(number_of_targets,
|
||||
SIMULATION_SEARCH_SPACE_SIZE,
|
||||
max_weight,
|
||||
node,
|
||||
graph);
|
||||
dijkstra.Run(
|
||||
number_of_targets, SIMULATION_SEARCH_SPACE_SIZE, max_weight, node, graph);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int constexpr FULL_SEARCH_SPACE_SIZE = 2000;
|
||||
dijkstra.Run(
|
||||
number_of_targets, FULL_SEARCH_SPACE_SIZE, max_weight, node, graph);
|
||||
dijkstra.Run(number_of_targets, FULL_SEARCH_SPACE_SIZE, max_weight, node, graph);
|
||||
}
|
||||
for (auto out_edge : graph.GetAdjacentEdgeRange(node))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user