aerostitch / testnavit

0 stars 0 forks source link

traffic lights should affect route selection #150

Open aerostitch opened 12 years ago

aerostitch commented 12 years ago

Issue migrated from trac ticket # 1047

component: core | priority: minor | keywords: routing, traffic, lights, penalty

2012-06-11 14:10:31: zoff99 created the issue


implement change to routing algo. so that if a route has many traffic lights, its slower and therefore another longer route with less traffic lights may be chosen. this should not be a big change, since with traffic distortion and turn-restrictions it already works that way, and traffic lights are already in the mapfile

suggestion: if a routsegment has a traffic light, then slow down the max speed on that segment, so that the cost will be higher. make that feature a config option (yes/no option)

aerostitch commented 12 years ago

2012-06-12 02:23:56: tryagain commented


Hi!

Nice idea. I have some thoughts on it.

Traffic light is not a slowdown, it's more like a constant time penalty. I think we have interface for such delays.

If you do slowdown on a segment, actual time penalty will depend on that segment length, which is wrong.

Another problem, we don't know any actual info about traffic lights regimen. I'd expect that higher grade road will have less "red" time than lower grade one on the same crossing. This heuristic may be coded into the implementation.

In my town, most traffic lights are switched to "blinking yellow" mode every night so they do not make any distortion when traffic is low. To deal this automatically, we have to know exact arrival time at the route graph flooding time. This, of course, can be done manually by switching routing mode and recalculating the route.

There may be additional arrow sections which, for example, always allow right turn. AFAIK, in some countries (USA?) right turn is always allowed, independent of light turned on.

aerostitch commented 12 years ago

2012-06-12 02:40:21: korrosa commented


In parts of Canada (though not everywhere), right turn on red is also allowed.

I'll throw another spanner in the works - as more and more people start to add detail to the maps, traffic lights are being moved from the central junction node to their exact position on the side of the road, to reflect reality. This is obviously sub-optimal for routing engines. The enforcement relation may go some way to helping (http://wiki.openstreetmap.org/wiki/Relation:enforcement), but it's not very widely used (just of 3000 instances of the relation).

This sounds interesting though, and I guess it'd be good to have a look how other routers manage this issue (if they do at all!).

aerostitch commented 12 years ago

2012-07-20 04:40:11: @mvglasow commented


Suggestion: let's start by tackling the basic cases, then move on to the more advanced ones.

Can we just add a (possibly configurable) penalty to the route whenever it goes across a traffic light node? The change would be that we'd have a cost not only for segments, but also for nodes.

The penalty is the average waiting time in seconds: If a traffic light has a red phase which lasts 30 seconds, and a green phase which also lasts 30 seconds, you have a 50% chance of getting there during the green phase (waiting time 0) and a 50% chance of getting there during the red phase (waiting time between 0 and 30 seconds, depending on when you get there, that is 15 seconds on average). So, statistically the waiting time would be 7.5 seconds.

As a formula:

penalty = red_time / 2 * red_time / (red_time + green_time)

Unless we have map data detailed enough to report the duration of red and green for each traffic light (does a tagging scheme for that exist at all?), we can make some statistical guesses. Yes, they'd be assumptions, but currently our assumption is that we never wait at traffic lights - which is the least accurate of all.

The actual penalty could be configurable based on

  • direction of route - in countries that drive on the right, the penalty for turning left will statistically be higher than the penalty for going straight; turning right may have an even lower penalty
  • the type of road the vehicle is coming from
  • the type of road the vehicle is going to
  • other nearby roads

Taking road types into consideration may be difficult if the traffic light is not placed directly on the crossing node but before it. We can leave it out in the first version, and in following versions, we can just assume the traffic light refers to the nearest intersection (or the next intersection on one-way roads).

For traffic lights which are not directly on the way: again, we might leave those out for the beginning and tackle those cases when we have the simpler ones working. A possible approach would be to assume that traffic lights which are not on a way and are not in a relation which associates them with an intersection, assume they refer to the nearest intersection within a certain radius. That kind of preprocessing can be done in maptool.

Finally, right turn on red: regulations on this may vary from country to country:

  • Not allowed (most of Western Europe)
  • Allowed only where indicated by a sign (Lithuania, Germany)
  • Generally allowed unless specifically prohibited (USA, Canada) As an extra caveat in Canada, right turning on red is not allowed in the cities of Quebec and Montreal. Most likely we will need to tag each traffic light to indicate whether turning right on red is allowed or not.

Where it is allowed, it still results in a penalty as vehicles turning right on red may need to stop, or there is no dedicated right-turning lane and the vehicle in front of you may be going straight and you will still have to wait after it. Again, we can leave it out in the first step.

aerostitch commented 12 years ago

2012-07-26 04:31:46: antenna commented


Great idea! Finally, somebody who knows about it, attends this topic #891.

Time penalty and signal times should definitely be configurable, so everybody can adjust the values by comparing the suggested route with your personal experience on routes you know by heart.

I can only speak for Germany, but we've got up to 90 seconds red time and a max of 30s green time on huge crossroads. The nearest intersection within a certain radius, which you mentioned, could be used to identify these crossroads, as well. If there is a bunch of them around, this is probably a larger crossroad. There might be even some information about the signal time in the traffic light flags.

Of course, the road type is relevant, too. How about two penalties - one for usual and one for main roads?

aerostitch commented 12 years ago

2012-07-27 02:12:02: zoff99 commented


well as suggested the first beta version should just be very simple:

add 7.5 seconds penalty when a traffic light is in your path.

and then test the result on the road. someone up to write a patch?

aerostitch commented 11 years ago

2013-07-28 05:07:05: usul

aerostitch commented 11 years ago

2013-07-28 05:07:05: usul commented


There seem to be noone who created an feature on that issue.

As it's IMHO a more complex (esp. on testing) request, I will schedule it for the new major release.