Skip to content

noisy_road_nearby encoded value - #3039

Open
ratrun wants to merge 38 commits into
graphhopper:masterfrom
ratrun:noisyRoadNearby
Open

ratrun wants to merge 38 commits into
graphhopper:masterfrom
ratrun:noisyRoadNearby

Conversation

@ratrun

@ratrun ratrun commented Aug 7, 2024 •

Copy link
Copy Markdown
Contributor

This PR takes the ideas from the landuse PR in #2765 and applies them for the computation of a boolean noisy_road_nearby encoded value. An edge gets classified as noisy in case that its middle position is within a 15 meters range close to one of the following highway types: motorway, motorway_link, trunk, trunk_link, primary, primary_link, secondary, secondary_link.

Currently there are no tests because I would like to know beforehand if there is a chance that this gets merged.

@ratrun

ratrun commented Aug 8, 2024

Copy link
Copy Markdown
Contributor Author

Here are some measurement results for austria-latest.osm.pbf:

current master :         Finished reading OSM file. pass1: 32s,  pass2: 232s,  total: 265s
This branch:
no noisy_road_nearby   : Finished reading OSM file. pass0: 21s,  pass1: 30s,  pass2: 275s,  total: 327s
with noisy_road_nearby : Finished reading OSM file. pass0: 20s,  pass1: 34s,  pass2: 306s,  total: 361s

With some extensions it will be possible provide the information about the absence or presence of the noisy_road_nearby in the graph.encoded_values in order to avoid the new pass0 and the node parsing for pass1 such that there is no slowdown in case that this feature is disabled in the configuration.

@ratrun

ratrun commented Aug 16, 2024

Copy link
Copy Markdown
Contributor Author

@karussell , @easbar Could you please provide feedback here? From my point of view this improves the bicycle (and eventually foot) routing quite a lot and it is worth the slightly increased preparation time.

@karussell

Copy link
Copy Markdown
Member

Looks really interesting in my opinion and improves a problematic route which I always thought should be improved :)

The question is how we determine if it improves routes in general and when this chage introduces too much detour.

Also how much more memory does this require for a planet-wide import? And did I read it correctly that the new pass0 overhead could be removed via "shuffling" the import work a bit?

@ratrun

ratrun commented Aug 17, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look on it!

The question is how we determine if it improves routes in general and when this change introduces too much detour.

This is pretty much in control of the user as he/she may change the priority in the custom model noisy_road_nearby.json, isn't it? The multiply_by factor of 0.9 is rather weak such that the detours should not become too long.

Also how much more memory does this require for a planet-wide import?

With my 8GB RAM I don't have the means to check that. But as you asked, I now added some log information, which @easbar used during his development of the landuse branch: 66447d9. For Austria I get following output:

     COUNT       AVG       SUM   DESCRIPTION
         2        60       120   [B
    134692        82  11116760   [F
         1        16        16   [I
         1       176       176   [J
    149786        64   9668464   [Ljava.lang.Object;
         2        24        48   com.carrotsearch.hppc.BoundedProportionalArraySizingStrategy
         2        24        48   com.carrotsearch.hppc.IntArrayList
         1        64        64   com.graphhopper.coll.GHLongLongBTree
         1        40        40   com.graphhopper.coll.GHLongLongBTree$BTreeEntry
    134692        16   2155072   com.graphhopper.reader.osm.OSMNoisyRoad
         1        24        24   com.graphhopper.reader.osm.OSMNoisyRoadData
         1        24        24   com.graphhopper.reader.osm.OSMNoisyRoadData$LongToTwoIntsMap
         1        24        24   com.graphhopper.routing.util.NoiseIndex
    134692        24   3232608   com.graphhopper.routing.util.NoiseIndex$IndexedNoisyRoad
         1        16        16   com.graphhopper.util.DistanceCalcEarth
         1        24        24   java.lang.String
    149786        24   3594864   java.util.ArrayList
    134692        40   5387680   org.locationtech.jts.geom.CoordinateXY
    284475        48  13654800   org.locationtech.jts.geom.Envelope
         2        24        48   org.locationtech.jts.geom.GeometryFactory
    134692        32   4310144   org.locationtech.jts.geom.LineString
         2        32        64   org.locationtech.jts.geom.PrecisionModel
         1        16        16   org.locationtech.jts.geom.PrecisionModel$Type
         1        16        16   org.locationtech.jts.geom.impl.CoordinateArraySequenceFactory
    134692        32   4310144   org.locationtech.jts.geom.impl.PackedCoordinateSequence$Float
    134692        24   3232608   org.locationtech.jts.geom.prep.PreparedLineString
    134692        24   3232608   org.locationtech.jts.index.strtree.ItemBoundable
         1        32        32   org.locationtech.jts.index.strtree.STRtree
     15092        24    362208   org.locationtech.jts.index.strtree.STRtree$STRtreeNode
   1676697            64258760   (total)

I think that means a total of about 64 MB. But probably this 8.5% fraction of the 750 MB pbf input file size for Austria cannot be extrapolated for the planet. This would better be tried out instead. So maybe you could do it if you have the time and the means? I estimate it would be something in the range of 7-10GB for the planet. I didn't expect that you would think about activating this in the hosted instance per default, but of course this would be nice 😃 But in case that the RAM footprint for the planet is too high, this PR could still be merged and documented as an option.

And did I read it correctly that the new pass0 overhead could be removed via "shuffling" the import work a bit?

The comment about the pass0/pass1/pass2 restructuring is from the landuse branch. I kept it, because I think that it is still valid.

As it seems that you are interested in continuing the work on this PR, I'm now thinking about how this could be best tested. Would it be enough to add one new test in RoutingAlgorithmWithOSMTest.java, which uses one of the existing OSM data input files? I think it should be possible to find a situation in there similar as you pointed out in your example.

@ratrun

ratrun commented Aug 18, 2024

Copy link
Copy Markdown
Contributor Author

In 2fb4b62 I added the Hoyerswerda example from above as a testcase.

@ratrun

ratrun commented Oct 18, 2024

Copy link
Copy Markdown
Contributor Author

I now have access to a 128GB RAM machine. Here is the additional RAM usage for the current planet file:

2024-10-17 21:26:09.680 [main] INFO  c.graphhopper.reader.osm.OSMReader - com.graphhopper.reader.osm.OSMNoisyRoadData@17aa8a11d, com.graphhopper.routing.util.NoiseIndex@4149de88d, java.util.ArrayList@71b639d0d footprint:
     COUNT       AVG       SUM   DESCRIPTION
         2        60       120   [B
  14097387       113 1605720200   [F
         1        16        16   [I
         1       176       176   [J
  15664605       106 1669943800   [Ljava.lang.Object;
         2        24        48   com.carrotsearch.hppc.BoundedProportionalArraySizingStrategy
         2        32        64   com.carrotsearch.hppc.IntArrayList
         1        72        72   com.graphhopper.coll.GHLongLongBTree
         1        56        56   com.graphhopper.coll.GHLongLongBTree$BTreeEntry
  14097387        24 338337288   com.graphhopper.reader.osm.OSMNoisyRoad
         1        32        32   com.graphhopper.reader.osm.OSMNoisyRoadData
         1        40        40   com.graphhopper.reader.osm.OSMNoisyRoadData$LongToTwoIntsMap
         1        40        40   com.graphhopper.routing.util.NoiseIndex
  14097387        32 451116384   com.graphhopper.routing.util.NoiseIndex$IndexedNoisyRoad
         1        16        16   com.graphhopper.util.DistanceCalcEarth
         1        32        32   java.lang.String
  15664605        32 501267360   java.util.ArrayList
  14097387        40 563895480   org.locationtech.jts.geom.CoordinateXY
  29761990        48 1428575520   org.locationtech.jts.geom.Envelope
         2        32        64   org.locationtech.jts.geom.GeometryFactory
  14097387        48 676674576   org.locationtech.jts.geom.LineString
         2        40        80   org.locationtech.jts.geom.PrecisionModel
         1        24        24   org.locationtech.jts.geom.PrecisionModel$Type
         1        16        16   org.locationtech.jts.geom.impl.CoordinateArraySequenceFactory
  14097387        40 563895480   org.locationtech.jts.geom.impl.PackedCoordinateSequence$Float
  14097387        40 563895480   org.locationtech.jts.geom.prep.PreparedLineString
  14097387        32 451116384   org.locationtech.jts.index.strtree.ItemBoundable
         1        40        40   org.locationtech.jts.index.strtree.STRtree
   1567217        32  50150944   org.locationtech.jts.index.strtree.STRtree$STRtreeNode
 175437535           8864589832   (total)

So the estimated extrapolation wit 7-10GB from above was pretty accurate as the measurement resulted in 8.8GB. I believe that this additional RAM usage is OK as it is allocated only during the import process and gets released before the CH calculation starts.

@ratrun
ratrun marked this pull request as ready for review January 6, 2025 07:29

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants