-
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
Detour computation - implementation guidance #4015
Comments
@Fkawala It sounds like you're already looking at the parts of the code you need.
Happy to answer any more specific questions you've got - this looks like a very interesting algorithm :-) |
@danpat Thanks for your kind response, I'll ping for help if needed! |
@danpat I used your PR #3652 to understand how to define a new plugin, that went quite well. My new "detour" plugin should run a bi-directional Dijkstra which have no difference from search function, but a custom relaxOutgoingEdges function. The customized relaxOutgoingEdges function would update the SearchSpaceWithBuckets. How could I do that without doing neither a massive code duplication nor a breaking the current routing algorithms ? |
If you want to introduce customization points maybe have a look at policy-based design. The basic idea is to inject different behavior by means of template functions. The compiler can then look through your glue code and churn out the appropriate code for you at compile time. Here's an example: https://github.com/Project-OSRM/osrm-backend/pull/1515/files |
@daniel-j-h Thanks for the advice! Just to be sure, is that correct that you suggest me to do as it is done for DIRECTION "parameter" of the routingStep function ? I'm kind of lost in the routing algorithms, If I do modify the template of the relaxOutgoingEdges function will I have to modify both CH and non-CH routing algorithms ? |
The routing algorithms are namespaced to If you want to implement your feature on I can recommend taking a look at |
@Fkawala Would using the If yes, I would recommend trying to move those to the routing base that Daniel mentioned and have both |
@TheMarex from what I get from [1] and OSRM the fast detour computation would be quite faster with a bi-directional Dijkstra running on a HC preprocessed graph, so I guess that M2M is not the best candidate. What do you think ? |
The many-to-many algorithm uses a bi-directional Dijkstra with search-buckets under the hood, which seems to be what you need here, right? |
My bad, I did not checked the source before my last response, sorry about that. After a careful reading I'm still perplex about the Would you care to explain me the difference between the Bottom line, If M2M boils down to a bi-directional Dijkstra when provided with a single (source, target) pair, I agree with you and I'll focus on M2M. |
This is the original paper this is based on, but please note that at the time this was published CH did not exist yet (they use Highway Hierarchies, but the approach in general can be transferred to any hierarchical pre-processing method). The The |
Thanks! I should have connected the dots already (the Knopp et al. article you've cited is also cited by Geisberger et al. in their fast detour computation article). |
I dug a little bit / toyed around with some I ran a M2M search with one single origin (Paris, France) and one single destination (Marseille, France). Given the size of the graph (full France OSM extract is about 12M nodes after contraction) and the distance between origin and destination (600km). I expected tens of thousands calls to the Using the same M2M settings I tried to gain more insights on the contracted network. To do so I check the OSM node identifiers for nodes examined by
These nodes are literally on the four corners of the France. How is that possible ? Also I wonder what represent the target_weight ? May be I'm not reading the information where I should ? I used the |
@Fkawala These results are in line with how Contraction Hierarchies work. There is no rigorous theoretical proof on why the CH search space is so small for road networks but the intuition is that a road network contains few important points that most longer routes will cross. These points are connected by shortcuts and allow you to "jump" efficiently from one side to the other side of the country. These shortcut edges is also why you see edges going to all over the map. |
@TheMarex thanks ! |
I try to go further than the initial solution proposed by Geisberger et al. More precisely, I would like to allow detours that imply for the passenger to move from her-his departure (resp. arrival). To do that, I would need to borrow code from #3652 / Phast. Ideally the calculations I'd do for the passenger would use the foor.lua profile to compute paths / distances from a pedestrian POV. Is that sound feasible to do computations wrt to two different lua profiles ? |
Stale. |
I'm investigating the possibility to implement Geisberger et al. [1] proposal for fast detour computation using OSRM.
So far I've toy-ed around with the OSRM-as-a-library example.
From what I get the
manyToManySearch
function could do pretty much the core calculation presented in section 3. Hence, to compute the acceptable detours for a ride, I would save thesearch_space_with_buckets
for the upward search space and for the downward search space. Does that sounds reasonable ? If so how/where should I start ? Do have some documentation that might helps me ?Best regards,
François.
[1] http://lekv.de/pub/Mitfahr-Paper.pdf
The text was updated successfully, but these errors were encountered: