Draft: re-use forward heap in map matching
This commit is contained in:
		
							parent
							
								
									298a8e4d2f
								
							
						
					
					
						commit
						45f64e672f
					
				| @ -701,25 +701,27 @@ double getNetworkDistance(SearchEngineData<Algorithm> &engine_working_data, | |||||||
|                           const PhantomNode &target_phantom, |                           const PhantomNode &target_phantom, | ||||||
|                           EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT) |                           EdgeWeight weight_upper_bound = INVALID_EDGE_WEIGHT) | ||||||
| { | { | ||||||
|     forward_heap.Clear(); |  | ||||||
|     reverse_heap.Clear(); |     reverse_heap.Clear(); | ||||||
| 
 | 
 | ||||||
|     if (source_phantom.IsValidForwardSource()) |     if (forward_heap.Empty()) | ||||||
|     { |     { | ||||||
|         forward_heap.Insert(source_phantom.forward_segment_id.id, |         if (source_phantom.IsValidForwardSource()) | ||||||
|                             EdgeWeight{0} - source_phantom.GetForwardWeightPlusOffset(), |         { | ||||||
|                             {source_phantom.forward_segment_id.id, |             forward_heap.Insert(source_phantom.forward_segment_id.id, | ||||||
|                              false, |                                 EdgeWeight{0} - source_phantom.GetForwardWeightPlusOffset(), | ||||||
|                              EdgeDistance{0} - source_phantom.GetForwardDistance()}); |                                 {source_phantom.forward_segment_id.id, | ||||||
|     } |                                  false, | ||||||
|  |                                  EdgeDistance{0} - source_phantom.GetForwardDistance()}); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|     if (source_phantom.IsValidReverseSource()) |         if (source_phantom.IsValidReverseSource()) | ||||||
|     { |         { | ||||||
|         forward_heap.Insert(source_phantom.reverse_segment_id.id, |             forward_heap.Insert(source_phantom.reverse_segment_id.id, | ||||||
|                             EdgeWeight{0} - source_phantom.GetReverseWeightPlusOffset(), |                                 EdgeWeight{0} - source_phantom.GetReverseWeightPlusOffset(), | ||||||
|                             {source_phantom.reverse_segment_id.id, |                                 {source_phantom.reverse_segment_id.id, | ||||||
|                              false, |                                  false, | ||||||
|                              EdgeDistance{0} - source_phantom.GetReverseDistance()}); |                                  EdgeDistance{0} - source_phantom.GetReverseDistance()}); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (target_phantom.IsValidForwardTarget()) |     if (target_phantom.IsValidForwardTarget()) | ||||||
|  | |||||||
| @ -225,6 +225,8 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data, | |||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|  |                 forward_heap.Clear(); | ||||||
|  | 
 | ||||||
|                 for (const auto s_prime : util::irange<std::size_t>(0UL, current_viterbi.size())) |                 for (const auto s_prime : util::irange<std::size_t>(0UL, current_viterbi.size())) | ||||||
|                 { |                 { | ||||||
|                     const double emission_pr = emission_log_probabilities[t][s_prime]; |                     const double emission_pr = emission_log_probabilities[t][s_prime]; | ||||||
| @ -264,6 +266,8 @@ SubMatchingList mapMatching(SearchEngineData<Algorithm> &engine_working_data, | |||||||
|                         model.breakage[t] = false; |                         model.breakage[t] = false; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  | 
 | ||||||
|  |                 forward_heap.Clear(); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (model.breakage[t]) |             if (model.breakage[t]) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user