Skip to content

Commit 2a15e6d

Browse files
ghoshkajPatrick Niklaus
authored andcommitted
Add support for annotations=distances in MLD
This commit brings feature parity with CH for the `table` pluging.
1 parent 1a12936 commit 2a15e6d

File tree

13 files changed

+793
-115
lines changed

13 files changed

+793
-115
lines changed

features/testbot/distance_matrix.feature

Lines changed: 85 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@matrix @testbot @ch
1+
@matrix @testbot
22
Feature: Basic Distance Matrix
33
# note that results of travel distance are in metres
44

@@ -21,6 +21,7 @@ Feature: Basic Distance Matrix
2121
| a | 0 | 100+-1 |
2222
| b | 100+-1 | 0 |
2323

24+
@ch
2425
Scenario: Testbot - Travel distance matrix of minimal network with toll exclude
2526
Given the query options
2627
| exclude | toll |
@@ -45,6 +46,7 @@ Feature: Basic Distance Matrix
4546
| c | | | 0 | 100+-1 |
4647
| d | | | 100+-1 | 0 |
4748

49+
@ch
4850
Scenario: Testbot - Travel distance matrix of minimal network with motorway exclude
4951
Given the query options
5052
| exclude | motorway |
@@ -66,8 +68,8 @@ Feature: Basic Distance Matrix
6668
| | a | b | c | d |
6769
| a | 0 | 300+-2 | 100+-2 | 200+-2 |
6870

69-
70-
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
71+
@ch
72+
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
7173
Given the query options
7274
| exclude | motorway |
7375
And the extract extra arguments "--small-component-size 4"
@@ -88,7 +90,7 @@ Feature: Basic Distance Matrix
8890
| | a | b | e |
8991
| a | 0 | 50+-1 | |
9092

91-
93+
@ch
9294
Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes
9395
Given the query options
9496
| exclude | motorway,toll |
@@ -212,6 +214,13 @@ Feature: Basic Distance Matrix
212214
| be |
213215
| cf |
214216

217+
When I route I should get
218+
| from | to | distance |
219+
| e | a | 200m +- 1 |
220+
| e | b | 100m +- 1 |
221+
| f | a | 300m +- 1 |
222+
| f | b | 200m +- 1 |
223+
215224
When I request a travel distance matrix I should get
216225
| | a | b | e | f |
217226
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
@@ -255,7 +264,6 @@ Feature: Basic Distance Matrix
255264
| e | 200+-1 | 100+-1 | 0 | 100+-1 |
256265
| f | 300+-1 | 200+-1 | 100+-1 | 0 |
257266

258-
259267
Scenario: Testbot - Travel distance 3x2 matrix
260268
Given the node map
261269
"""
@@ -445,10 +453,21 @@ Feature: Basic Distance Matrix
445453
| 7 | 300+-5 | 200+-5 | 600+-5 | 500+-5 | 900+-5 | 800+-5 | 0 | 1100+-5 |
446454
| 8 | 400+-5 | 300+-5 | 700+-5 | 600+-5 | 1000+-5 | 900+-5 | 100+-5 | 0 |
447455

456+
When I request a travel distance matrix I should get
457+
| | 1 |
458+
| 1 | 0 |
459+
| 2 | 100+-5 |
460+
| 3 | 900+-5 |
461+
| 4 | 1000+-5 |
462+
| 5 | 600+-5 |
463+
| 6 | 700+-5 |
464+
| 7 | 300+-5 |
465+
| 8 | 400+-5 |
466+
448467
Scenario: Testbot - Travel distance matrix with ties
449468
Given the node map
450469
"""
451-
a b
470+
a b
452471
453472
c d
454473
"""
@@ -466,21 +485,26 @@ Feature: Basic Distance Matrix
466485

467486
When I route I should get
468487
| from | to | route | distance |
469-
| a | b | ab,ab | 300m +- 1 |
488+
| a | b | ab,ab | 450m |
470489
| a | c | ac,ac | 200m |
471-
| a | d | ab,bd,bd | 500m +- 1 |
490+
| a | d | ac,dc,dc | 500m +- 1 |
472491

473492
When I request a travel distance matrix I should get
474493
| | a | b | c | d |
475-
| a | 0 | 300+-2 | 200+-2 | 500+-2 |
494+
| a | 0 | 450+-2 | 200+-2 | 500+-2 |
476495

477496
When I request a travel distance matrix I should get
478497
| | a |
479498
| a | 0 |
480-
| b | 300+-2 |
499+
| b | 450+-2 |
481500
| c | 200+-2 |
482501
| d | 500+-2 |
483502

503+
When I request a travel distance matrix I should get
504+
| | a | c |
505+
| a | 0 | 200+-2 |
506+
| c | 200+-2 | 0 |
507+
484508

485509
# Check rounding errors
486510
Scenario: Testbot - Long distances in tables
@@ -492,8 +516,58 @@ Feature: Basic Distance Matrix
492516

493517
And the ways
494518
| nodes |
495-
| abcd |
519+
| abcd |
496520

497521
When I request a travel distance matrix I should get
498522
| | a | b | c | d |
499523
| a | 0 | 1000+-3 | 2000+-3 | 3000+-3 |
524+
525+
526+
Scenario: Testbot - OneToMany vs ManyToOne
527+
Given the node map
528+
"""
529+
a b
530+
c
531+
"""
532+
533+
And the ways
534+
| nodes | oneway |
535+
| ab | yes |
536+
| ac | |
537+
| bc | |
538+
539+
When I request a travel distance matrix I should get
540+
| | a | b |
541+
| b | 240.4 | 0 |
542+
543+
When I request a travel distance matrix I should get
544+
| | a |
545+
| a | 0 |
546+
| b | 240.4 |
547+
548+
Scenario: Testbot - Varying distances between nodes
549+
Given the node map
550+
"""
551+
a b c d
552+
553+
e
554+
555+
556+
557+
f
558+
"""
559+
560+
And the ways
561+
| nodes | oneway |
562+
| feabcd | yes |
563+
| ec | |
564+
| fd | |
565+
566+
When I request a travel distance matrix I should get
567+
| | a | b | c | d | e | f |
568+
| a | 0 | 100+-1 | 300+-1 | 650+-1 | 1930+-1 | 1533+-1 |
569+
| b | 760+-1 | 0 | 200+-1 | 550+-1 | 1830+-1 | 1433+-1 |
570+
| c | 560+-2 | 660+-2 | 0 | 350+-1 | 1630+-1 | 1233+-1 |
571+
| d | 1480+-2 | 1580+-1 | 1780+-1 | 0 | 1280+-1 | 883+-1 |
572+
| e | 200+-2 | 300+-2 | 500+-1 | 710+-1 | 0 | 1593+-1 |
573+
| f | 597+-1 | 696+-1 | 896+-1 | 1108+-1 | 400+-3 | 0 |

features/testbot/duration_matrix.feature

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,25 @@ Feature: Basic Duration Matrix
488488
| b | 1 |
489489
| c | 15 |
490490
| d | 10 |
491+
492+
Scenario: Testbot - OneToMany vs ManyToOne
493+
Given the node map
494+
"""
495+
a b
496+
c
497+
"""
498+
499+
And the ways
500+
| nodes | oneway |
501+
| ab | yes |
502+
| ac | |
503+
| bc | |
504+
505+
When I request a travel time matrix I should get
506+
| | a | b |
507+
| b | 24.1 | 0 |
508+
509+
When I request a travel time matrix I should get
510+
| | a |
511+
| a | 0 |
512+
| b | 24.1 |

features/testbot/multi_level_routing.feature

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,40 @@ Feature: Multi level routing
106106
| l | 144.7 | 60 |
107107
| o | 124.7 | 0 |
108108

109+
110+
When I request a travel distance matrix I should get
111+
| | a | f | l | o |
112+
| a | 0+-2 | 2287+-2 | 1443+-2 | 1243+-2 |
113+
| f | 2284+-2 | 0+-2 | 1241+-2 | 1443+-2 |
114+
| l | 1443+-2 | 1244+-2 | 0+-2 | 600+-2 |
115+
| o | 1243+-2 | 1444+-2 | 600+-2 | 0+-2 |
116+
117+
When I request a travel distance matrix I should get
118+
| | a | f | l | o |
119+
| a | 0 | 2287.2+-2 | 1443+-2 | 1243+-2 |
120+
121+
When I request a travel distance matrix I should get
122+
| | a |
123+
| a | 0 |
124+
| f | 2284.5+-2 |
125+
| l | 1443.1 |
126+
| o | 1243 |
127+
128+
When I request a travel distance matrix I should get
129+
| | a | f | l | o |
130+
| a | 0 | 2287+-2 | 1443+-2 | 1243+-2 |
131+
| o | 1243 | 1444+-2 | 600+-2 | 0+-2 |
132+
133+
134+
When I request a travel distance matrix I should get
135+
| | a | o |
136+
| a | 0+-2 | 1243+-2 |
137+
| f | 2284+-2 | 1443+-2 |
138+
| l | 1443+-2 | 600+-2 |
139+
| o | 1243+-2 | 0+-2 |
140+
141+
142+
109143
Scenario: Testbot - Multi level routing: horizontal road
110144
Given the node map
111145
"""

features/testbot/traffic_speeds.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Feature: Traffic - speeds
5454
| a | d | ad,ad | 27 km/h | 1275.7,0 | 1 |
5555
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 |
5656
| g | b | fb,fb | 36 km/h | 164.7,0 | 0 |
57-
| a | g | ad,df,fb,fb | 30 km/h | 1275.7,487.5,304.7,0 | 1:0:0 |
57+
| a | g | ad,df,fb,fb | 30 km/h | 1295.7,487.5,304.7,0 | 1:0:0 |
5858

5959

6060
Scenario: Weighting based on speed file weights, ETA based on file durations

include/engine/routing_algorithms/many_to_many.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@ namespace engine
1515
{
1616
namespace routing_algorithms
1717
{
18-
1918
namespace
2019
{
2120
struct NodeBucket
2221
{
2322
NodeID middle_node;
2423
NodeID parent_node;
24+
bool from_clique_arc;
2525
unsigned column_index; // a column in the weight/duration matrix
2626
EdgeWeight weight;
2727
EdgeDuration duration;
2828

2929
NodeBucket(NodeID middle_node,
3030
NodeID parent_node,
31+
bool from_clique_arc,
3132
unsigned column_index,
3233
EdgeWeight weight,
3334
EdgeDuration duration)
34-
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
35-
weight(weight), duration(duration)
35+
: middle_node(middle_node), parent_node(parent_node), from_clique_arc(from_clique_arc),
36+
column_index(column_index), weight(weight), duration(duration)
3637
{
3738
}
3839

0 commit comments

Comments
 (0)