Skip to content

Commit

Permalink
Add support for annotations=distances in MLD
Browse files Browse the repository at this point in the history
This commit brings feature parity with CH for the `table` pluging.
  • Loading branch information
ghoshkaj authored and TheMarex committed May 8, 2018
1 parent 1a12936 commit 22acbe4
Show file tree
Hide file tree
Showing 13 changed files with 793 additions and 115 deletions.
96 changes: 85 additions & 11 deletions features/testbot/distance_matrix.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@matrix @testbot @ch
@matrix @testbot
Feature: Basic Distance Matrix
# note that results of travel distance are in metres

Expand All @@ -21,6 +21,7 @@ Feature: Basic Distance Matrix
| a | 0 | 100+-1 |
| b | 100+-1 | 0 |

@ch
Scenario: Testbot - Travel distance matrix of minimal network with toll exclude
Given the query options
| exclude | toll |
Expand All @@ -45,6 +46,7 @@ Feature: Basic Distance Matrix
| c | | | 0 | 100+-1 |
| d | | | 100+-1 | 0 |

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


Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
@ch
Scenario: Testbot - Travel distance matrix of minimal network disconnected motorway exclude
Given the query options
| exclude | motorway |
And the extract extra arguments "--small-component-size 4"
Expand All @@ -88,7 +90,7 @@ Feature: Basic Distance Matrix
| | a | b | e |
| a | 0 | 50+-1 | |


@ch
Scenario: Testbot - Travel distance matrix of minimal network with motorway and toll excludes
Given the query options
| exclude | motorway,toll |
Expand Down Expand Up @@ -212,6 +214,13 @@ Feature: Basic Distance Matrix
| be |
| cf |

When I route I should get
| from | to | distance |
| e | a | 200m +- 1 |
| e | b | 100m +- 1 |
| f | a | 300m +- 1 |
| f | b | 200m +- 1 |

When I request a travel distance matrix I should get
| | a | b | e | f |
| a | 0 | 100+-1 | 200+-1 | 300+-1 |
Expand Down Expand Up @@ -255,7 +264,6 @@ Feature: Basic Distance Matrix
| e | 200+-1 | 100+-1 | 0 | 100+-1 |
| f | 300+-1 | 200+-1 | 100+-1 | 0 |


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

When I request a travel distance matrix I should get
| | 1 |
| 1 | 0 |
| 2 | 100+-5 |
| 3 | 900+-5 |
| 4 | 1000+-5 |
| 5 | 600+-5 |
| 6 | 700+-5 |
| 7 | 300+-5 |
| 8 | 400+-5 |

Scenario: Testbot - Travel distance matrix with ties
Given the node map
"""
a b
a b
c d
"""
Expand All @@ -466,21 +485,26 @@ Feature: Basic Distance Matrix

When I route I should get
| from | to | route | distance |
| a | b | ab,ab | 300m +- 1 |
| a | b | ab,ab | 450m |
| a | c | ac,ac | 200m |
| a | d | ab,bd,bd | 500m +- 1 |
| a | d | ac,dc,dc | 500m +- 1 |

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

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

When I request a travel distance matrix I should get
| | a | c |
| a | 0 | 200+-2 |
| c | 200+-2 | 0 |


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

And the ways
| nodes |
| abcd |
| abcd |

When I request a travel distance matrix I should get
| | a | b | c | d |
| a | 0 | 1000+-3 | 2000+-3 | 3000+-3 |


Scenario: Testbot - OneToMany vs ManyToOne
Given the node map
"""
a b
c
"""

And the ways
| nodes | oneway |
| ab | yes |
| ac | |
| bc | |

When I request a travel distance matrix I should get
| | a | b |
| b | 240.4 | 0 |

When I request a travel distance matrix I should get
| | a |
| a | 0 |
| b | 240.4 |

Scenario: Testbot - Varying distances between nodes
Given the node map
"""
a b c d
e
f
"""

And the ways
| nodes | oneway |
| feabcd | yes |
| ec | |
| fd | |

When I request a travel distance matrix I should get
| | a | b | c | d | e | f |
| a | 0 | 100+-1 | 300+-1 | 650+-1 | 1930+-1 | 1533+-1 |
| b | 760+-1 | 0 | 200+-1 | 550+-1 | 1830+-1 | 1433+-1 |
| c | 560+-2 | 660+-2 | 0 | 350+-1 | 1630+-1 | 1233+-1 |
| d | 1480+-2 | 1580+-1 | 1780+-1 | 0 | 1280+-1 | 883+-1 |
| e | 200+-2 | 300+-2 | 500+-1 | 710+-1 | 0 | 1593+-1 |
| f | 597+-1 | 696+-1 | 896+-1 | 1108+-1 | 400+-3 | 0 |
22 changes: 22 additions & 0 deletions features/testbot/duration_matrix.feature
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,25 @@ Feature: Basic Duration Matrix
| b | 1 |
| c | 15 |
| d | 10 |

Scenario: Testbot - OneToMany vs ManyToOne
Given the node map
"""
a b
c
"""

And the ways
| nodes | oneway |
| ab | yes |
| ac | |
| bc | |

When I request a travel time matrix I should get
| | a | b |
| b | 24.1 | 0 |

When I request a travel time matrix I should get
| | a |
| a | 0 |
| b | 24.1 |
34 changes: 34 additions & 0 deletions features/testbot/multi_level_routing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,40 @@ Feature: Multi level routing
| l | 144.7 | 60 |
| o | 124.7 | 0 |


When I request a travel distance matrix I should get
| | a | f | l | o |
| a | 0+-2 | 2287+-2 | 1443+-2 | 1243+-2 |
| f | 2284+-2 | 0+-2 | 1241+-2 | 1443+-2 |
| l | 1443+-2 | 1244+-2 | 0+-2 | 600+-2 |
| o | 1243+-2 | 1444+-2 | 600+-2 | 0+-2 |

When I request a travel distance matrix I should get
| | a | f | l | o |
| a | 0 | 2287.2+-2 | 1443+-2 | 1243+-2 |

When I request a travel distance matrix I should get
| | a |
| a | 0 |
| f | 2284.5+-2 |
| l | 1443.1 |
| o | 1243 |

When I request a travel distance matrix I should get
| | a | f | l | o |
| a | 0 | 2287+-2 | 1443+-2 | 1243+-2 |
| o | 1243 | 1444+-2 | 600+-2 | 0+-2 |


When I request a travel distance matrix I should get
| | a | o |
| a | 0+-2 | 1243+-2 |
| f | 2284+-2 | 1441+-2 |
| l | 1443+-2 | 600+-2 |
| o | 1243+-2 | 0+-2 |



Scenario: Testbot - Multi level routing: horizontal road
Given the node map
"""
Expand Down
2 changes: 1 addition & 1 deletion features/testbot/traffic_speeds.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Feature: Traffic - speeds
| a | d | ad,ad | 27 km/h | 1275.7,0 | 1 |
| d | c | dc,dc | 36 km/h | 956.8,0 | 0 |
| g | b | fb,fb | 36 km/h | 164.7,0 | 0 |
| a | g | ad,df,fb,fb | 30 km/h | 1275.7,487.5,304.7,0 | 1:0:0 |
| a | g | ad,df,fb,fb | 30 km/h | 1295.7,487.5,304.7,0 | 1:0:0 |


Scenario: Weighting based on speed file weights, ETA based on file durations
Expand Down
7 changes: 4 additions & 3 deletions include/engine/routing_algorithms/many_to_many.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,25 @@ namespace engine
{
namespace routing_algorithms
{

namespace
{
struct NodeBucket
{
NodeID middle_node;
NodeID parent_node;
bool from_clique_arc;
unsigned column_index; // a column in the weight/duration matrix
EdgeWeight weight;
EdgeDuration duration;

NodeBucket(NodeID middle_node,
NodeID parent_node,
bool from_clique_arc,
unsigned column_index,
EdgeWeight weight,
EdgeDuration duration)
: middle_node(middle_node), parent_node(parent_node), column_index(column_index),
weight(weight), duration(duration)
: middle_node(middle_node), parent_node(parent_node), from_clique_arc(from_clique_arc),
column_index(column_index), weight(weight), duration(duration)
{
}

Expand Down
Loading

0 comments on commit 22acbe4

Please sign in to comment.