eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.49k stars 1.41k forks source link

How to let car(defined by flow) change route dynamically? #8904

Open chen-98 opened 3 years ago

chen-98 commented 3 years ago

I drawn a network to test the lane attribute 'changeLeft'. I definded a right turn flow at the intersection. And disallow lane change at the income edge of intersection. To make sure each car can reach destination. I provide a alternative route. But I found that if a car can't change to right turn lane in time, it will stop at the end of the income edge until being teleport instead of follow alternative route. So, how to let car(defined by flow) change route dynamically instead of jam at the junction. Atteched the project files. 5b4e3e64f46814e5daff0d69b659cf8 image plain_test.zip

namdre commented 3 years ago

To enable automated periodic rerouting you can set options --device.rerouting.probability 1 --device.rerouting.period 30. However, the routing algorithm does not yet check for lane changing restrictions. Hence, vehicles will always prefer the shorter route via edge '5'. If you distort the distance perception by setting --weights.random-factor 10 you will see some vehicles that take the detour.

namdre commented 3 years ago

fixing this is surprisingly complex:

chen-98 commented 3 years ago

To enable automated periodic rerouting you can set options --device.rerouting.probability 1 --device.rerouting.period 30. However, the routing algorithm does not yet check for lane changing restrictions. Hence, vehicles will always prefer the shorter route via edge '5'. If you distort the distance perception by setting --weights.random-factor 10 you will see some vehicles that take the detour.

Is it helpful to divide the edge into two parts(split the edge in the line between lane 5 and 4) ? So that the routing algorithm can consider this actual road segment as two parallel edge. Maybe this way can help us avoid the checking problem of algorithm.

And if it is helpful, how to realize it by coding? Thank you very much!

namdre commented 3 years ago

By modeling the lane-changing restriction via distinct parallel edges you would indeed avoid this situation. But you still wouldn't see the desired detour. The vehicle would simply wait on the predecessor edge until it manages to reach the right parallel edge.

behrisch commented 2 years ago

lane based routing could be an option here and would also help in respecting lane change restrictions in general. So optionally building a lane based graph could be a solution. cost assignment will be difficult though