Use weight instead of duration for trip api#5930
Use weight instead of duration for trip api#5930ijleesw wants to merge 2 commits intoProject-OSRM:masterfrom
Conversation
|
From what I can tell, this is rather a design choice than a bug. All optimization software I'm aware of usually ingest a matrix of travel times (e.g. from the I agree there is some kind of discrepancy here, as when using
My guess is that on the contrary most end users would go for the clockwise route, because it's twice as fast. In fact, if you provide the other option and the user spots the difference, I think you'd have quite a hard time trying to explain why you didn't provide the fastest option in the first place. Beside the white-board/theoretical example, do you have any real-life example where this is a problem? |
|
I agree that optimization objective always rely on travel time. On the other hand, we need to take users' preferences into account and there are some preferences that go against duration. I guess that's why there's weight along with duration. As for me, I use weight to model a trade-off between duration and toll, leaving duration for a real duration. By doing so I can tune the trade-off without affecting a resulting duration. However, trip api using duration for waypoint ordering makes it hard to take full control of the api results. I admit that the example above was quite extreme. Here I present a simplified version of a real-life example that I've encountered. Assume we can access a rectangle area only through gates and there is a toll. By setting It seems that the case holds when weight which does not affect duration is added and detour takes quite long (or when there's no detour). |
|
This PR seems to be stale. Is it still relevant? |
Issue
In the above case, Trip API returns a clockwise route for a roundabout trip instead of a counter-clockwise route.
As rate(weight) should take priority over speed(duration), this looks like a bug.
Fixed this by changing
ManyToManySearchto return a weight matrix along with duration/distance matrices and using the matrix inTablePlugin::HandleRequest.Below is data I used to test my code.
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?