Rerouting Scenarios

Rerouting Overview

Without rerouting enabled, once a route is accepted the vehicle automatically becomes unavailable. This means it is not considered for any other optimizations until it completes the accepted route.

Rerouting allows the possibility of assigning additional trip(s) to a vehicle while it is still completing a route. When a route is generated and rerouting is enabled, Interplai will look for opportunities to add more trips to that vehicle’s route. Vehicles currently completing assignments will be considered for rerouting opportunities, depending on how the rerouting parameters are set up. This has the potential to change the route sequence or extend a vehicle’s route.

Once rerouting is turned on for a vehicle that is continuously optimizing a route, Interplai will involve the vehicle in future optimizations and look for new route recommendations for that vehicle. Rerouting is set for an entire zone. It can be turned on or off anytime, and once it is on, it applies to every trip and vehicle in the zone. When an opportunity is found, Interplai will create a new route that includes the existing waypoints from the original route plus the new waypoints from the rerouting opportunity. If the new route is accepted, then the new route replaces the original route and becomes the route currently being executed.

📘

Rerouting depends on other settings

Rerouting works best when the routingScenarioMode is set to none ormpmd (multi pickup and multi drop-off). This allows vehicles to have multiple pickup and drop-off waypoint locations in an assigned route, which is essential for adding waypoints to a route.

Additionally, maxStopsAllowed must be set high enough for routes to include additional waypoints. For example, if maxStopsAllowed is set to 2, then a vehicle can only have one pickup and one drop-off location for a total of two stops. Which means no additional stops can be added to the route. It is recommended to use 4 or more.

There are two main phases for which rerouting opportunities are considered: during the pickup phase and drop-off phase of the current route.

  • The pickup phase starts once the original route is accepted and ends once the vehicle leaves the last pickup location out of the initial sequence of pickup locations. If there is only one pickup location, this will be considered the last one.
  • The drop-off phase starts once the vehicle is within a certain distance from the last drop-off location and ends once the route is completed.

Rerouting Parameters

There are three main parameters that need to be set when creating (or updating) a zone to include the rerouting feature. These can be found in the API reference under Zone endpoints

reroutingMode: Defines how rerouting is performed for vehicles that are currently executing routes. When rerouting is enabled, new trips can be added to vehicles that already have an assigned route. There are different rerouting modes, which control when the system will look for rerouting opportunities. The following rerouting modes are supported:

  • duringPickup - Rerouting is active during the pickup phase; starts once a route is accepted and ends when the vehicle departs the last pickup location out of the initial sequence of pickup locations.
  • duringFinalDropoff - Rerouting is active during the drop-off phase; starts once the vehicle is within the drop-off distance threshold (meters) of the final drop-off location in the route, and ends when the route is complete.
  • duringPickupAndFinalDropoff - Rerouting is active during both the pickup phase and drop-off phase.
  • none - Rerouting is not active.

reroutingFinalDropoffThreshold: When the distance from the vehicle’s current location to its final drop-off waypoint location is below this distance threshold (meters), the system will start looking for rerouting opportunities by adding new trips to the vehicle’s route.

allowReroutingDestinationChanges: When this setting is "true", the system will look for opportunities to perform rerouting which may result in the vehicle having to change its current destination. This is applicable only to the first pickup waypoint. If this value is "false", then when rerouting is performed, the vehicle will always continue to its current destination and new trips may be added after.

reroutingMode: Pickup Phase

During the pickup phase, a vehicle will be considered for rerouting opportunities from the moment the original route is accepted until it leaves the last pickup waypoint location. The pickup phase is specified by setting the reroutingMode to duringPickup.

For example, if the original route has one pickup location and one drop-off location, then the vehicle will be considered for rerouting opportunities until it leaves the last (and only) pickup location.

Figure 1a: Example of a pickup phase for a route with a single pickup/drop-off.

Figure 1a: Example of a pickup phase for a route with a single pickup/drop-off.

A new route may include a new pickup and a new drop-off location. This route will replace the original route and must be accepted in order for a vehicle to add the extra waypoints.

Figure 1b: If `maxStopsAllowed` is set to `4` or more, then new pickup/drop-off locations may be added.

Figure 1b: If maxStopsAllowed is set to 4 or more, then new pickup/drop-off locations may be added.

Similarly, if a route includes two pickup locations and two drop-off locations, then the vehicle will be considered for rerouting opportunities until it leaves the last (second) pickup location.

Figure 2a: Example of a pickup phase for a route with multiple pickups and multiple drop-offs.

Figure 2a: Example of a pickup phase for a route with multiple pickups and multiple drop-offs.

A new route would include a new pickup and drop-off location.

Figure 2b: If `maxStopsAllowed` is set to `6` or more, then new pickup/drop-off locations may be added.

Figure 2b: If maxStopsAllowed is set to 6 or more, then new pickup/drop-off locations may be added.

This can be extrapolated to longer, more complicated routes by considering only the last pickup location out of the initial sequence of pickup locations. For example, if the routingScenarioMode is set to none, then it is possible to have a route of mixed pickup and drop-off locations (as opposed to all pickups occurring before all drop-offs). In the scenario where pickup locations are mixed with drop-off locations, a pickup phase would start every time a vehicle starts driving to a pickup location.

Figure 3: Example of a route with mixed pickups/drop-offs. Pickup phases exist for every occurrence of a pickup location.

Figure 3: Example of a route with mixed pickups/drop-offs. Pickup phases exist for every occurrence of a pickup location.

reroutingMode: Drop-off Phase

During the drop-off phase, a vehicle will not be considered for rerouting opportunities until it is within a certain distance of the last drop-off location. This phase is specified by setting the reroutingMode to duringFinalDropoff. Additionally, the distance threshold needs to be specified by setting the reroutingFinalDropoffThreshold distance in meters. Once a vehicle's distance is larger than the dropoff location, it will start being considered for rerouting opportunities until the route is complete.

Figure 4a: Example of the drop-off phase for a route with a single pickup/drop-off.

Figure 4a: Example of the drop-off phase for a route with a single pickup/drop-off.

All new pickup and drop-off waypoints will be added after the original final drop-off location.

Figure 4b: If `maxStopsAllowed` is set to `4` or more, new pickup/drop-off locations may be added at the end of the original route.

Figure 4b: If maxStopsAllowed is set to 4 or more, new pickup/drop-off locations may be added at the end of the original route.

No matter how many pickup and drop-off locations are in the original route, the vehicle will only start being considered for rerouting opportunities once it is within a certain distance of the last drop-off location.

Figure 5a: Example of a drop-off phase for multiple pickups/drop-offs.

Figure 5a: Example of a drop-off phase for multiple pickups/drop-offs.

The additional waypoints to be added to the route will be added after the final drop-off location, essentially acting as a queuing feature.

Figure 5b: If `maxStopsAllowed` is set to `6` or more, new waypoints may be added after the original route.

Figure 5b: If maxStopsAllowed is set to 6 or more, new waypoints may be added after the original route.

reroutingMode: Both Pickup and Drop-off Phases

Rerouting can be set to include combined pickup and drop-off phases. For vehicles to be considered for rerouting opportunities during both phases, reroutingMode can be set to duringPickupAndFinalDropoff. Opportunities for rerouting will start once the original route is assigned, and will continue to look for opportunities throughout the first sequence of pickup locations. It will stop once the vehicle leaves the last pickup location out of the initial set of pickups. Then the vehicle will not be considered for rerouting opportunities again until it reaches the drop-off distance threshold. This results in a break between rerouting periods.

Figure 6: Example of both phases in a route with a single pickup/drop-off.

Figure 6: Example of both phases in a route with a single pickup/drop-off.

If there are multiple drop-off locations, then the rerouting feature will have a larger break. To avoid a delay in going to the original drop-off locations, no rerouting opportunities will be considered until the vehicle is within a certain distance threshold of the final drop-off location.

Figure 7: Example of both phases with multiple pickups/drop-offs.

Figure 7: Example of both phases with multiple pickups/drop-offs.

Under the routingScenarioMode of none, there may be several phases of rerouting.

Figure 8: Example of both phases with mixed pickups/drop-offs.

Figure 8: Example of both phases with mixed pickups/drop-offs.

Destination Changes

While rerouting is enabled, if a vehicle is en route to a waypoint and a trip comes in with a location closer than the next waypoint, it may be beneficial to have the vehicle go to the closer location of the new trip. Essentially, while a vehicle is traveling to a location, rerouting can be set up to change the destination to a different location.

To enable destination changes, the parameter allowReroutingDestinationChanges must be set to true. When this setting is "true", the system will look for opportunities to perform rerouting which may result in the vehicle having to change its current destination. If this value is "false", then when rerouting is performed, the vehicle will always continue to its current destination and new trips may be added after.

For example, suppose a vehicle has just been assigned a route and is traveling to the first pickup location, Comet Coffee. Before arriving at Comet Coffee (the pickup location), a new trip comes in that has a pickup at Fast Fried Chicken, which is located on the way to Comet Coffee. If allowReroutingDestinationChanges is set to true, a new route can be assigned that has the vehicle change its current destination from Comet Coffee to Fast Fried Chicken instead, before continuing on to Comet Coffee and completing the rest of the route.