Use rectified linear unit to prevent negative duration values

This commit is contained in:
Michael Krasnyk
2017-05-02 22:13:20 +02:00
committed by Patrick Niklaus
parent a9d3e61884
commit 334a7b50cd
3 changed files with 44 additions and 4 deletions
+35
View File
@@ -36,3 +36,38 @@ Feature: Projection to nearest point on road
| from | to | route | distance |
| d | b | abc,abc | 0m |
| b | d | abc,abc | 0m |
Scenario: Projection results negative duration
Given the profile file "testbot" extended with
"""
api_version = 1
function segment_function (segment)
segment.weight = 5.5
segment.duration = 2.8
end
"""
Given the node locations
| node | lon | lat |
| e | -51.218994 | -30.023866 |
| f | -51.218918 | -30.023741 |
| 1 | -51.219109 | -30.023766 |
| 2 | -51.219109 | -30.023764 |
| 3 | -51.219109 | -30.023763 |
| 4 | -51.219109 | -30.023762 |
| 5 | -51.219109 | -30.023761 |
| 6 | -51.219109 | -30.023756 |
And the ways
| nodes |
| ef |
When I route I should get
| waypoints | route | distance | time | weight |
| 1,4 | ef,ef | 0.4m | 0.1s | 0.1 |
| 2,4 | ef,ef | 0.1m | 0s | 0 |
| 3,4 | ef,ef | 0.1m | 0s | 0 |
| 4,4 | ef,ef | 0m | 0s | 0 |
| 5,4 | ef,ef | 0.1m | 0s | 0.1 |
| 6,4 | ef,ef | 0.6m | 0.1s | 0.2 |