Fix some more overzeralous pruning

Similar to commit cda7c5f299, you cannot
just prune and not propagate if times are equal because nothing guarantees
that the first cone to reach a given vertex is the cone that will yield
the shortest path.
This commit is contained in:
Mael Rouxel-Labbé 2019-10-03 15:12:06 +02:00
parent 315d257d98
commit 77749bb031
1 changed files with 9 additions and 3 deletions

View File

@ -1137,14 +1137,17 @@ private:
std::cout << "\t New Distance = " << currentNodeDistance << std::endl;
}
if (currentOccupier.first == NULL || currentOccupier.second > currentNodeDistance)
if (currentOccupier.first == NULL || currentOccupier.second >= currentNodeDistance)
{
if (m_debugOutput)
{
std::cout << "\t Current node is now the occupier" << std::endl;
}
m_vertexOccupiers[entryEdgeIndex] = std::make_pair(node, currentNodeDistance);
// Only replace the current occupier if the time is _strictly_ greater
if(currentOccupier.second > currentNodeDistance ||
(currentOccupier.second > currentNodeDistance && node->node_type() == Cone_tree_node::VERTEX_SOURCE))
m_vertexOccupiers[entryEdgeIndex] = std::make_pair(node, currentNodeDistance);
propagateLeft = true;
propagateRight = true;
@ -1203,7 +1206,10 @@ private:
std::cout << "\t Current Closest Distance = " << currentClosest.second << std::endl;
}
if (currentClosest.first == NULL || currentClosest.second > currentNodeDistance)
// If equal times, give priority to vertex sources since it's cleaner and simpler to handle than interval windows
if(currentClosest.first == nullptr ||
currentClosest.second > currentNodeDistance ||
(currentClosest.second == currentNodeDistance && node->node_type() == Cone_tree_node::VERTEX_SOURCE))
{
if (m_debugOutput)
{