Skip to content

Speed up CH for foot - #2514

Merged
easbar merged 11 commits into
masterfrom
mean_degree_factor
Feb 16, 2022
Merged

easbar merged 11 commits into
masterfrom
mean_degree_factor

Conversation

@easbar

@easbar easbar commented Feb 2, 2022 •

Copy link
Copy Markdown
Member

Fixes #2507.

Two things we could do to improve this:

After lots of experimenting I arrived at a version that works well for car and foot (and country_rules as well) using default parameters (the same for both profiles). I still use neighbor updates as in #2491, because this allows reducing the shortcut numbers, but I went back to adjusting the maximum number of settled nodes based on the mean degree of the graph instead of keeping it constant throughout the entire preparation. The factor that is used to determine the number of maximum number of settled nodes from the mean degree is now a tuning parameter (actually two: one for priority calculation and one for the contraction). There is also another new parameter that allows limiting the number of neighbor updates per node.

To benchmark my results I used this commit: 7082297, so just before #2491. I got this:

  vehicle      map   t_total  t_period  t_neighbor   t_lazy  t_contr  shortcuts  query  failed       dummy
0     car  germany    176.81     76.84       32.06    18.15    43.96    7380812  1.356      85    69376783
1     car   europe   1526.48    578.80      323.31   196.91   381.55   60378311  1.514      85    69250710
2     car   planet   5518.90   1961.99     1290.32   749.15  1363.71  223885440  1.643      24    69539356
3    foot  germany    866.87    258.30      295.11   147.44   155.00   20771335  4.220      57  1032616176
4    foot   europe   5225.88   1422.77     1797.37   926.19  1003.18  119770559  3.688      58  1030103581
5    foot   planet  13389.75   4269.26     4070.32  2312.93  2532.51  322852419  3.779      19  1031819233

t_total is the CH preparation time in seconds, shortcuts the number of created shortcuts and query the average query time using random queries in Bavaria in ms.

For this branch I got for car/planet (I copied the benchmark data from above for better readability)

  vehicle      map  neighbor_max   t_total  t_period  t_neighbor   t_lazy  t_contr  shortcuts  query  failed       dummy
0     car  planet             5   4680.12    420.96     2322.51   773.62  1027.22  203305137  1.582      24    69539359
1     car  planet             2   4517.43    413.17     1825.70  1013.56  1115.64  210875372  1.500      24    69539361
--- benchmark
2     car  planet             -   5518.90   1961.99     1290.32   749.15  1363.71  223885440  1.643      24    69539356

and for foot/planet:

  vehicle      map  neighbor_max   t_total  t_period  t_neighbor   t_lazy  t_contr  shortcuts  query  failed       dummy
0    foot  planet             5  11990.42    579.07     7342.81  1990.92  1835.28  302747715  3.986      19  1031819232
1    foot  planet             2  10260.37    596.18     4598.70  2832.17  2040.38  312983091  3.806      19  1031819231
-- benchmark
2    foot  planet             -  13389.75   4269.26     4070.32  2312.93  2532.51  322852419  3.779      19  1031819233

We see that for both the foot and car profile the preparation time is faster, the shortcuts are less and the query time is either about equal or slightly faster, depending on the new parameter neighbor_max that I set to 2 and 5 here.

For Europe the new branch also works better:

  vehicle     map  neighbor_max  t_total  t_period  t_neighbor  t_lazy  t_contr  shortcuts  query  failed     dummy
0     car  europe            -1  1131.17    101.71      563.12  164.26   261.93   55406484  1.357      85  69250710
1     car  europe            10  1117.52    101.34      548.40  164.70   262.40   55417098  1.362      85  69250708
2     car  europe             5  1089.58    101.92      508.55  168.11   270.14   55518276  1.391      85  69250708
3     car  europe             2  1044.15    101.27      409.84  209.32   281.53   57037606  1.391      85  69250709
--- benchmark
4     car   europe            -  1526.48    578.80      323.31   196.91   381.55   60378311  1.514      85    69250710
  vehicle     map neighbor_max  t_total  t_period  t_neighbor   t_lazy  t_contr  shortcuts  query  failed       dummy
0    foot  europe           -1  6885.67    177.27     5343.68   635.52   663.92  113131197  3.327      58  1030103571
1    foot  europe           10  5373.92    175.20     3813.17   648.22   671.08  113172449  3.337      58  1030103574
2    foot  europe            5  4586.25    177.22     2947.22   739.54   656.37  113501003  3.461      58  1030103579
3    foot  europe            2  3715.17    177.17     1719.40  1018.65   732.45  116806227  3.503      58  1030103578
--- benchmark
4    foot  europe            -  5225.88   1422.77     1797.37   926.19  1003.18  119770559  3.688      58  1030103581

Using neighbor_max we actually can choose between faster preparation, less shortcuts and faster queries. For now I chose neighbor_max=2 as default.

Including country rules (for Germany), c.f. #2375, I get this:

before:

   vehicle     pbf  periodic   lazy  neighbor  edge_diff  orig_edges   t_total  t_period  t_neighbor  t_lazy  t_contr  shortcuts  query  failed     dummy country_rules
0     car  germany      20.0   10.0      20.0       10.0         1.0    231.20    103.13       40.62   21.60    59.70    7255266  1.356      85  96031267          true
1     car  germany      20.0   10.0      20.0       10.0         1.0    177.70     77.16       32.32   18.29    44.19    7382932  1.372      85  69376777         false

after:

   vehicle      pbf  periodic   lazy  neighbor  neighbor_max  edge_diff  orig_edges  mpf_heur  mpf_contr  t_total  t_period  t_neighbor  t_lazy  t_contr  shortcuts  query  failed     dummy country_rules
0      car  germany       0.0  100.0     100.0           2.0       10.0         1.0       5.0      200.0    188.57     14.73       48.16   22.94    97.25    6754789  1.354      85  96031262          true
1      car  germany       0.0  100.0     100.0           2.0       10.0         1.0       5.0      200.0    124.32     14.89       46.81   22.93    33.74    7051462  1.387      85  69376780         false

Also here we get less shortcuts and a faster preparation time than before without slowing down the queries, no matter whether country rules are enabled. The GermanyCountryRule still does slow down the preparation by around 50%. This can be improved by decreasing the maximum poll factor for contraction (mpf_contr). Note how t_contr goes down from around 97s to 61s while the number of shortcuts goes only slightly up (~1%)

   vehicle      pbf  periodic   lazy  neighbor  neighbor_max  edge_diff  orig_edges  mpf_heur  mpf_contr  t_total  t_period  t_neighbor  t_lazy  t_contr  shortcuts  query  failed     dummy country_rules
0      car  germany       0.0  100.0     100.0           2.0       10.0         1.0       5.0      150.0    158.43     14.93       44.20   21.45    72.14    6785332  1.374      85  96031263    true
1      car  germany       0.0  100.0     100.0           2.0       10.0         1.0       5.0      100.0    147.03     14.31       45.03   21.57    61.12    6839704  1.314      85  96031261    true

@easbar easbar added this to the 5.0 milestone Feb 2, 2022
@easbar
easbar merged commit e9b5973 into master Feb 16, 2022
@easbar
easbar deleted the mean_degree_factor branch February 16, 2022 08:43
@karussell

Copy link
Copy Markdown
Member

Thanks a bunch for this work!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CH preparation for foot is too slow

2 participants