Repository navigation
Conversation
Changed Min Bendiness to 1 again Changed .sh Changed Formatting Fixed Formatting Changed Curvature Parameters Fixed the Tests Fixed the Tests
7cc51cd to
26ada28
Compare
|
What are the advantages over a custom weighting? |
|
The idea was to make it independant from the weighting. So that fastest, shortest, curvature, what ever works with unique paths. But I think adding it to the weighting seems natural. How about extending the weighting interface so that additional weighting strategies can be defined (basically a strategy pattern). This would allow us to define additional strategies (or boosters/modifiers) for a given weighting. A possible use case are the unique paths. Other usecases are possible as well. E.g. Consider current traffic situation. |
Yes, this is a good idea - I would avoid fiddling with the algorithms as it they are complex enough and we hopefully get more of them and tune them further. We also need this more configurable |
|
@karussell I just added the Interface for the weighting strategy. What do you think? Are you happy with that architecture? |
Hmmh :) ... then the rest of the changes like in GraphHopper.java won't be necessary, right? We really have to be careful here regarding performance and need a mechanism which adds no overhead. E.g. using the 'new' ;) for-loop pattern is slower than via indices. What do you think about the superWeighting mechanism instead (used for TurnWeighting)? One would have to measure the fastest and potentially refactor the TurnWeighting. Still I think this has to be decoupled from this issue in the first place, maybe finally we can implement a simple AvoidEdgeIdWeightingStrategy or something, here? |
There was a problem hiding this comment.
btw: lazy initialization here is not good as although calcPath is single threaded in core GH, this can change and others can have multi-threaded algos. A weighting should be seen as read-only.
There was a problem hiding this comment.
Yes I thought about it and thought that a null check is faster then querying size.
BTW: there is a simple procedure to measure if there is a difference: |
The changes in GraphHopper.java are still necessary. The issue is, calcWeight does not know if the edge was used or not. So you have to update, once a When avoiding already explored edges, no path will be found (I tried that first).
I thought about chaining weighting objects (this is basically the same as in TurnWeighting?). I chose this approach because I think it is more flexible and less magic is involved. But performance wise it is probably faster, especially if no modification is set. |
|
@karussell I just thought about this issue. Probably something like the TurnWeighting makes more sense in this case, because we do not change anything if we only use a regular Weighting. I will change this PR accordingly. |
c672152 to
2dc9063
Compare
|
@karussell My changes are pushed. I hope you like it. Unfortunately I pulled from the graphhopper master and github shows all changes made including the ones from master. |
Hmmh, that is strange and hard to review, also merging this will lead to a confusing history - can you clone the latest master again and copy just the 3 files you changed? As you have the abstract weighting class: I would either refactor the TurnWeighting to use the abstract class also there or remove the abstract class completely as all 'abstract' classes with just one implementation are a bit overhead :) |
2dc9063 to
4d9085c
Compare
Added Unique Path Calculation, using a WeightWrapping Mechanismn Added Weighting Strategy Updated UniquePath calculation Removed Already Visited Edges Remove Old Class Added Tests Removed history
3d48905 to
b6eccee
Compare
|
Ok, I will close this PR. |
This PR contains the possibility to request unique paths.
This is possible by adding
unique_paths=trueto the request. Currently this only works withDijkstraand theDijkstraBi.