Fixed offset, moved rvalues to the left in comparisons and const'ed a
few things.
This commit is contained in:
parent
2dbae6ce51
commit
9ffcaa5550
@ -81,31 +81,31 @@ public:
|
|||||||
if(phantomNodePair.targetPhantom.isBidirected() ) {
|
if(phantomNodePair.targetPhantom.isBidirected() ) {
|
||||||
backwardHeap2.Insert(phantomNodePair.targetPhantom.edgeBasedNode+1, phantomNodePair.targetPhantom.weight2, phantomNodePair.targetPhantom.edgeBasedNode+1);
|
backwardHeap2.Insert(phantomNodePair.targetPhantom.edgeBasedNode+1, phantomNodePair.targetPhantom.weight2, phantomNodePair.targetPhantom.edgeBasedNode+1);
|
||||||
}
|
}
|
||||||
int offset = (phantomNodePair.startPhantom.isBidirected() ? std::max(phantomNodePair.startPhantom.weight1, phantomNodePair.startPhantom.weight2) : phantomNodePair.startPhantom.weight1) ;
|
const int forward_offset = phantomNodePair.startPhantom.weight1 + (phantomNodePair.startPhantom.isBidirected() ? phantomNodePair.startPhantom.weight2 : 0);
|
||||||
offset += (phantomNodePair.targetPhantom.isBidirected() ? std::max(phantomNodePair.targetPhantom.weight1, phantomNodePair.targetPhantom.weight2) : phantomNodePair.targetPhantom.weight1) ;
|
const int reverse_offset = phantomNodePair.targetPhantom.weight1 + (phantomNodePair.targetPhantom.isBidirected() ? phantomNodePair.targetPhantom.weight2 : 0);
|
||||||
|
|
||||||
//run two-Target Dijkstra routing step.
|
//run two-Target Dijkstra routing step.
|
||||||
while(forwardHeap.Size() + backwardHeap.Size() > 0){
|
while(0 < (forwardHeap.Size() + backwardHeap.Size() )){
|
||||||
if(forwardHeap.Size() > 0){
|
if(0 < forwardHeap.Size()){
|
||||||
super::RoutingStep(forwardHeap, backwardHeap, &middle1, &_localUpperbound1, 2*offset, true);
|
super::RoutingStep(forwardHeap, backwardHeap, &middle1, &_localUpperbound1, forward_offset, true);
|
||||||
}
|
}
|
||||||
if(backwardHeap.Size() > 0){
|
if(0 < backwardHeap.Size() ){
|
||||||
super::RoutingStep(backwardHeap, forwardHeap, &middle1, &_localUpperbound1, 2*offset, false);
|
super::RoutingStep(backwardHeap, forwardHeap, &middle1, &_localUpperbound1, reverse_offset, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(backwardHeap2.Size() > 0) {
|
if(0 < backwardHeap2.Size()) {
|
||||||
while(forwardHeap2.Size() + backwardHeap2.Size() > 0){
|
while(0 < (forwardHeap2.Size() + backwardHeap2.Size() )){
|
||||||
if(forwardHeap2.Size() > 0){
|
if(0 < forwardHeap2.Size()){
|
||||||
super::RoutingStep(forwardHeap2, backwardHeap2, &middle2, &_localUpperbound2, 2*offset, true);
|
super::RoutingStep(forwardHeap2, backwardHeap2, &middle2, &_localUpperbound2, forward_offset, true);
|
||||||
}
|
}
|
||||||
if(backwardHeap2.Size() > 0){
|
if(0 < backwardHeap2.Size()){
|
||||||
super::RoutingStep(backwardHeap2, forwardHeap2, &middle2, &_localUpperbound2, 2*offset, false);
|
super::RoutingStep(backwardHeap2, forwardHeap2, &middle2, &_localUpperbound2, reverse_offset, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//No path found for both target nodes?
|
//No path found for both target nodes?
|
||||||
if(INT_MAX == _localUpperbound1 && INT_MAX == _localUpperbound2) {
|
if((INT_MAX == _localUpperbound1) && (INT_MAX == _localUpperbound2)) {
|
||||||
rawRouteData.lengthOfShortestPath = rawRouteData.lengthOfAlternativePath = INT_MAX;
|
rawRouteData.lengthOfShortestPath = rawRouteData.lengthOfAlternativePath = INT_MAX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user