Difference between revisions of "User:PesachZ/algorithm"

From Wazeopedia
m (fixing links)
(Undo revision 65951 by PesachZ (talk))
Line 1: Line 1:
A somewhat simplified description of this is covered in the&nbsp;&#x5B;&#x5B;Junction Style Guide|Junction Style Guide&#x5D;&#x5D;. Additional routing information is covered in the article&nbsp;&#x5B;&#x5B;Routing server|Routing server&#x5D;&#x5D;. == General comments == The description below fits a right turn in a&nbsp;&#x5B;&#x5B;Right-hand traffic|Right-hand traffic&#x5D;&#x5D;&nbsp;country (e.g. not England). Left turns are symmetrical to right turns. == Definitions == a) s-in: the segment going into the junction; this is the segment the driver is on before reaching the junction<br/>b) s-out: the segment going out of the junction; this is the segment we want the driver to traverse to<br/>c) s1, s2 … sN: all the segments connected to the same junction, which includes s-out<br/>d) Best continuation is one of the segments, and is the one that Waze determines is what drivers would consider the "no turning path" through the intersection - see expanded description below. http://i.imgur.com/Z9wmsZe.jpg == Best Continuation == In order to determine if s-out is the 'real' continuation of s-in, we do the following: #If s-out has the same road type & street name it is selected as the real continuation. #If not, we look at the other segments: s1, s2 … sN (excluding s-out). One of those will be chosen as a better continuation than s-out if both following conditions are met: #*This segment has a better match street name & road type wise than s-out (e.g. it has the same street name and s-out doesn't; it has the same road type as s-in, and s-out doesn't). Street name is more important than road type. #*The angle between this segment and s-in is smaller than the angle between s-out and s-in #If both conditions are not met, then s-out is considered to be the 'best continuation'. === Special Considerations === *In some situations a &#x5B;&#x5B;Junction Style Guide#Y Intersections|Y-Intersection&#x5D;&#x5D; (where there are more than one segment leaving the junction node at less than a 45° angle), navigation to either segment will generate a 'KEEP RIGHT/LEFT" instruction, even if one of those would otherwise be the 'best continuation' and has a departure angle of 0° from s-in. This is also mentioned in the &#x5B;&#x5B;Junction Style Guide#Wayfinder Segments|wayfinder section&#x5D;&#x5D;. *A segment (s1, s2, ...sN) leaving the juction which has the trun into it from s-in &#x5B;&#x5B;Turn restrictions#Turn restrictions .28allowed turns.29|restricted&#x5D;&#x5D; in &#x5B;&#x5B;Waze Map Editor|WME&#x5D;&#x5D;&nbsp;will not be considered in this algorithm as a 'best continuation', even if it has&nbsp;a departure angle of 0° from s-in. http://i.imgur.com/TUEyvEZ.jpg == The algorithm / list of conditions == The algorithm iterates over a list of conditions. As soon as a condition is met, the relevant instruction is determined, and the algorithm terminates. The list of conditions: 1. If the junction has only 2 segments, the instruction is: 'CONTINUE'.<br/>1.1. In some cases, T junctions could be considered as only 2 segments. See explanation on 'T junctions' below. 2. If the angle between s-out and the best continuation is larger than 45 degrees (and less than 180), the instruction is: 'TURN RIGHT'.<br/>This is because we assume that on primary roads (minor highways, major highways and freeways), turn angles are no more than 45 degrees (no sharp turns on higher-throughput roads); therefore, you never have something called an "exit" that has such an angle, and the instruction should be TURN, not EXIT. 3. If s-out is determined to be the best continuation of s-in (explanation on 'best continuation' above), the instruction is: 'CONTINUE', which implies that the driver is not turning (i.e., going straight through the junction). 4. If s-in is a primary road and s-out is not a primary road (mH, MH, FW), the instruction is: 'EXIT RIGHT'. 5. If s-in is a ramp/exit and s-out is neither a primary road&nbsp;(mH, MH, FW), nor a ramp/exit, the instruction is: 'EXIT RIGHT'. 6. If none of the above conditions is met, the instruction is: 'KEEP RIGHT' == T junctions and one way roads == In some cases, a node could have more than 2 segments, but the routing server will consider only 2 of them as valid and therefore, the maneuver will be 'Continue straight'.<br/>Turns can be &#x5B;&#x5B;Turn restrictions#Turn restrictions .28allowed turns.29|restricted or unrestricted&#x5D;&#x5D;, in specific scenarios you may not be able to see this in &#x5B;&#x5B;Waze_Map_Editor|WME&#x5D;&#x5D; - see&nbsp;&#x5B;&#x5B;Reverse_connectivity#Reverse_Connectivity|RevCons&#x5D;&#x5D;&nbsp;for more information. For example, in this case (image below) - assuming the node is restricted properly - heading south, the right turn will be considered 'Continue straight' as the routing server has no other option and there's only one possible segment to be s-out. If the node was not restricted, most likely that waze would tell you to turn right. Driving against the direction is a high&nbsp;&#x5B;&#x5B;Routing_penalties|penalty&#x5D;&#x5D;, and so is a left turn where a turn is not allowed. However, it would still have been an option, which is why the routing server would have called it 'turn right'. https://wiki.waze.com/wiki/images/0/00/Right_turn_1.png This could be confusing, especially since there's no external indication on whether or not a node is restricted at the moment. There are external scripts which show this information (and some allow it to be easily corrected) - see&nbsp;[https://wiki.waze.com/wiki/Reverse_connectivity#Reverse_Connectivity RevCons]&nbsp;for more information.<br/><br/><br/><br/><br/>
+
A somewhat simplified description of this is covered in the&nbsp;[[Junction Style Guide|Junction Style Guide]]. Additional routing information is covered in the article&nbsp;[[Routing server|Routing server]].
 +
 
 +
== General comments ==
 +
 
 +
The description below fits a right turn in a&nbsp;[https://wiki.waze.com/wiki/Right-hand%20traffic Right-hand traffic]&nbsp;country (e.g. not England). Left turns are symmetrical to right turns.
 +
 
 +
== Definitions ==
 +
 
 +
a) s-in: the segment going into the junction; this is the segment the driver is on before reaching the junction<br/>b) s-out: the segment going out of the junction; this is the segment we want the driver to traverse to<br/>c) s1, s2 … sN: all the segments connected to the same junction, which includes s-out<br/>d) Best continuation is one of the segments, and is the one that Waze determines is what drivers would consider the "no turning path" through the intersection - see expanded description below.
 +
 
 +
http://i.imgur.com/Z9wmsZe.jpg
 +
 
 +
== Best Continuation ==
 +
 
 +
In order to determine if s-out is the 'real' continuation of s-in, we do the following:
 +
 
 +
#If s-out has the same road type & street name it is selected as the real continuation.
 +
#If not, we look at the other segments: s1, s2 … sN (excluding s-out). One of those will be chosen as a better continuation than s-out if both following conditions are met:
 +
#*This segment has a better match street name & road type wise than s-out (e.g. it has the same street name and s-out doesn't; it has the same road type as s-in, and s-out doesn't). Street name is more important than road type.
 +
#*The angle between this segment and s-in is smaller than the angle between s-out and s-in
 +
#If both condtions are not met, then s-out is considered to be the 'best continuation'.
 +
 
 +
=== Special Considerations ===
 +
 
 +
*In some situations a [https://wiki.waze.com/wiki/Junction_Style_Guide#Y_Intersections Y-Intersection] (where there are more than one segment leaving the junction node at less than a 45° angle), navigation to either segment will generate a 'KEEP RIGHT/LEFT" instruction, even if one of those would otherwise be the 'best continuation' and has a departure angle of 0° from s-in. This is also mentioned in the [https://wiki.waze.com/wiki/Junction_Style_Guide#Wayfinder_Segments wayfinder section].
 +
*A segment (s1, s2, ...sN) leaving the juction which has the trun into it from s-in [https://wiki.waze.com/wiki/Turn_restrictions#Turn_restrictions_.28allowed_turns.29 restricted] in [https://wiki.waze.com/wiki/Waze_Map_Editor WME]&nbsp;will not be considered in this algorithm as a 'best continuation', even if it has&nbsp;a departure angle of 0° from s-in.http://i.imgur.com/TUEyvEZ.jpg
 +
 
 +
== The algorithm / list of conditions ==
 +
 
 +
The algorithm iterates over a list of conditions. As soon as a condition is met, the relevant instruction is determined, and the algorithm terminates.<br/>The list of conditions:
 +
 
 +
1. If the junction has only 2 segments, the instruction is: 'CONTINUE'.<br/>1.1. In some cases, T junctions could be considered as only 2 segments. See explanation on 'T junctions' below.
 +
 
 +
2. If the angle between s-out and the best continuation is larger than 45 degrees (and less than 180), the instruction is: 'TURN RIGHT'. This is because we assume that on primary roads (minor highways, major highways and freeways), turn angles are no more than 45 degrees (no sharp turns on higher-throughput roads); therefore, you never have something called an "exit" that has such an angle, and the instruction should be TURN, not EXIT.
 +
 
 +
3. If s-out is determined to be the best continuation of s-in (explanation on 'best continuation' above), the instruction is: 'CONTINUE', which implies that the driver is not turning (i.e., going straight through the junction)
 +
 
 +
4. If s-in is a primary road and s-out is not a primary road (mH, MH, FW), the instruction is: 'EXIT RIGHT'.
 +
 
 +
5. If s-in is a ramp/exit and s-out is neither a primary road&nbsp;(mH, MH, FW), nor a ramp/exit, the instruction is: 'EXIT RIGHT'.
 +
 
 +
6. If none of the above conditions is met, the instruction is: 'KEEP RIGHT'
 +
 
 +
== T junctions and one way roads ==
 +
 
 +
In some cases, a node could have more than 2 segments, but the routing server will consider only 2 of them as valid and therefore, the maneuver will be 'Continue straight'.<br/>Turns can be restricted or unrestricted, in specific scenarios you may not be able to see this in [https://wiki.waze.com/wiki/Waze_Map_Editor WME] - see&nbsp;[https://wiki.waze.com/wiki/Reverse_connectivity#Reverse_Connectivity RevCons]&nbsp;for more information.
 +
 
 +
For example, in this case (image below) - assuming the node is restricted properly - heading south, the right turn will be considered 'Continue straight' as the routing server has no other option and there's only one possible segment to be s-out.
 +
 
 +
 
 +
 
 +
If the node was not restricted, most likely that waze would tell you to turn right. Driving against the direction is a high&nbsp;[https://wiki.waze.com/wiki/Routing%20penalties penalty], and so is a left turn where a turn is not allowed. However, it would still have been an option, which is why the routing server would have called it 'turn right'.
 +
 
 +
https://wiki.waze.com/wiki/images/0/00/Right_turn_1.png
 +
 
 +
This could be confusing, especially since there's no external indication on whether or not a node is restricted at the moment. There are external scripts which show this information (and some allow it to be easily corrected) - see&nbsp;[https://wiki.waze.com/wiki/Reverse_connectivity#Reverse_Connectivity RevCons]&nbsp;for more information.

Revision as of 01:51, 4 May 2014

A somewhat simplified description of this is covered in the Junction Style Guide. Additional routing information is covered in the article Routing server.

General comments

The description below fits a right turn in a Right-hand traffic country (e.g. not England). Left turns are symmetrical to right turns.

Definitions

a) s-in: the segment going into the junction; this is the segment the driver is on before reaching the junction
b) s-out: the segment going out of the junction; this is the segment we want the driver to traverse to
c) s1, s2 … sN: all the segments connected to the same junction, which includes s-out
d) Best continuation is one of the segments, and is the one that Waze determines is what drivers would consider the "no turning path" through the intersection - see expanded description below.

http://i.imgur.com/Z9wmsZe.jpg

Best Continuation

In order to determine if s-out is the 'real' continuation of s-in, we do the following:

  1. If s-out has the same road type & street name it is selected as the real continuation.
  2. If not, we look at the other segments: s1, s2 … sN (excluding s-out). One of those will be chosen as a better continuation than s-out if both following conditions are met:
    • This segment has a better match street name & road type wise than s-out (e.g. it has the same street name and s-out doesn't; it has the same road type as s-in, and s-out doesn't). Street name is more important than road type.
    • The angle between this segment and s-in is smaller than the angle between s-out and s-in
  3. If both condtions are not met, then s-out is considered to be the 'best continuation'.

Special Considerations

  • In some situations a Y-Intersection (where there are more than one segment leaving the junction node at less than a 45° angle), navigation to either segment will generate a 'KEEP RIGHT/LEFT" instruction, even if one of those would otherwise be the 'best continuation' and has a departure angle of 0° from s-in. This is also mentioned in the wayfinder section.
  • A segment (s1, s2, ...sN) leaving the juction which has the trun into it from s-in restricted in WME will not be considered in this algorithm as a 'best continuation', even if it has a departure angle of 0° from s-in.http://i.imgur.com/TUEyvEZ.jpg

The algorithm / list of conditions

The algorithm iterates over a list of conditions. As soon as a condition is met, the relevant instruction is determined, and the algorithm terminates.
The list of conditions:

1. If the junction has only 2 segments, the instruction is: 'CONTINUE'.
1.1. In some cases, T junctions could be considered as only 2 segments. See explanation on 'T junctions' below.

2. If the angle between s-out and the best continuation is larger than 45 degrees (and less than 180), the instruction is: 'TURN RIGHT'. This is because we assume that on primary roads (minor highways, major highways and freeways), turn angles are no more than 45 degrees (no sharp turns on higher-throughput roads); therefore, you never have something called an "exit" that has such an angle, and the instruction should be TURN, not EXIT.

3. If s-out is determined to be the best continuation of s-in (explanation on 'best continuation' above), the instruction is: 'CONTINUE', which implies that the driver is not turning (i.e., going straight through the junction)

4. If s-in is a primary road and s-out is not a primary road (mH, MH, FW), the instruction is: 'EXIT RIGHT'.

5. If s-in is a ramp/exit and s-out is neither a primary road (mH, MH, FW), nor a ramp/exit, the instruction is: 'EXIT RIGHT'.

6. If none of the above conditions is met, the instruction is: 'KEEP RIGHT'

T junctions and one way roads

In some cases, a node could have more than 2 segments, but the routing server will consider only 2 of them as valid and therefore, the maneuver will be 'Continue straight'.
Turns can be restricted or unrestricted, in specific scenarios you may not be able to see this in WME - see RevCons for more information.

For example, in this case (image below) - assuming the node is restricted properly - heading south, the right turn will be considered 'Continue straight' as the routing server has no other option and there's only one possible segment to be s-out.


If the node was not restricted, most likely that waze would tell you to turn right. Driving against the direction is a high penalty, and so is a left turn where a turn is not allowed. However, it would still have been an option, which is why the routing server would have called it 'turn right'.

https://wiki.waze.com/wiki/images/0/00/Right_turn_1.png

This could be confusing, especially since there's no external indication on whether or not a node is restricted at the moment. There are external scripts which show this information (and some allow it to be easily corrected) - see RevCons for more information.