Fixing several of the flickering issues.
This commit is contained in:
		
							parent
							
								
									b08104367e
								
							
						
					
					
						commit
						3a984668d6
					
				| @ -36,7 +36,7 @@ struct _HeapData { | |||||||
|     _HeapData( NodeID p ) : parent(p) { } |     _HeapData( NodeID p ) : parent(p) { } | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| typedef boost::thread_specific_ptr<BinaryHeap< NodeID, NodeID, int, _HeapData > > HeapPtr; | typedef boost::thread_specific_ptr<BinaryHeap< NodeID, NodeID, int, _HeapData> > HeapPtr; | ||||||
| 
 | 
 | ||||||
| template<class EdgeData, class GraphT> | template<class EdgeData, class GraphT> | ||||||
| class SearchEngine { | class SearchEngine { | ||||||
| @ -58,12 +58,12 @@ public: | |||||||
| 
 | 
 | ||||||
|     inline void InitializeThreadLocalStorageIfNecessary() { |     inline void InitializeThreadLocalStorageIfNecessary() { | ||||||
|         if(!_forwardHeap.get()) |         if(!_forwardHeap.get()) | ||||||
|             _forwardHeap.reset(new BinaryHeap< NodeID, NodeID, int, _HeapData >(nodeHelpDesk->getNumberOfNodes())); |             _forwardHeap.reset(new BinaryHeap< NodeID, NodeID, int, _HeapData>(nodeHelpDesk->getNumberOfNodes())); | ||||||
|         else |         else | ||||||
|             _forwardHeap->Clear(); |             _forwardHeap->Clear(); | ||||||
| 
 | 
 | ||||||
|         if(!_backwardHeap.get()) |         if(!_backwardHeap.get()) | ||||||
|             _backwardHeap.reset(new BinaryHeap< NodeID, NodeID, int, _HeapData >(nodeHelpDesk->getNumberOfNodes())); |             _backwardHeap.reset(new BinaryHeap< NodeID, NodeID, int, _HeapData>(nodeHelpDesk->getNumberOfNodes())); | ||||||
|         else |         else | ||||||
|             _backwardHeap->Clear(); |             _backwardHeap->Clear(); | ||||||
|     } |     } | ||||||
| @ -89,19 +89,19 @@ public: | |||||||
|             _backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode+1, phantomNodes.targetPhantom.weight2, phantomNodes.targetPhantom.edgeBasedNode+1); |             _backwardHeap->Insert(phantomNodes.targetPhantom.edgeBasedNode+1, phantomNodes.targetPhantom.weight2, phantomNodes.targetPhantom.edgeBasedNode+1); | ||||||
| //            INFO("d) back insert " << phantomNodes.targetPhantom.edgeBasedNode+1 << ", weight: " << phantomNodes.targetPhantom.weight2);
 | //            INFO("d) back insert " << phantomNodes.targetPhantom.edgeBasedNode+1 << ", weight: " << phantomNodes.targetPhantom.weight2);
 | ||||||
|         } |         } | ||||||
|         int startOffset = (phantomNodes.startPhantom.isBidirected() ? std::max(phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.weight2) : phantomNodes.startPhantom.weight1) ; |         int offset = (phantomNodes.startPhantom.isBidirected() ? std::max(phantomNodes.startPhantom.weight1, phantomNodes.startPhantom.weight2) : phantomNodes.startPhantom.weight1) ; | ||||||
|         int targetOffset = (phantomNodes.targetPhantom.isBidirected() ? std::max(phantomNodes.targetPhantom.weight1, phantomNodes.targetPhantom.weight2) : phantomNodes.targetPhantom.weight1) ; |         offset += (phantomNodes.targetPhantom.isBidirected() ? std::max(phantomNodes.targetPhantom.weight1, phantomNodes.targetPhantom.weight2) : phantomNodes.targetPhantom.weight1) ; | ||||||
| 
 | 
 | ||||||
|         while(_forwardHeap->Size() + _backwardHeap->Size() > 0){ |         while(_forwardHeap->Size() + _backwardHeap->Size() > 0){ | ||||||
|             if(_forwardHeap->Size() > 0){ |             if(_forwardHeap->Size() > 0){ | ||||||
|                 _RoutingStep(_forwardHeap, _backwardHeap, true, &middle, &_upperbound, startOffset+targetOffset); |                 _RoutingStep(_forwardHeap, _backwardHeap, true, &middle, &_upperbound, 2*offset); | ||||||
|             } |             } | ||||||
|             if(_backwardHeap->Size() > 0){ |             if(_backwardHeap->Size() > 0){ | ||||||
|                 _RoutingStep(_backwardHeap, _forwardHeap, false, &middle, &_upperbound, startOffset+targetOffset); |                 _RoutingStep(_backwardHeap, _forwardHeap, false, &middle, &_upperbound, 2*offset); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         INFO("-> dist " << _upperbound); | //        INFO("-> dist " << _upperbound);
 | ||||||
|         if ( _upperbound == INT_MAX ) { |         if ( _upperbound == INT_MAX ) { | ||||||
|             return _upperbound; |             return _upperbound; | ||||||
|         } |         } | ||||||
| @ -158,7 +158,7 @@ public: | |||||||
|         return GetEscapedNameForNameID(nameID); |         return GetEscapedNameForNameID(nameID); | ||||||
|     } |     } | ||||||
| private: | private: | ||||||
|     inline void _RoutingStep(HeapPtr & _forwardHeap, HeapPtr & _backwardHeap, const bool & forwardDirection, NodeID *middle, int *_upperbound, const int negativeOffset) const { |     inline void _RoutingStep(HeapPtr & _forwardHeap, HeapPtr & _backwardHeap, const bool & forwardDirection, NodeID *middle, int *_upperbound, const int edgeBasedOffset) const { | ||||||
|         const NodeID node = _forwardHeap->DeleteMin(); |         const NodeID node = _forwardHeap->DeleteMin(); | ||||||
|         const int distance = _forwardHeap->GetKey(node); |         const int distance = _forwardHeap->GetKey(node); | ||||||
| //        INFO((forwardDirection ? "[forw]" : "[back]") << " settled node " << node << " at distance " << distance);
 | //        INFO((forwardDirection ? "[forw]" : "[back]") << " settled node " << node << " at distance " << distance);
 | ||||||
| @ -176,7 +176,7 @@ private: | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(distance-negativeOffset > *_upperbound){ |         if(distance-edgeBasedOffset > *_upperbound){ | ||||||
|             _forwardHeap->DeleteAll(); |             _forwardHeap->DeleteAll(); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @ -217,7 +217,7 @@ private: | |||||||
|                 } |                 } | ||||||
|                 //Found a shorter Path -> Update distance
 |                 //Found a shorter Path -> Update distance
 | ||||||
|                 else if ( toDistance < _forwardHeap->GetKey( to ) ) { |                 else if ( toDistance < _forwardHeap->GetKey( to ) ) { | ||||||
| //                    INFO((forwardDirection ? "[forw]" : "[back]") << " decrease and scanning edge (" << node << "," << to << ") with distance " << toDistance << ", edge length: " << data.distance);
 | //                    INFO((forwardDirection ? "[forw]" : "[back]") << " decrease and scanning edge (" << node << "," << to << ") from " << _forwardHeap->GetKey(to) << "to " << toDistance << ", edge length: " << data.distance);
 | ||||||
|                     _forwardHeap->GetData( to ).parent = node; |                     _forwardHeap->GetData( to ).parent = node; | ||||||
|                     _forwardHeap->DecreaseKey( to, toDistance ); |                     _forwardHeap->DecreaseKey( to, toDistance ); | ||||||
|                     //new parent
 |                     //new parent
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user