Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative route durations #5967

Open
mjjbell opened this issue Feb 20, 2021 · 1 comment
Open

Negative route durations #5967

mjjbell opened this issue Feb 20, 2021 · 1 comment

Comments

@mjjbell
Copy link
Member

mjjbell commented Feb 20, 2021

Through the use of negative turn penalties, it's possible to return steps, legs or even entire routes that have negative durations.

    Background: 
        Given the node map
            """
            a   b   c   d
            """

        And the nodes
            | node | id |
            | a    | 1  |
            | b    | 2  |
            | c    | 3  |
            | d    | 4  |

        And the ways
            | nodes | highway |
            | ab    | primary |
            | bc    | primary |
            | bc    | primary |
            | cd    | primary |
        And the profile "testbot"


    Scenario: negative route
        Given the turn penalty file
            """
            2,3,4,-70,0
            """
        And the contract extra arguments "--turn-penalty-file {penalties_file}"
        And the customize extra arguments "--turn-penalty-file {penalties_file}"

        When I route I should get
            | from | to | route       | time    |
            | a    | d  | ab,bc,cd,cd | -10     |

I think this should be tightened up. I can't think of a use-case where a negative duration in the result would be desired.

Current implementation

Some observations about the current implementation:

Proposed Fix

My suggestion is to implement the same negative penalty clamping for duration as is done for weight when performing traffic updates. This will prevent steps, legs and routes from having negative duration. It will also provide consistency with the duration clamping that already occurs on the first route edge.

Related

Negative turn penalty discussion - #3683

Copy link

github-actions bot commented Jul 8, 2024

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.

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

No branches or pull requests

2 participants