-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
How can I route way in both direction? #5438
Comments
@Guo-astro Currently, both the forward and backward edges are inserted into the heap at the beginning of the Dijkstra search. The route that gets returned is the one that meets in the middle first. The code doesn't currently support continuing the search to discover when the other directions meet, but I can definitely understand why that'd be useful. Here are your options:
|
@danpat Thank you very much! 1.it will be very kind if you can tell me the line number in the code of " both the forward and backward edges are inserted into the heap at the beginning of the Dijkstra search" (possible from https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/routing_algorithms/routing_base_mld.hpp#L242 ?)
I would like to naively ask what is "a big or small component". I guess it is related to SCC...? Any docs or references will be helpful!
|
@Guo-astro By default, OSRM inserts either 1 or 2 starting nodes into the forward search heap, and 1 or 2 ending nodes into the backward search heap. Each node represents the forward and backward directions on the snapped road. If a coordinate is on or closest to an intersection, one of the edges will be selected at random and two nodes from that edge will be inserted - OSRM doesn't yet consider multiple edges if there are several that are equi-distant from the input coordinate (see this ticket for more details: #4465). You can find the logic that inserts the initial nodes into the heap in the common https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/routing_algorithms/routing_base.hpp#L48 - this is used by all routing algorithms (MLD and CH). The shortest path I can see to getting multiple routes returned, with specific directions, would be:
The "big or small component" behaviour is SCC related - OSRM only tries to route between nodes that share the same component ID. This blog post describes the end result of this selection: https://blog.mapbox.com/robust-navigation-with-smart-nearest-neighbor-search-dbc1f6218be8
|
@danpat Thanks very much for the explanation, the blog post helps a lot!
a). My understanding of the code https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/static_rtree.hpp#L627, all possible nearest distance EdgeBasedNodeSegments are retrieved and therefore I do not need to modify that part, is that correct? (Expecting correction of my naive understanding ...) b). If a) is correct, in line https://github.com/Project-OSRM/osrm-backend/blob/master/include/engine/geospatial_query.hpp#L300, why are we expecting the largest possible results.size() == 2 ? 2.Sorry for bothering with some more questions Any explanation or blogs link will help!
enum class Ownership |
1a. That's correct, I don't think any changes are needed in the 1b. The 2a. 2b. This enum is related to the various ways OSRM can allocate memory:
It's basically there to capture the different memory ownership models, but allow code re-use during all phases of the data processing pipeline. |
@danpat Thanks very much for the detail explanations! Got the coding guideline in wiki!! Thank you! |
This issue seems to be stale. It will be closed in 30 days if no further activity occurs. |
OSRM is an amazing piece of work! I have some questions when using it, any idea will be helpful.
In our case, I want to calculate 4 routes as in the picture(start heading in 2 directions and target heading in 2 directions)
The idea I can think about is
Really like to contribute back and a big Thanks !!
The text was updated successfully, but these errors were encountered: