Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an obviously passable route, but OSRM returns "NoRoute." #6690

Open
qimj opened this issue Aug 30, 2023 · 6 comments
Open

There is an obviously passable route, but OSRM returns "NoRoute." #6690

qimj opened this issue Aug 30, 2023 · 6 comments

Comments

@qimj
Copy link

qimj commented Aug 30, 2023

I am using OSRM for route. From the OpenStreetMap, there is clearly a passable road, but the OSRM's response to the query is "NoRoute."

image

here is my osm data after simplify(.osm file is not supported and i changed it's suffix to txt):
map.txt
and i preprocess osm file with osrm-extract bike.lua/osrm-contract

codes for calling OSRM:
`

EngineConfig config;
config.algorithm = EngineConfig::Algorithm::CH;
config.use_shared_memory = false;
config.storage_config = storage::StorageConfig("map.osrm");

OSRM const osrm {config};
RouteParameters params;

params.coordinates.emplace_back(util::FloatLongitude{106.6963952}, util::FloatLatitude{10.7288943});
params.coordinates.emplace_back(util::FloatLongitude{106.6937228}, util::FloatLatitude{10.7287811});
params.exclude.emplace_back("toll");

engine::api::ResultT result = json::Object();
const auto status = osrm.Route(params, result);

my env:
osrm: 5.27.1
MacOs 11.7.9

However, I've noticed a very peculiar phenomenon: if I remove any one of the roads mentioned in 1, 2, and 3, OSRM will return the expected result.It appears that the topological structure of the road network is affecting the results of OSRM.

image

@qimj
Copy link
Author

qimj commented Aug 30, 2023

i debug the OSRM codes and found some clues.

here is node of routing query_graph:
image

edges of routing query_graph:

  • 2 - 0
  • 2 - 1
  • 3 - 5
  • 3 - 11
  • 4 - 7
  • 5 - 9
  • 6 - 9
  • 7 - 10
  • 8 - 4
  • 8 - 5
  • 8 - 6
  • 10 - 9
  • 11 - 6

Bidirectional Dijkstra search is like this:
init forward(node 4) reverse(node 11, 6)

  • forward: delete node 4, add node 7 -> delete node 7
  • reverse: delete node 11 -> delete node 6, add node 9 -> delete node 9

it seemed that both forward and reverse searches access the road below, but were eventually prohibited due to a toll. Meanwhile, the path above was never accessed and this caused NoRoute

@mjjbell
Copy link
Member

mjjbell commented Aug 30, 2023

Does this work correctly if you remove the exclude=toll parameter?

@mjjbell
Copy link
Member

mjjbell commented Aug 30, 2023

Without that parameter, it does the right thing on the demo server: http://map.project-osrm.org/?z=18&center=10.728346%2C106.695517&loc=10.7288943%2C106.6963952&loc=10.7287811%2C106.6937228&hl=en&alt=0&srv=1
Screenshot 2023-08-30 at 13 19 08

So I'm interested in what you're seeing in this case.

@qimj
Copy link
Author

qimj commented Aug 31, 2023

Does this work correctly if you remove the exclude=toll parameter?

yes,it gives below route result if i remove the 'exclude=toll' parameter

image

But my scenario is to bypass toll, and I also made the following settings in bike.lua:

classes = Sequence {
    'toll', 'motorway', 'ferry', 'restricted', 'tunnel'
},

excludable = Sequence {
    Set {'toll'},
    Set {'motorway'},
    Set {'ferry'},
    Set {'toll', 'motorway'},
    Set {'toll', 'ferry'},
    Set {'motorway', 'ferry'},
    Set {'toll', 'motorway', 'ferry'},
}

@mjjbell
Copy link
Member

mjjbell commented Aug 31, 2023

Thanks, I'm able to reproduce the problem. Will investigate further.

@mjjbell
Copy link
Member

mjjbell commented Aug 31, 2023

So far I can see that:

  • It works as expected for the MLD algorithm
  • It works as expected on your snippet (even if it doesn't for you).

This leads me to believe that it's a similar problem to #5969, where dynamic changes can expose random asymmetries in the contraction hierarchy forward/reverse graphs that can lead to routes not being found.

I didn't fully investigate this as I assumed I was only seeing it in hypothetical test scenarios, but now we have a real-world example, it's worth investigating further.

If feasible, you can switch to the MLD algorithm as an immediate workaround until a fix is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants