Set soft time windows
The HERE Tour Planing API supports soft time windows to allow for more flexibility when minor delays are acceptable. Soft time windows enable slight departures from the time constraints when adhering to them precisely is hard or unfeasible.
Note
This is an ALPHA feature, which means it is new or experimental and under active development. Alpha features are provided for testing and feedback purposes. They may change significantly or might not become generally available.
For more information, see Explore experimental features.
Time windows as hard and soft constraints
When specifying a problem, you can configure time windows which represent the time period allotted for starting a delivery or pickup job as a hard or soft constraint:
-
Hard constraint: When you configure a time window as a hard constraint, no violations are allowed. For example, if you configure a delivery time window to between
12:00and15:00, a vehicle must start the job within that time frame, otherwise the optimization algorithm might leave the job unassigned. See the following snippet as an example:{ "id": "Job_1", "tasks": { "deliveries": [ { "places": [ { "times": [ [ "2024-07-31T12:00:00+02:00", // lower hard TW time limit "2024-07-31T15:00:00+02:00" // upper hard TW time limit ] ], "location": { "lat": 52.63329, "lng": 13.3138 }, "duration": 300 } ], "demand": [ 1 ] } ] } } -
Soft constraint: To allow flexibility, you can specify the
12:00-15:00time frame as the preferred delivery time window, indicating that arriving outside of that window is still acceptable. That preferred time window must be placed within a broader, hard constraint time window that determines the absolute time limit for serving the job, for example, between11:00and16:00. This means that while you prefer that the job starts no later than15:00, you still accept if it starts up to60minutes late. In addition, depending on your business objectives, you specify the penalty type for violating the preferred time window. The following snippet shows a sample job with a soft time window:{ "id": "Job_1", "tasks": { "deliveries": [ { "places": [ { "timeWindows": [ { "from": { "time": "2024-07-31T11:00:00+02:00", // lower hard TW limit "preferred": "2024-07-31T12:00:00+02:00", // lower soft TW limit "penalty": { "type": "linear" } }, "to": { "time": "2024-07-31T16:00:00+02:00", // upper hard TW limit "preferred": "2024-07-31T15:00:00+02:00", // upper soft TW limit "penalty": { "type": "linear" } } } ], "location": { "lat": 52.63329, "lng": 13.3138 }, "duration": 300 } ], "demand": [ 1 ] } ] } }
Discouraging excessive deviations from the preferred time window
The penalty that you must associate with the soft time window ensures that the optimization algorithm prioritizes serving the job as close to the preferred time window as possible, while still allowing flexibility to go beyond it when necessary, as long as the absolute time window is not exceeded. The HERE Tour Planning API enables the following penalty types:
linear: This penalty type increases at a constant rate for each unit of penalty violation. Consider this penalty type in scenarios where minor delays up to a certain point in time do not cause major consequences, for example, in grocery delivery or passenger pickup. Because linear penalties impose costs immediately and consistently for any deviation, they are stricter in maintaining close adherence to the schedule from the start as compared to quadratic penalties.quadratic: In contrast to linear penalties, quadratic penalties become increasingly strict with larger deviations, providing some flexibility at first but strongly discouraging large shifts away from the assigned time window. Consider this penalty type for scenarios where time-sensitivity plays a major role and lateness has more serious consequences. Examples where this penalty type might be suitable include medical or perishable goods deliveries, executive transport, and so on.
The following diagram helps you visualize how the API applies each penalty type, as lateness increases:
The penalty score is an abstract numeric value that does not directly affect any solution parameters, such as cost or duration. Instead, it is used by the optimization algorithm to evaluate jobs that violate soft time windows.
As illustrated in the previous diagram, smaller violations result in lower penalty scores, while more serious violations incur higher penalty scores. The specific penalty score depends on the type of violation. The optimization algorithm tends to favor solutions with lower penalty scores, as they correspond to less severe violations of the preferred (soft) time windows.
Indicating violated soft time windows
In contrast to violated hard constraint time windows, violated soft time windows do not result in unassigned jobs. Instead, the solution indicates the number of time windows in which the soft constraint was violated without exceeding the absolute limit for serving the job, as part of the violations.timeWindows object. In addition to the number of violated soft time windows, the object indicates the total sum of seconds by which all soft time windows were violated.
See the following snippet for example:
{
"violations": {
"timeWindows": {
"count": 11,
"total": 17728
}
}
}The object indicates that 11 time windows were violated by the total sum of 17728 seconds.
Note
The
violations.timeWindowsobject is available at the solution level and the tour level.
Problem #1: Time windows as a hard constraint
This sample scenario concerns a local grocery delivery service operating in a busy urban area. The service has a single delivery vehicle which is required to complete 10 delivery jobs within a two-hour time window (between 12:00 PM and 2:00 PM). This requirement ensures that customers receive their groceries at the time of their lunch break. The optimization algorithm must not allow any violations of the specified time window.
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"id": "small",
"profile": "car",
"costs": {
"fixed": 20,
"distance": 0,
"time": 0.005
},
"shifts": [
{
"start": {
"time": "2024-07-31T08:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
},
"end": {
"time": "2024-07-31T16:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
}
}
],
"capacity": [
100
],
"amount": 1
}
],
"profiles": [
{
"type": "car",
"name": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.54937,
"lng": 13.44765
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"times": [
[
"2024-07-31T12:00:00Z",
"2024-07-31T14:00:00Z"
]
],
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution
The solution for the previous problem shows that the optimization algorithm was unable to fit all the jobs within the required time window, which resulted in three unassigned jobs.
The following figure shows the visual breakdown of the solution:
The following section contains the full solution JSON:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 63.17,
"distance": 43404,
"duration": 8634,
"times": {
"driving": 4434,
"serving": 4200,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"tours": [
{
"vehicleId": "small_1",
"typeId": "small",
"stops": [
{
"time": {
"arrival": "2024-07-31T08:00:00Z",
"departure": "2024-07-31T11:41:42Z"
},
"load": [
7
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2024-07-31T08:00:00Z",
"end": "2024-07-31T11:41:42Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 0
},
{
"time": {
"arrival": "2024-07-31T12:00:00Z",
"departure": "2024-07-31T12:10:00Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_10",
"type": "delivery",
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"time": {
"start": "2024-07-31T12:00:00Z",
"end": "2024-07-31T12:10:00Z"
}
}
],
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"distance": 11324
},
{
"time": {
"arrival": "2024-07-31T12:13:59Z",
"departure": "2024-07-31T12:23:59Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_9",
"type": "delivery",
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"time": {
"start": "2024-07-31T12:13:59Z",
"end": "2024-07-31T12:23:59Z"
}
}
],
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"distance": 13450
},
{
"time": {
"arrival": "2024-07-31T12:33:23Z",
"departure": "2024-07-31T12:43:23Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_8",
"type": "delivery",
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"time": {
"start": "2024-07-31T12:33:23Z",
"end": "2024-07-31T12:43:23Z"
}
}
],
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"distance": 18454
},
{
"time": {
"arrival": "2024-07-31T12:50:14Z",
"departure": "2024-07-31T13:00:14Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_7",
"type": "delivery",
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"time": {
"start": "2024-07-31T12:50:14Z",
"end": "2024-07-31T13:00:14Z"
}
}
],
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"distance": 22480
},
{
"time": {
"arrival": "2024-07-31T13:06:25Z",
"departure": "2024-07-31T13:16:25Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_6",
"type": "delivery",
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"time": {
"start": "2024-07-31T13:06:25Z",
"end": "2024-07-31T13:16:25Z"
}
}
],
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"distance": 26037
},
{
"time": {
"arrival": "2024-07-31T13:25:33Z",
"departure": "2024-07-31T13:35:33Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_5",
"type": "delivery",
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"time": {
"start": "2024-07-31T13:25:33Z",
"end": "2024-07-31T13:35:33Z"
}
}
],
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"distance": 31355
},
{
"time": {
"arrival": "2024-07-31T13:41:57Z",
"departure": "2024-07-31T13:51:57Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_4",
"type": "delivery",
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"time": {
"start": "2024-07-31T13:41:57Z",
"end": "2024-07-31T13:51:57Z"
}
}
],
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"distance": 35073
},
{
"time": {
"arrival": "2024-07-31T14:05:36Z",
"departure": "2024-07-31T14:05:36Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2024-07-31T14:05:36Z",
"end": "2024-07-31T14:05:36Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 43404
}
],
"statistic": {
"cost": 63.17,
"distance": 43404,
"duration": 8634,
"times": {
"driving": 4434,
"serving": 4200,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"shiftIndex": 0
}
],
"unassigned": [
{
"jobId": "Job_2",
"reasons": [
{
"code": "TIME_WINDOW_CONSTRAINT",
"description": "cannot be assigned due to violation of time window",
"details": [
{
"vehicleId": "small_1",
"shiftIndex": 0
}
]
}
]
},
{
"jobId": "Job_1",
"reasons": [
{
"code": "TIME_WINDOW_CONSTRAINT",
"description": "cannot be assigned due to violation of time window",
"details": [
{
"vehicleId": "small_1",
"shiftIndex": 0
}
]
}
]
},
{
"jobId": "Job_3",
"reasons": [
{
"code": "TIME_WINDOW_CONSTRAINT",
"description": "cannot be assigned due to violation of time window",
"details": [
{
"vehicleId": "small_1",
"shiftIndex": 0
}
]
}
]
}
]
}A failure to deliver groceries due to unassigned jobs might result in serious consequences for the service, such as lower operational efficiency, lower customer satisfaction, or loss of revenue.
Problem #2: Time windows as a soft constraint
The HERE Tour Planning allows several ways to address time window violations, such as the ones that the previous scenario shows.
For example, the grocery service might add extra vehicles to spread the workload so that all deliveries are made on time. However, such purchase could require a substantial investment which the company might not be able to make.
To ensure the completion of all deliveries while remaining cost-efficient, the service might make the time window constraint soft by allowing deliveries to occur up to 30 minutes earlier or later. This ensures that all customers receive their groceries, ideally during their lunch break.
To reflect the modified requirement, in each job, the times property was replaced by the timeWindows property, as shown in the following snippet:
{
...
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
]
...
}The linear penalty type provides the flexibility that is needed to manage urban delivery challenges with soft time windows while incentivizing timely deliveries.
The following section shows the full problem JSON:
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"id": "small",
"profile": "car",
"costs": {
"fixed": 20,
"distance": 0,
"time": 0.005
},
"shifts": [
{
"start": {
"time": "2024-07-31T08:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
},
"end": {
"time": "2024-07-31T16:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
}
}
],
"capacity": [
100
],
"amount": 1
}
],
"profiles": [
{
"type": "car",
"name": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T15:30:00Z",
"preferred": "2024-07-31T15:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.54937,
"lng": 13.44765
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"timeWindows": [
{
"from": {
"time": "2024-07-31T11:30:00Z",
"preferred": "2024-07-31T12:00:00Z",
"penalty": {
"type": "linear"
}
},
"to": {
"time": "2024-07-31T14:30:00Z",
"preferred": "2024-07-31T14:00:00Z",
"penalty": {
"type": "linear"
}
}
}
],
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution
This time, the optimization algorithm was able to allocate all required jobs within the soft time window constraints, with the tour statistics showing that time windows for three jobs were violated by the total sum of 1994 seconds (33 minutes and 14 seconds):
{ ...
"violations": {
"timeWindows": {
"count": 3,
"total": 1994
}
}
...
}The following figure shows the visual breakdown of the solution:
The following section contains the full solution JSON:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 84.28999999999999,
"distance": 65615,
"duration": 12858,
"times": {
"driving": 6858,
"serving": 6000,
"waiting": 0,
"stopping": 0,
"break": 0
},
"violations": {
"timeWindows": {
"count": 3,
"total": 1994
}
}
},
"tours": [
{
"vehicleId": "small_1",
"typeId": "small",
"stops": [
{
"time": {
"arrival": "2024-07-31T08:00:00Z",
"departure": "2024-07-31T11:16:00Z"
},
"load": [
10
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2024-07-31T08:00:00Z",
"end": "2024-07-31T11:16:00Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 0
},
{
"time": {
"arrival": "2024-07-31T11:37:31Z",
"departure": "2024-07-31T11:47:31Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_9",
"type": "delivery",
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"time": {
"start": "2024-07-31T11:37:31Z",
"end": "2024-07-31T11:47:31Z"
}
}
],
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"distance": 13034
},
{
"time": {
"arrival": "2024-07-31T11:51:52Z",
"departure": "2024-07-31T12:01:52Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_10",
"type": "delivery",
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"time": {
"start": "2024-07-31T11:51:52Z",
"end": "2024-07-31T12:01:52Z"
}
}
],
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"distance": 15161
},
{
"time": {
"arrival": "2024-07-31T12:09:08Z",
"departure": "2024-07-31T12:19:08Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_8",
"type": "delivery",
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"time": {
"start": "2024-07-31T12:09:08Z",
"end": "2024-07-31T12:19:08Z"
}
}
],
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"distance": 19222
},
{
"time": {
"arrival": "2024-07-31T12:25:59Z",
"departure": "2024-07-31T12:35:59Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_7",
"type": "delivery",
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"time": {
"start": "2024-07-31T12:25:59Z",
"end": "2024-07-31T12:35:59Z"
}
}
],
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"distance": 23248
},
{
"time": {
"arrival": "2024-07-31T12:42:10Z",
"departure": "2024-07-31T12:52:10Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_6",
"type": "delivery",
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"time": {
"start": "2024-07-31T12:42:10Z",
"end": "2024-07-31T12:52:10Z"
}
}
],
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"distance": 26805
},
{
"time": {
"arrival": "2024-07-31T13:01:18Z",
"departure": "2024-07-31T13:11:18Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_5",
"type": "delivery",
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"time": {
"start": "2024-07-31T13:01:18Z",
"end": "2024-07-31T13:11:18Z"
}
}
],
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"distance": 32123
},
{
"time": {
"arrival": "2024-07-31T13:17:42Z",
"departure": "2024-07-31T13:27:42Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_4",
"type": "delivery",
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"time": {
"start": "2024-07-31T13:17:42Z",
"end": "2024-07-31T13:27:42Z"
}
}
],
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"distance": 35841
},
{
"time": {
"arrival": "2024-07-31T13:41:15Z",
"departure": "2024-07-31T13:51:15Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_2",
"type": "delivery",
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"time": {
"start": "2024-07-31T13:41:15Z",
"end": "2024-07-31T13:51:15Z"
}
}
],
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"distance": 44595
},
{
"time": {
"arrival": "2024-07-31T14:02:37Z",
"departure": "2024-07-31T14:12:37Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_3",
"type": "delivery",
"location": {
"lat": 52.54937,
"lng": 13.44765
},
"time": {
"start": "2024-07-31T14:02:37Z",
"end": "2024-07-31T14:12:37Z"
}
}
],
"location": {
"lat": 52.54937,
"lng": 13.44765
},
"distance": 51613
},
{
"time": {
"arrival": "2024-07-31T14:23:19Z",
"departure": "2024-07-31T14:33:19Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_1",
"type": "delivery",
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"time": {
"start": "2024-07-31T14:23:19Z",
"end": "2024-07-31T14:33:19Z"
}
}
],
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"distance": 55742
},
{
"time": {
"arrival": "2024-07-31T14:50:18Z",
"departure": "2024-07-31T14:50:18Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2024-07-31T14:50:18Z",
"end": "2024-07-31T14:50:18Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 65615
}
],
"statistic": {
"cost": 84.28999999999999,
"distance": 65615,
"duration": 12858,
"times": {
"driving": 6858,
"serving": 6000,
"waiting": 0,
"stopping": 0,
"break": 0
},
"violations": {
"timeWindows": {
"count": 3,
"total": 1994
}
}
},
"shiftIndex": 0
}
]
}Conclusions
The introduction of soft time windows has significantly improved tour efficiency. This introduced flexibility which allowed the service to complete all deliveries with minor time adjustments, which reduced the number of undelivered orders as a result of strict time constraints and helped to prevent a backlog of pending deliveries.
Next steps
- For more information about hard constraint time windows, see Limit the start time of activities through time windows.
- For an in-depth exploration of the HERE Tour Planning API methods, endpoints, and parameters, see the API Reference.
Updated 29 days ago