remove unneeded edge-offset during query

This commit is contained in:
Dennis Luxen 2014-04-11 14:03:39 -04:00
parent db5fd5506d
commit 038e8cc8b8
3 changed files with 9 additions and 23 deletions

View File

@ -168,8 +168,7 @@ public:
&middle_node, &middle_node,
&upper_bound_to_shortest_path_distance, &upper_bound_to_shortest_path_distance,
via_node_candidate_list, via_node_candidate_list,
forward_search_space, forward_search_space
0
); );
} }
if(0 < reverse_heap1.Size()){ if(0 < reverse_heap1.Size()){
@ -179,8 +178,7 @@ public:
&middle_node, &middle_node,
&upper_bound_to_shortest_path_distance, &upper_bound_to_shortest_path_distance,
via_node_candidate_list, via_node_candidate_list,
reverse_search_space, reverse_search_space
0
); );
} }
} }
@ -284,7 +282,7 @@ public:
//prioritizing via nodes for deep inspection //prioritizing via nodes for deep inspection
BOOST_FOREACH(const NodeID node, preselected_node_list) { BOOST_FOREACH(const NodeID node, preselected_node_list) {
int length_of_via_path = 0, sharing_of_via_path = 0; int length_of_via_path = 0, sharing_of_via_path = 0;
ComputeLengthAndSharingOfViaPath(node, &length_of_via_path, &sharing_of_via_path, 0, packed_shortest_path); ComputeLengthAndSharingOfViaPath(node, &length_of_via_path, &sharing_of_via_path, packed_shortest_path);
const int maximum_allowed_sharing = upper_bound_to_shortest_path_distance*VIAPATH_GAMMA; const int maximum_allowed_sharing = upper_bound_to_shortest_path_distance*VIAPATH_GAMMA;
if( sharing_of_via_path <= maximum_allowed_sharing && length_of_via_path <= upper_bound_to_shortest_path_distance*(1+VIAPATH_EPSILON)) { if( sharing_of_via_path <= maximum_allowed_sharing && length_of_via_path <= upper_bound_to_shortest_path_distance*(1+VIAPATH_EPSILON)) {
ranked_candidates_list.push_back( ranked_candidates_list.push_back(
@ -305,7 +303,7 @@ public:
int length_of_via_path = INVALID_EDGE_WEIGHT; int length_of_via_path = INVALID_EDGE_WEIGHT;
NodeID s_v_middle = SPECIAL_NODEID, v_t_middle = SPECIAL_NODEID; NodeID s_v_middle = SPECIAL_NODEID, v_t_middle = SPECIAL_NODEID;
BOOST_FOREACH(const RankedCandidateNode & candidate, ranked_candidates_list){ BOOST_FOREACH(const RankedCandidateNode & candidate, ranked_candidates_list){
if(ViaNodeCandidatePassesTTest(forward_heap1, reverse_heap1, forward_heap2, reverse_heap2, candidate, 0, upper_bound_to_shortest_path_distance, &length_of_via_path, &s_v_middle, &v_t_middle)) { if(ViaNodeCandidatePassesTTest(forward_heap1, reverse_heap1, forward_heap2, reverse_heap2, candidate, upper_bound_to_shortest_path_distance, &length_of_via_path, &s_v_middle, &v_t_middle)) {
// select first admissable // select first admissable
selected_via_node = candidate.node; selected_via_node = candidate.node;
break; break;
@ -417,7 +415,6 @@ private:
const NodeID via_node, const NodeID via_node,
int *real_length_of_via_path, int *real_length_of_via_path,
int *sharing_of_via_path, int *sharing_of_via_path,
const int offset,
const std::vector<NodeID> & packed_shortest_path const std::vector<NodeID> & packed_shortest_path
) { ) {
engine_working_data.InitializeOrClearSecondThreadLocalStorage( engine_working_data.InitializeOrClearSecondThreadLocalStorage(
@ -445,7 +442,6 @@ private:
existing_forward_heap, existing_forward_heap,
&s_v_middle, &s_v_middle,
&upper_bound_s_v_path_length, &upper_bound_s_v_path_length,
2 * offset,
false false
); );
} }
@ -459,7 +455,6 @@ private:
existing_reverse_heap, existing_reverse_heap,
&v_t_middle, &v_t_middle,
&upper_bound_of_v_t_path_length, &upper_bound_of_v_t_path_length,
2 * offset,
true true
); );
} }
@ -627,8 +622,7 @@ private:
NodeID * middle_node, NodeID * middle_node,
int * upper_bound_to_shortest_path_distance, int * upper_bound_to_shortest_path_distance,
std::vector<NodeID> & search_space_intersection, std::vector<NodeID> & search_space_intersection,
std::vector<SearchSpaceEdge> & search_space, std::vector<SearchSpaceEdge> & search_space
const int edge_expansion_offset
) const { ) const {
const NodeID node = forward_heap.DeleteMin(); const NodeID node = forward_heap.DeleteMin();
const int distance = forward_heap.GetKey(node); const int distance = forward_heap.GetKey(node);
@ -653,7 +647,7 @@ private:
const int new_distance = reverse_heap.GetKey(node) + distance; const int new_distance = reverse_heap.GetKey(node) + distance;
if (new_distance < *upper_bound_to_shortest_path_distance) if (new_distance < *upper_bound_to_shortest_path_distance)
{ {
if ((new_distance + edge_expansion_offset) >= 0) if (new_distance >= 0)
{ {
*middle_node = node; *middle_node = node;
*upper_bound_to_shortest_path_distance = new_distance; *upper_bound_to_shortest_path_distance = new_distance;
@ -699,7 +693,6 @@ private:
QueryHeap& new_forward_heap, QueryHeap& new_forward_heap,
QueryHeap& new_reverse_heap, QueryHeap& new_reverse_heap,
const RankedCandidateNode& candidate, const RankedCandidateNode& candidate,
const int offset,
const int lengthOfShortestPath, const int lengthOfShortestPath,
int * length_of_via_path, int * length_of_via_path,
NodeID * s_v_middle, NodeID * s_v_middle,
@ -715,7 +708,7 @@ private:
//compute path <s,..,v> by reusing forward search from s //compute path <s,..,v> by reusing forward search from s
new_reverse_heap.Insert(candidate.node, 0, candidate.node); new_reverse_heap.Insert(candidate.node, 0, candidate.node);
while (new_reverse_heap.Size() > 0) { while (new_reverse_heap.Size() > 0) {
super::RoutingStep(new_reverse_heap, existing_forward_heap, s_v_middle, &upper_bound_s_v_path_length, 2*offset, false); super::RoutingStep(new_reverse_heap, existing_forward_heap, s_v_middle, &upper_bound_s_v_path_length, false);
} }
if( INVALID_EDGE_WEIGHT == upper_bound_s_v_path_length ) { if( INVALID_EDGE_WEIGHT == upper_bound_s_v_path_length ) {
@ -727,7 +720,7 @@ private:
int upper_bound_of_v_t_path_length = INVALID_EDGE_WEIGHT; int upper_bound_of_v_t_path_length = INVALID_EDGE_WEIGHT;
new_forward_heap.Insert(candidate.node, 0, candidate.node); new_forward_heap.Insert(candidate.node, 0, candidate.node);
while (new_forward_heap.Size() > 0) { while (new_forward_heap.Size() > 0) {
super::RoutingStep(new_forward_heap, existing_reverse_heap, v_t_middle, &upper_bound_of_v_t_path_length, 2*offset, true); super::RoutingStep(new_forward_heap, existing_reverse_heap, v_t_middle, &upper_bound_of_v_t_path_length, true);
} }
if( INVALID_EDGE_WEIGHT == upper_bound_of_v_t_path_length ){ if( INVALID_EDGE_WEIGHT == upper_bound_of_v_t_path_length ){
@ -891,7 +884,6 @@ private:
reverse_heap3, reverse_heap3,
&middle, &middle,
&upper_bound, &upper_bound,
offset,
true true
); );
} }
@ -901,7 +893,6 @@ private:
forward_heap3, forward_heap3,
&middle, &middle,
&upper_bound, &upper_bound,
offset,
false false
); );
} }

View File

@ -62,7 +62,6 @@ public:
SearchEngineData::QueryHeap & reverse_heap, SearchEngineData::QueryHeap & reverse_heap,
NodeID * middle_node_id, NodeID * middle_node_id,
int * upper_bound, int * upper_bound,
const int edge_expansion_offset,
const bool forward_direction const bool forward_direction
) const ) const
{ {
@ -75,7 +74,7 @@ public:
// SimpleLogger().Write(logDEBUG) << "new_distance: " << new_distance; // SimpleLogger().Write(logDEBUG) << "new_distance: " << new_distance;
if(new_distance < *upper_bound ) if(new_distance < *upper_bound )
{ {
if( new_distance + edge_expansion_offset >= 0 ) if (new_distance >= 0)
{ {
*middle_node_id = node; *middle_node_id = node;
*upper_bound = new_distance; *upper_bound = new_distance;

View File

@ -174,7 +174,6 @@ public:
reverse_heap1, reverse_heap1,
&middle1, &middle1,
&local_upper_bound1, &local_upper_bound1,
0,
true true
); );
} }
@ -184,7 +183,6 @@ public:
forward_heap1, forward_heap1,
&middle1, &middle1,
&local_upper_bound1, &local_upper_bound1,
0,
false false
); );
} }
@ -198,7 +196,6 @@ public:
reverse_heap2, reverse_heap2,
&middle2, &middle2,
&local_upper_bound2, &local_upper_bound2,
0,
true true
); );
} }
@ -208,7 +205,6 @@ public:
forward_heap2, forward_heap2,
&middle2, &middle2,
&local_upper_bound2, &local_upper_bound2,
0,
false false
); );
} }