PhysicsOfMobility/ridepy

add nonzero-detour option to zero-detour dispatcher used for effective topology stuff

fxjung opened this issue · 2 comments

The zero-detour dispatcher shall support a parameter detour for allowing a (usually small) nonzero detour. The specified value will describe the allowed maximum relative detour at when inserting new stops in-between two existing stops.

For a single new stop x to be inserted between (u,v), the following constraint must be fulfilled:

(d(u,x) + d(x, v)) / d(u,v) - 1 <= detour

Question: Which behavior do we want for adjacent insertion of (x,y) in-between (u,v)?

1) (d(u,x) + d(x, y) + d(y, v)) / d(u,v) - 1 <= detour
2) ((d(u,x) + d(x, v)) / d(u,v) - 1 <= detour) /\  ((d(u,y) + d(y, v)) / d(u,v) - 1 <= detour)
3) ((d(u,x) + d(x, v)) / d(u,v) - 1 <= detour) /\  ((d(x,y) + d(y, v)) / d(x,v) - 1 <= detour)

Explanation:

  1. total detour
  2. individual detour
  3. iterative individual detour

I really don't know which one would be preferable. The old zerodetour code used to first insert the pickup if it would be "on the way", and then checked if the dropoff is also on the way. So maybe 3) fits the best?

Yeah, that sounds sensible. Would also be my favored solution.