メインコンテンツまでスキップ

Multiple Time Windows

In standard VRP problems, a node (pickup or drop-off) typically has a single time window defined by open_time_ts and close_time_ts. However, in many real-world scenarios, a location might be accessible during multiple disjoint time intervals. For example, a warehouse might be open for deliveries from 08:00 to 12:00 and then again from 14:00 to 18:00, closing for a lunch break in between.

The Multiple Time Windows feature allows you to define these additional valid time slots for a node.

Configuration

To specify multiple time windows for a node, you use the time_windows property in the node object. This field allows setting multiple time windows for a booking at a pickup or drop-off location.

  • Primary Time Window: Defined by the standard open_time_ts and close_time_ts fields.
  • Additional Time Windows: Defined as a list of objects in the time_windows array.

Merging Logic

If time_windows is set, the resulting set of valid time windows will be a combination of the primary time window (from open_time_ts/close_time_ts) and the additional windows defined in time_windows.

For example, if there is one additional time window set in this field, the resulting valid time window set will have two elements: one from the booking itself and the other from this field. This field can be thought of as an "additional" time window.

If time windows are set in this field, as well as with min_pickup_time/max_pickup_time (or open_time_ts/close_time_ts), the algorithm will consider all time windows (as a combination of all fields with merging logic for overlapping time windows applied). Set time windows may overlap; however, this may result in less efficient routes.

Parameter Details for Stateless API

ParameterTypeDescription
time_windowsarray of objectsA list of additional time window objects.

Time Window Object Structure:

FieldTypeDescription
open_time_tsstring (date-time)The start of the time window.
close_time_tsstring (date-time)The end of the time window.
close_time_ts_dynamicstring (date-time)The dynamic end of the time window (usually same as close_time_ts).

Example JSON Payload

In this example, dropoff_A has a primary time window in the morning (09:00 - 10:00) and an additional time window in the afternoon (14:00 - 15:00).

{
"nodes": [
{
"uid": "dropoff_A",
"node_type": "dropoff",
"open_time_ts": "2025-11-21T09:00:00Z",
"close_time_ts": "2025-11-21T10:00:00Z",
"time_windows": [
{
"open_time_ts": "2025-11-21T14:00:00Z",
"close_time_ts": "2025-11-21T15:00:00Z",
"close_time_ts_dynamic": "2025-11-21T15:00:00Z"
}
],
// ... other node properties
}
]
}

Using with Integration API

When uploading bookings via the Integration API, you can specify multiple time windows using the pickup_time_windows and dropoff_time_windows properties. These fields allow you to define additional valid time slots for pickup and drop-off locations, respectively.

備考

The structure of the time window objects within these arrays is identical to the node configuration described above.

Example Booking Payload

In this example, the booking has a primary pickup window in the morning and an additional pickup window in the afternoon.

{
"bookings": [
{
"uid": "booking_1",
"pickup_location_name": "Warehouse A",
"min_pickup_time": "2025-11-21T09:00:00Z",
"max_pickup_time": "2025-11-21T10:00:00Z",
"pickup_time_windows": [
{
"open_time_ts": "2025-11-21T14:00:00Z",
"close_time_ts": "2025-11-21T15:00:00Z",
"close_time_ts_dynamic": "2025-11-21T15:00:00Z"
}
],
// ... other booking properties
}
]
}

Example Booking Payload with Dropoff Time Windows

In this example, the booking has a primary drop-off window and multiple additional drop-off windows.

{
"bookings": [
{
"uid": "booking_2",
"dropoff_location_name": "Store B",
"min_dropoff_time": "2025-11-21T10:00:00Z",
"max_dropoff_time": "2025-11-21T11:00:00Z",
"dropoff_time_windows": [
{
"open_time_ts": "2025-11-21T16:00:00Z",
"close_time_ts": "2025-11-21T17:00:00Z",
"close_time_ts_dynamic": "2025-11-21T17:00:00Z"
},
{
"open_time_ts": "2025-11-21T20:00:00Z",
"close_time_ts": "2025-11-21T21:00:00Z",
"close_time_ts_dynamic": "2025-11-21T21:00:00Z"
}
],
// ... other booking properties
}
]
}

Use Cases

  1. Lunch Breaks: A delivery location closes for lunch (e.g., 12:00-13:00) but is open before and after. You can define the morning slot as the primary window and the afternoon slot in time_windows.
  2. Shift-Based Access: A site is only accessible during specific shifts (e.g., morning shift and night shift) but not in between.
  3. Restricted Urban Access: Some city zones might allow delivery vehicles only during specific off-peak hours (e.g., early morning and late evening).

Playground

You can try out the Multiple Time Windows concept using the playground below.

In this scenario:

  • Dropoff A has a primary window of 08:00 - 08:10 and a secondary window of 14:00 - 15:00.
  • Dropoff B has a single window of 09:00 - 10:00.

Because the vehicle starts at 08:00 and needs to perform a pickup first, it is impossible to reach Dropoff A within its primary window (08:00 - 08:10). Therefore, the solver automatically schedules Dropoff A in its secondary window (14:00 - 15:00).

Try it yourself: Remove the time_windows array for dropoff_A in the JSON editor below and run the calculation again. You will see that dropoff_A becomes unassigned (or the solution fails) because the primary time window cannot be met.

Loading...