So the problem with "smart lane selection" is that having every car constantly making such pathfinding calculations would cripple performance.
So how we can distribute lane usage better, in a way that still allows for a one-time calculated route at departure time?
I think a way that could work, is to randomly assign each vehicle a "lane preference number", that is then applied every time multiple appropriate lanes are available.
Eg: Assign every vehicle a random number between 1 and 60 (60 being the lowest common multiple of 2, 3, 4, 5, 6 which represent the possible number of lane options). Then every time the vehicle must choose a lane during the pathfinding calculation, use that number to select one.
So say there's 2 lanes making a left turn at an intersection. Cars with a number between 1-30 would choose the first lane, and 31-60 would use the second one. if there's 3 choices, the split is 1-20, 21-40, 41-60. If there's 4 choices, 1-15, 16-30, 31-45, 46-60... and so on for 5 and 6 lane choices.
(You want a single number that can be applied consistently to many choices instead of randomizing for each intersection, otherwise you'll get crazy weaving between intersections as everyone is switching lanes willy nilly.)
I have used randomization approaches like this to solve similar "congestion" problems in software before... typically for an event scheduler where too many things are trying to happen at the same time (so randomized time offsets instead of lane selection, but same general principle).
So how we can distribute lane usage better, in a way that still allows for a one-time calculated route at departure time?
I think a way that could work, is to randomly assign each vehicle a "lane preference number", that is then applied every time multiple appropriate lanes are available.
Eg: Assign every vehicle a random number between 1 and 60 (60 being the lowest common multiple of 2, 3, 4, 5, 6 which represent the possible number of lane options). Then every time the vehicle must choose a lane during the pathfinding calculation, use that number to select one.
So say there's 2 lanes making a left turn at an intersection. Cars with a number between 1-30 would choose the first lane, and 31-60 would use the second one. if there's 3 choices, the split is 1-20, 21-40, 41-60. If there's 4 choices, 1-15, 16-30, 31-45, 46-60... and so on for 5 and 6 lane choices.
(You want a single number that can be applied consistently to many choices instead of randomizing for each intersection, otherwise you'll get crazy weaving between intersections as everyone is switching lanes willy nilly.)
I have used randomization approaches like this to solve similar "congestion" problems in software before... typically for an event scheduler where too many things are trying to happen at the same time (so randomized time offsets instead of lane selection, but same general principle).
- 13