A time window is the period between a start and end time in which a network location, such as a stop in a route analysis, should be visited by a route.
Two network analysis layers incorporate time windows: route and vehicle routing problem analysis layers. The following two tables provide a list of the network analysis classes for which you can set time windows.
Time window fields in route analysis layers
Network analysis class | Time window field |
---|---|
Stops |
TimeWindowStart |
TimeWindowEnd |
Note:
Time windows are used when any of the time window fields (TimeWindowStart and TimeWindowEnd) in the Stops layer are populated. The time zone for time window fields can be specified when creating a new Route analysis layer using the Time Zone for Time Fields parameter on the Make Route Analysis Layer geoprocessing tool dialog box. To update the time zone for time window fields on an existing layer, use the timeZoneUsageForTimeFields property of the RouteSolverProperties class in Python.
Time window fields in vehicle routing problem analysis layers
Network analysis class | Time window field |
---|---|
Orders |
TimeWindowStart |
TimeWindowEnd | |
TimeWindowStart2 | |
TimeWindowEnd2 | |
Depots | TimeWindowStart |
TimeWindowEnd | |
TimeWindowStart2 | |
TimeWindowEnd2 | |
Breaks | TimeWindowStart |
TimeWindowEnd |
You don't need to check any properties in the vehicle routing problem analysis layer to make time windows available; they are always available. The Orders and Depots classes allow you to set two time windows.
Note:
Time windows are used when any of the time window fields (TimeWindowStart and TimeWindowEnd) in the Orders and Depots layer are populated. The time zone for time window fields can be specified when creating a Route analysis layer using the Time Zone for Time Fields parameter on the Make Vehicle Routing Problem Analysis Layer geoprocessing tool dialog box. To update the time zone for time window fields on an existing layer, use the timeZoneUsageForTimeFields property of the VehicleRoutingProblemSolverProperties class in Python.
Route objects in the vehicle routing problem also have time window fields: EarliestStartTime and LatestStartTime. They specify the period in which a route can begin its journey.
Using dates in time windows
The date portion of a time window indicates whether the time window occurs on a specific date, a day of the week, or the current date. For example, if your time window represents a delivery time, it could be a one-time delivery scheduled for a specific date, a regular delivery that occurs on Wednesdays, or a delivery scheduled to occur today, regardless of what day today is.
For a time window on a specific date, simply include that date when populating the time window fields. In the examples in the next section, the time window occurs on March 16, 2018.
Instead of using a particular date, a day of the week can be specified using the following dates:
- Today—12/30/1899
- Sunday—12/31/1899
- Monday—1/1/1900
- Tuesday—1/2/1900
- Wednesday—1/3/1900
- Thursday—1/4/1900
- Friday—1/5/1900
- Saturday—1/6/1900
The time window date should match the date specified for the time of day (for a Route analysis) or default date (for a Vehicle Routing Problem Layer analysis).
Time window example
To better understand time windows, take the example of four stops—a, b, c, and d—for which a route needs to be found. The time window for each stop is given by its TimeWindowStart and TimeWindowEnd fields.
The route can begin from point a at any time between 8:00 and 9:00 a.m. However, it should not reach point b before 9:10 a.m. As shown below, the route reaches b at 9:05:08 a.m.
Since b should be visited only between 9:10 and 9:12 a.m., the route waits at b for 4 minutes and 40 seconds and departs at 9:10 a.m. This wait time is stored in the Wait_TravelTime field of stop b as 4.66 minutes and is added to the total time taken for the route. The Cumul_TraveTime field for a stop stores the total time taken to reach it. The cumulative travel time of b is 10 minutes (5 minutes and 20 seconds of travel and 4 minutes and 40 seconds of waiting to honor the time window of stop b).
The route departs from stop b at 9:10 a.m. and reaches stop c at 9:15:20 a.m. However, stop c has a time window of 9:10 to 9:12 a.m. There is a violation of 3 minutes and 20 seconds, which is stored in the Violation_TravelTime field as 3.33 minutes, since the route is unable to honor the time window of stop c.
Stop c is symbolized with the time violation symbol .
Time windows are treated as a soft constraint. This means that although the solver attempts to honor time windows, it will violate the time windows of some stops to reach them if necessary. This is different from a hard constraint, in which there is no route to the stop that has a time window violation. Hard time windows are not supported by the Route analysis layer. You can, however, use them for the Order time windows in a Vehicle Routing Problem analysis layer by setting the corresponding MaxViolationTime field to zero.
A route solver attempts to find the least-cost route through a series of stops while respecting chosen restrictions on the network and honoring all time windows. If time window violations are inevitable, the solver attempts to minimize the total violation time.