Repository navigation
Conversation
|
@karussell impressive stats and properties! |
|
This is now rebased to latest master. (A bit ugly that too many unrelated changes were made due to code formatting changes in-between, but fixing this is not that important here IMO) It finally works for EU-wide queries and should work world wide, so that we can include this in 0.9 after some TODOs are solved (updated them above) The main things I've fiddling with were related with subnetwork issues, which are now covered in the tests. Now we detect if two nodes are in the same subnetwork and only then proceed with this landmark-approach otherwise use the beeline algorithm. And so we have to store the subnetwork ID per node, which made the SubnetworkStorage necessary. Furthermore we need a special landmark-mapping (2) so that we know which node IDs the landmarks have in which subnetwork, so that we can still use only one large array, where we store all the weights of the landmarks (1). So the data structures are as follows: SubnetworkStorage.da: just a large byte array storing the subnetwork ID for every node LandmarkStorage.landmarkWeightDA: (1) the first bytes of this DataAccess store the landmark weights: and (2) then the landmark-subnetwork mapping follows: |
|
It is interesting how the visited nodes area (yellow) varies with only minor changes to the start&end location (route is blue). There is probably potential to improve this or some bug - maybe related to some overflow or too imprecise storage of the weights (using only short)? The subnetworks still make problems for world wide import :( |
|
Excellent progress @karussell.
Do you think this is a bug? My first impression (really just an impression, I have nothing to support this) is that you placed the points in the upper picture at a location that might be valid for taking two possible "good highways". When looking at the right point in the upper picture you can see how the other reasonable good highway was followed for some time (the yellow line going north/east). It is hard to explain :). But maybe I am wrong? |
|
I do not know if this is a bug, have not much investigated yet. Before I thought the starting and ending area looked strange as there were sometimes many yellow nodes, but now the more I think about it it is probably how the algo works ... |
…rict two-direction filter does not work properly
|
Finally it 'works' world wide. The remaining problem is that the landmark count for EU+Asia+Africa is too small (when using 16) as those areas are connected via 'landline' and ferries, see this. Not sure about the perfect solution. We could disconnect those via introducing border restrictions, increase the landmarks (will try now), artificially introduce subnetworks for the landmarks or something. 5 subnetworks were created: EU+Asia+Africa; Australia; Northern America; Southern America; Malaysia. Strange, where is Japan? One big enough subnetwork near Malaysia (>500K nodes) still has problems to create the landmarks: "next start node not found in big enough network of size 806392, first element is 103853491, 5.515810225512316,95.84255935644863" BTW: creating the landmark weights takes ~70 minutes for car with 16 landmarks, i.e. roughly 5min per landmark. Including subnetwork calculation, landmark assignment and finally the weight calculation for every subnetwork. |
|
As we need more separated areas e.g. to split EU/Asia/Africa into its parts we could also need #926 |
| // 1a) pick landmarks via shortest weighting for a better geographical spreading | ||
| // 'fastest' has big problems with ferries (slow&very long) and allowing arbitrary weighting is too dangerous | ||
| Weighting initWeighting = lmSelectionWeighting; | ||
| Explorer explorer = new Explorer(graph, this, initWeighting, traversalMode); |
There was a problem hiding this comment.
Thought at first this would be the EdgeExplorer. Maybe explicitly call this LandmarkExplorer?
| } | ||
|
|
||
| public boolean setSubnetworks(final byte[] subnetworks, final int subnetworkId) { | ||
| if (subnetworkId > 127) |
There was a problem hiding this comment.
This is not variable ;(
There was a problem hiding this comment.
Yes, put it in a constant, sorry ;).
|
Thanks for the review will do what you said and also try to be more descriptive in code and with more javadocs. |
Sorry I was really picky with the naming this time. I tried to understand what was happening and just saw that in some cases the names didn't reflected the logic :). |
…namic recalculation but this does not work yet without manual tuning
|
I've added the possibility to use hand picked landmarks instead of calculated once per subnetwork, which is not only faster but >2 times faster for country sized areas. Will change as requested now and include the spatial index stuff to split the area in smaller subnetworks (only for world wide scenario) for better speed of landmarks. |
| * This method calculates the landmarks and initial weightings to & from them. | ||
| */ | ||
| public void createLandmarks() { | ||
| public void createLandmarksForSubnetwork() { |
There was a problem hiding this comment.
oh, it looks like intelliJ has renamed this at the same time ;)
|
BTW: I found that the spatial index json (map.geo.json) had lots of IDs "-99". Now that we throw exceptions in those duplicative cases I had to edit this field and stumbled over e.g. France where this was obviously incorrect (FRA) and also for Norway (NOR). For the others I've just put an increasing counter before the -99 ... |
|
Three last steps to make this mergable (if no other objections :))
|
Oh, I missed that. There is actually an issue open for that. Sorry for the troubles. datasets/geo-countries#5 |
This is no longer true - I've tuned autopicking landmarks with a simple trick using no 'fastest' or 'shortest' weighting but just use BFS and return 1 as weighting which leads to 5% faster landmarks than handpicked and roughly 22x faster response times for Germany (22x faster on average!). |
No trouble at all - it was detected & fixed in <5min :) |
… using weight==1 instead distance; split area only for LM preparation and add unit test; fix factor calculation for small areas; make it possible to load split area geojson from file
|
Nice, everything works, also world wide with even better response times after the recent weighting change. Will merge after a few cosmetics. |
|
Merge now. I had to made a few minor changes to the spatialrule lookup @boldtrn please have a look if this is ok. |
|
Awesome! Happy to see this feature merged.
Looks good to me. The factory is a good idea. So it's easy to inject custom SpatialRules 👍 |

I've developed over the last months a new speed up algorithm (actually the initial prototype was done in a day ;))
Enable with:
prepare.lm.weightings=fastestin the config.properties&ch.disable=trueif CH is enabledThe speedup is 17x faster compared to the fastest flexible algorithm (A* with a distance estimate) for German wide random requests and 16 landmarks. It is 25x faster with 32 landmarks.
The per-request memory improvements are in a similar range i.e. ~X times faster means ~X times less visited nodes. The static memory requirements are comparable to CH for world wide case and 16 landmarks. More memory for more landmarks.
Some other good properties are:
pass_throughetc or if you would want to exclude ferries or motorwaysThere are only a few remaining TODOs:
Hint: use graph.do_sort=true for 5-10% better routing and preparation performance
Later