3.5 Extension 4: Time Windows
Download Workbook: pdp_extension_4.xlsx.
In the last section we introduced simple earliest and latest delivery time constraints. However, for some of Opturion Freight’s customers the situation is more complex. They open early, close for lunch and then re-open after lunch.
Describing these more complex delivery time constraints requires the use of time windows.
A time window is a span of time that has a fixed start time and a fixed end time. Order pickups and deliveries may have multiple time windows associated with them. The optimiser will schedule the pickup or delivery so that it occurs inside at least one of the time windows. (It may be scheduled inside multiple time windows if they overlap.)
Time windows can also be associated with locations. If a location has time windows, then any pickup or delivery at that location must occur inside one of those time windows.
Time windows are defined using the Time Windows sheet. Table x13-16001r88 shows an example of this sheet.
| Id | Start | End |
| Morning | 7:00 | 12:00 |
| Afternoon | 12:00 | 16:00 |
| Not Lunch | 7:00 | 12:00 |
| Not Lunch | 13:00 | 16:00 |
Each group of time windows is defined by the identifier in the Id column. Rows sharing the same identifier belong to the same time window group. Start and end times for the individual windows in each group are given by the Start and End columns.
The example in Table x13-16001r88 defines three groups of time windows: Morning, Afternoon and Not Lunch. Morning consists of a single span of time, from 7:00 to 12:00. Likewise, Afternoon consists of a single span of time, from 12:00 to 16:00. Not Lunch consists of two spans of time, 7:00 to 12:00 and 13:00 to 16:00. Both these latter windows are part of the same time window group as they share the identifier, Not Lunch.
To use these time window groups to constrain delivery times, we add a Delivery Time Windows column to the Orders sheet. If a cell in this column contains the identifier of a time window group, then those time windows will apply to the delivery of the order in that row. (Pickup time windows are similarly handled using the Pickup Time Windows column of the Orders sheet.)
Time windows defined using the Time Windows sheet combine with other times, such as earliest and latest delivery times or location time windows. For example, if an order has a delivery time window and an earliest delivery time, then it must be scheduled at a time which is both inside the delivery time window and after the earliest delivery time. If this is impossible, for example because the earliest delivery time is after any of the delivery time windows, then the order cannot be assigned by the optimiser. Such orders are reported in the Unassigned Orders sheet of the solution workbook.
The accompanying workbook defines and uses delivery time windows.

