# Difference between revisions of "Detour Prevention Mechanisms"

Waze searches for the fastest route to the destination. Sometimes, it finds like detours from the most obvious, most direct, or shortest route. The detours may involve taking a side street and making a few extra turns. If these detours save enough time, then they are worth it. But in some cases, they don't save enough time, and Waze shouldn't suggest them. Here are two cases where Waze should recognize a detour in the route and prevent it unless the time savings makes it really worth it.

Important Terms:

Direct Route
the continuous route most users would expect, for example, a route that stays on the same freeway from point A to point B
Detour
Any route used in place of the direct route.
Alternate Route
What Waze compares a route to - when evaluating a detour route, the direct route is the evaluated alternative.

## Big detours

The big detour penalty is meant to keep Waze from telling you to detour off a highway and then get right back on it, even if the detour saves you a little time. Waze should only offer this kind of detour if it saves enough time to be "worth it" - when traffic is really messed up on the "direct" route.

Waze makes a few checks on an off-highway detour to see if it should be prevented. It checks the length of the possible detour, makes sure the road type changes, and that the name is not continuous with the highway you are detoured from. It also checks that there exists an alternate route that is direct - the direct route must have both continuous road type and name continuity. Waze does not consider how many 'turn...', 'keep...', or 'exit...' instructions are issued on any of the paths it checks for detour prevention.

### Criteria

A possible detour is one we are checking. If it passes these checks, we'll call it a confirmed detour. An alternate route is one we are checking to see if it is a direct route. If there is a direct route, then Waze will apply the big detour penalty to the confirmed detour. Here are the specific checks that Waze makes:

1. Segments before and after the possible detour: The freeway/highway segments immediately before and immediately after the possible detour must share at least one street name among their primary and alternate names. Either segment may have the shared name as either a primary or an alternate name. These segments must also be from the same road type group as shown in the table below. The road type of these segments determines the maximum length of detour for which BDP will be applied.
2. Confirmed detour: A confirmed detour is a a possible detour that meets all of these criteria:
1. Name discontinuity - The possible detour must have at least one break in name continuity from the last segment before the detour to the first segment after the detour. Specifically, the last segment of the possible detour must not have name continuity with the first segment after the possible detour.
2. Road type discontinuity - The possible detour must include at least one segment not in the same road type group as the segments immediately before and after.
3. Minimum length - The possible detour must be more than one segment long.
4. Maximum length - The possible detour must be shorter than the threshold length as shown in the table below for the road type group of the two segments immediately before and after the detour.
3. Direct route: A direct route is an alternate route that meets the criteria below:
1. Existence: There must be an alternate route connecting the freeway/highway segments immediately before and immediately after the detour which does not use any of the segments used in the possible detour.
2. Continuity The entire alternate route should have name and road type continuity. In the past, less resource-intensive methods have been used for checking the direct route. As of December 2017 a full continuity check is in use. All segments of the alternate route must have both name and type continuity with the segment immediately before and the segment immediately after the possible detour. This is the most resource-intensive continuity check.
Freeway
Major Highway
5km
Minor Highway  500m

### Notes

• If the first segment after the possible detour is the beginning of a freeway or highway, and thus can only be accessed from ramps or segments of a different road type group, then there can be no direct route according to the above criteria.
• For divided roadways that have the same name on both carriageways, the big detour prevention mechanism will prevent U-turns that traverse more than one segment. Thus, in the intersection below, the configuration on the left should be used to route a U-turn because it uses a single segment between the two parallel roadways with the same name. In contrast, the configuration on the right should not be used because the U-turn road branches from another segment causing multiple segments between the two parallel roads with the same name, and the U-turn is not in the same road type group, preventing BDP from working.

• Be careful of "false positives!" For example, where route number concurrences begin and end, the big detour prevention mechanism may be unexpectedly triggered as follows (see diagram):
• In a concurrency, two highways share the same road, and both names will appear on the concurrent segments, using alternate names. Where the concurrency ends, the two highways split into separate roadways again.
• Often, there are ramp segments connecting the last concurrent segment to one or both of the non-concurrent continuations. If the concurrency was of I-1234 and I-4567, for example, there might be a ramp named "to I-1234 / Sometown" - a name which contains "I-1234" but is not identical to the highway name.
• If the ramp does not also carry a simple alternate name of "I-1234", then there is a discontinuity of the highway name between the concurrency and the continuation highway. If there are two ramp segments like this, it will trigger Big Detour Prevention unexpectedly, and Waze will create an unneeded penalty for continuing on I-1234.
• To prevent this, just assign I-1234 as an alternate name to all ramps between the two sections (concurrency and continuation). Note that if there is only a single ramp segment connecting the highways, there will not be a "false positive." Nevertheless, it is a good practice to do this even for a single ramp segment, in case the ramp is cut into two segments later, either by accident or because later construction or map improvements connect another feeder ramp in the middle.
• Another example of a false positive could occur where a highway has multiple wayfinders connected, one to another, (for example, if there are several multi-lane exits in a row).

## Small Detours

Waze has a small detour prevention mechanism to deal with instances where Waze calculates that that a left turn can be "optimized" by using U-turns and right turns (either continue straight, U-turn, right turn; or alternatively, immediate right turn, U-turn, continue straight). While this may save a few seconds over waiting for a long average left turn, it is undesirable. Waze will prevent such detours if there is not a measurable difference in the route times. The exact difference in time required to trigger this prevention is proprietary, and subject to change as needed.