Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.34k stars 3.36k forks source link

Weird behavior when snapping to edges with segments disrupted by the traffic updates (segment-speed-file) #5632

Closed danielfdsilva closed 2 months ago

danielfdsilva commented 4 years ago

Background

I'm doing some routing on a custom road network and I'm using traffic updates to disrupt some segments (by setting the speed between nodes as 0).

I'm running into some problems and I'd be grateful if someone could shed some light onto what's happening. Some behaviors look a it buggy, but perhaps is intended behavior.

I prepared the road network using osrm-extract with the car profile and then osrm-partition. Traffic updates were applied using osrm-customize --segment-speed-file. The osrm server was osrm-routed --algorithm mld and all the map examples were done using osrm/osrm-frontend

The issues

This first test I did was run with the base osrm graph (with no disruptions). The purple dot represent where the disruption will be.

Curiously enough the route taken (one way or another) is the same, so the disruption should have no impact whatsoever.

However when I try this with the disrupted road network it only works if the origin - green - and destination - red - are reversed. As soon as they are switched the route disappears. Not only it disappears, but the osrm/osrm-backend osrm-routed crashes without even throwing an error. (note that subsequent origin/destination switches do not bring the route back).

For completeness sake, this is the actual disrupted segment

Below you can see the route being predicted for the OD pair for the base road network (green dot represents where the origin actually should be). As I move the origin point, the best route is always to the left.

With the disrupted road network, at a given point the routing stops.

What's interesting is that if we switch the origin and destination the routing works fine and only changes to a route on the right after passing the disruption. As it is expected.

My best guess so far (and corroborated by the graph explanation image in OSRM's wiki) is that the graph created by OSRM is split at the intersection with different segments (edge expanded graph).

The conclusion is that whenever an origin is snapped to a segment which has nodes that have speed of 0, the whole route immediately becomes unroutable. Why this only happens with the origin, and not the destination I do not know.

Another strange situation arises after we revert a disrupted segment, and this looks like a bug. After we disrupt a segment, by setting its speed to 0 it becomes impassable, as is expected.

If then, we remove the disrupted segment from the speed profile, OSRM will, once again, use it for routing. However, and here's the kicker, any snapping to this edge (that was once disrupted) remains impassable, making any origin that would snap to it permanently cut off.

Any insights would be appreciated.

github-actions[bot] commented 3 months ago

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.