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

Calculate stretch threshold based on the optimal route cost #3276

Merged
merged 2 commits into from
Aug 18, 2021

Conversation

genadz
Copy link
Contributor

@genadz genadz commented Aug 18, 2021

Issue

closes #3239

What's done:
calculate stretch threshold for alternatives based on the optimal route cost. Approximately the following stretch thresholds we will get:

<= 10min -> 2.
20min -> 1.75
30min -> 1.5
1hour -> 1.4
2hours -> 1.3
>= 5hours -> 1.25

In order to approximate these value an quadratic hyperbolic function was chosen (because this is smooth monotonic function).

Tasklist

  • Add tests
  • Add #fixes with the issue number that this PR addresses
  • Update the docs with any new request parameters or changes to behavior described
  • Update the changelog
  • If you made changes to the lua files, update the taginfo too.

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@genadz
Copy link
Contributor Author

genadz commented Aug 18, 2021

Here are the tables that demonstrate how number of alternatives changed in this PR. For convenience I split all routes into 4 buckets based on their ETAs.

ETA < 10min

total number of routes = 3392

master branch
1-st alternative count 944 1401 (+48%)
2-nd alternative count 345 901 (+160%)

10min < ETA < 30min

total number of routes = 821

master branch
1-st alternative count 435 528 (+21%)
2-nd alternative count 254 361 (+42%)

30min < ETA < 1h

total number of routes = 911

master branch
1-st alternative count 662 691 (+4%)
2-nd alternative count 490 523 (+7%)

1h < ETA < 5h

total number of routes = 4943

master branch
1-st alternative count 3521 3534 (+0.4%)
2-nd alternative count 2312 2320 (+0.3%)

As expected we see significant growth for short routes ( < 30min) and slight changes for medium routes.

@kevinkreiser
Copy link
Member

These numbers look great. I assume it doesn't affect p50 that much because it's still really short routes anyway?

@genadz
Copy link
Contributor Author

genadz commented Aug 18, 2021

Let me share several examples where we started to show alternatives:

ETA < 10min

Screenshot from 2021-08-18 14-33-17 Screenshot from 2021-08-18 14-32-51
Screenshot from 2021-08-18 14-32-23 Screenshot from 2021-08-18 14-31-51

10min < ETA < 30min

Screenshot from 2021-08-18 14-41-08 Screenshot from 2021-08-18 14-42-44

30min < ETA < 1h

Screenshot from 2021-08-18 14-45-37 Screenshot from 2021-08-18 14-45-55

1h < ETA < 5h

Screenshot from 2021-08-18 14-48-05 Screenshot from 2021-08-18 14-48-57

@genadz
Copy link
Contributor Author

genadz commented Aug 18, 2021

These numbers look great. I assume it doesn't affect p50 that much because it's still really short routes anyway?

let me check it

@kevinkreiser
Copy link
Member

@genadz dont forget to put closes or fixes before the issue number in the description!

@genadz
Copy link
Contributor Author

genadz commented Aug 18, 2021

Performance

master

5%	10%	50%	90%	95%	99%	100%	
0.0070	0.0101	0.0914	0.3549	0.7473	1.8551	4.2720	
mean: 0.1803

branch

5%	10%	50%	90%	95%	99%	100%	
0.0077	0.0110	0.0920	0.3568	0.7597	1.8818	4.3489	
mean: 0.1820

Timings approximately stayed the same.

@genadz genadz merged commit 10366dd into master Aug 18, 2021
@genadz genadz deleted the kgv_extend_stretch branch August 19, 2021 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend bounded stretch threshold to allow more alternatives for short routes
2 participants