Apply separate costs to vehicle waiting time
Minimize idle vehicle costs by applying a different cost rate to waiting time compared to driving and service time.
In many real-world delivery scenarios, waiting time has a different business cost than active driving or service time. For example, refrigerated vehicles consume expensive power while idling, service technicians are paid hourly regardless of whether they are driving or waiting, and environmental regulations may discourage unnecessary vehicle idling.
With the perWaitingTime cost parameter in the HERE Tour Planning API, you can assign a higher cost to waiting time to encourage the optimization algorithm to minimize idle periods, even if doing so results in slightly longer driving distances or different route sequences.
Define waiting time costs
The perWaitingTime property is an optional field within the costs object for each vehicle type in fleet.types[]. It specifies the cost per second for time spent waiting, such as when a vehicle arrives before a time window opens.
For more information about configuring vehicle types and their properties, see Problem.
If you do not specify perWaitingTime, the optimization algorithm uses the regular time cost for all time-based calculations, including waiting time.
The following example shows a vehicle cost configuration where waiting time is penalized at five times the rate of regular driving and service time:
{
"costs": {
"time": 0.004,
"distance": 0.00015,
"perWaitingTime": 0.02,
"fixed": 25
}
}In this configuration:
time: Cost per second for driving and service time (0.004/second = 14.40/hour)distance: Cost per meter (0.00015/meter = 0.15/kilometer)perWaitingTime: Cost per second for waiting time (0.02/second = 72/hour)fixed: Fixed cost per vehicle (25)
For more information, see the API Reference.
Understand cost calculation with perWaitingTime
When you specify perWaitingTime, the total time-based cost is calculated as:
Total Cost = (duration - waiting_time) × costs.time + waiting_time × costs.perWaitingTime + distance × costs.distance + costs.fixed
Where:
duration: Total time spent on the tour, including driving, service, and waitingwaiting_time: Time spent waiting (for example, arriving before a time window opens)
The optimization algorithm excludes stopping time and break time from the waiting cost calculation. Only actual idle waiting periods are charged at the perWaitingTime rate.
When to use separate waiting time costs
Consider using perWaitingTime in scenarios where idle time has different business costs than active driving time:
- Refrigerated delivery: Vehicles with refrigeration units consume expensive power while idling, making waiting time more costly than driving time.
- Service technicians: Hourly labor costs remain the same whether technicians are driving or waiting, but productive work time is more valuable.
- Environmental compliance: Regulations or sustainability goals discourage unnecessary vehicle idling.
- Equipment wear: Extended idling increases wear on specialized equipment such as cooling systems or auxiliary power units.
- Premium service: Minimizing customer wait time after arrival improves service quality.
- Electric vehicles: Battery drain during idle time may differ from drain during active driving. For more information about planning EV routes, see Plan efficient routes for EV fleets.
Tip
The
perWaitingTimefeature works together with time windows to give you fine control over waiting time costs. For scenarios where you want to allow some flexibility in delivery timing while penalizing excessive waiting, consider combiningperWaitingTimewith soft time windows.
Example: Delivery service with time window clusters
In this scenario, a delivery company operates in Berlin, Germany, serving 21 customer locations with 2 vehicles. The deliveries are concentrated in two distinct time window clusters:
- Time Window Cluster 1: 10 jobs (08:00 - 09:00)
- Time Window Cluster 2: 11 jobs (10:00 - 11:00)
- Gap between clusters: No deliveries scheduled between 09:00 and 10:00, creating potential for significant waiting time
The key operational challenges are:
- Idle time between clusters: The one-hour gap between time window clusters can lead to expensive vehicle waiting time.
- Resource utilization: With only one vehicle, the driver must wait between delivery clusters, increasing labor costs.
- Fleet sizing: Determining whether to use one vehicle with waiting time or multiple vehicles without waiting.
- Time window constraints: All deliveries must be completed within their designated time windows.
By setting perWaitingTime to 0.08 (60% higher than the regular time cost of 0.05), the optimization algorithm can evaluate whether deploying a second vehicle to eliminate waiting time is more cost-effective than having one vehicle wait.
Problem without perWaitingTime
The following problem defines a delivery scenario without the perWaitingTime cost. In this scenario, the optimization algorithm uses the standard time cost for all time-based calculations:
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"id": "car_vehicle_1",
"profile": "car",
"costs": {
"fixed": 120,
"time": 0.05
},
"shifts": [
{
"start": {
"time": "2024-06-24T08:00:00Z",
"location": {
"lat": 52.531,
"lng": 13.38461
}
},
"end": {
"time": "2024-06-24T20:00:00Z",
"location": {
"lat": 52.531,
"lng": 13.38461
}
}
}
],
"capacity": [
300
],
"amount": 2
}
],
"profiles": [
{
"type": "car",
"name": "car"
}
]
},
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "minimizeCost"
}
],
"plan": {
"jobs": [
{
"id": "job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679571
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.52549759240047,
"lng": 13.322028089314701
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_11",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_12",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_13",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_14",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_15",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_16",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_17",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_18",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.52722,
"lng": 13.33226
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_19",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_20",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685255
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_21",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.526308577413644,
"lng": 13.315760605037214
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution interpretation - baseline scenario
The following statistic shows the solution when waiting time is charged at the standard time rate (without the perWaitingTime cost):
{
"statistic": {
"cost": 648.7,
"distance": 39327,
"duration": 10574,
"times": {
"break": 0,
"driving": 5814,
"serving": 1260,
"stopping": 0,
"waiting": 3500,
"intraStop": 0
},
"costs": {
"fixed": 120,
"time": 528.7
},
"intraStopDistance": 0
}
}In this baseline scenario, the solution statistics show:
- Total cost: 648.7
- Number of vehicles used: 1
- Distance: 39,327 meters (~39 km)
- Total waiting time: 3,500 seconds (~58 minutes)
- Driving time: 5,814 seconds (~1.6 hours)
- Service time: 1,260 seconds (21 minutes)
The optimization algorithm chose to use only one vehicle because waiting time and driving time are both charged at the same rate. The vehicle completes all 10 jobs in the first time window cluster (08:00-09:00), then waits nearly one hour for the second time window cluster to open (10:00-11:00). Since the cost of waiting is equal to the cost of driving, using one vehicle with waiting time is more economical than deploying a second vehicle with its fixed cost of 120.
The following visualization shows the single-vehicle solution with significant waiting time. Note the ~1 hour idle period between completing job_13 (at 09:01:00) and starting job_5 (at 10:06:05), where the vehicle waits for the second time window cluster to open:
See the following section for the full solution JSON:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 648.7,
"distance": 39327,
"duration": 10574,
"times": {
"break": 0,
"driving": 5814,
"serving": 1260,
"stopping": 0,
"waiting": 3500,
"intraStop": 0
},
"costs": {
"fixed": 120,
"time": 528.7
},
"intraStopDistance": 0
},
"tours": [
{
"shiftIndex": 0,
"statistic": {
"cost": 648.7,
"distance": 39327,
"duration": 10574,
"times": {
"break": 0,
"driving": 5814,
"serving": 1260,
"stopping": 0,
"waiting": 3500,
"intraStop": 0
},
"costs": {
"fixed": 120,
"time": 528.7
},
"intraStopDistance": 0
},
"stops": [
{
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T08:00:00Z",
"start": "2024-06-24T08:00:00Z",
"end": "2024-06-24T08:07:43Z"
}
}
],
"load": [
21
],
"time": {
"arrival": "2024-06-24T08:00:00Z",
"departure": "2024-06-24T08:07:43Z"
},
"distance": 0,
"location": {
"lat": 52.531,
"lng": 13.38461
}
},
{
"activities": [
{
"jobId": "job_18",
"type": "delivery",
"location": {
"lat": 52.52722,
"lng": 13.33226
},
"time": {
"arrival": "2024-06-24T08:16:16Z",
"start": "2024-06-24T08:16:16Z",
"end": "2024-06-24T08:17:16Z"
}
}
],
"load": [
20
],
"time": {
"arrival": "2024-06-24T08:16:16Z",
"departure": "2024-06-24T08:17:16Z"
},
"distance": 3930,
"location": {
"lat": 52.52722,
"lng": 13.33226
}
},
{
"activities": [
{
"jobId": "job_10",
"type": "delivery",
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
},
"time": {
"arrival": "2024-06-24T08:20:16Z",
"start": "2024-06-24T08:20:16Z",
"end": "2024-06-24T08:21:16Z"
}
}
],
"load": [
19
],
"time": {
"arrival": "2024-06-24T08:20:16Z",
"departure": "2024-06-24T08:21:16Z"
},
"distance": 5312,
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
}
},
{
"activities": [
{
"jobId": "job_21",
"type": "delivery",
"location": {
"lat": 52.52630857741365,
"lng": 13.315760605037214
},
"time": {
"arrival": "2024-06-24T08:21:47Z",
"start": "2024-06-24T08:21:47Z",
"end": "2024-06-24T08:22:47Z"
}
}
],
"load": [
18
],
"time": {
"arrival": "2024-06-24T08:21:47Z",
"departure": "2024-06-24T08:22:47Z"
},
"distance": 5550,
"location": {
"lat": 52.52630857741365,
"lng": 13.315760605037214
}
},
{
"activities": [
{
"jobId": "job_3",
"type": "delivery",
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"time": {
"arrival": "2024-06-24T08:30:52Z",
"start": "2024-06-24T08:30:52Z",
"end": "2024-06-24T08:31:52Z"
}
}
],
"load": [
17
],
"time": {
"arrival": "2024-06-24T08:30:52Z",
"departure": "2024-06-24T08:31:52Z"
},
"distance": 9642,
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
}
},
{
"activities": [
{
"jobId": "job_11",
"type": "delivery",
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
},
"time": {
"arrival": "2024-06-24T08:39:42Z",
"start": "2024-06-24T08:39:42Z",
"end": "2024-06-24T08:40:42Z"
}
}
],
"load": [
16
],
"time": {
"arrival": "2024-06-24T08:39:42Z",
"departure": "2024-06-24T08:40:42Z"
},
"distance": 12587,
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
}
},
{
"activities": [
{
"jobId": "job_7",
"type": "delivery",
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
},
"time": {
"arrival": "2024-06-24T08:41:22Z",
"start": "2024-06-24T08:41:22Z",
"end": "2024-06-24T08:42:22Z"
}
}
],
"load": [
15
],
"time": {
"arrival": "2024-06-24T08:41:22Z",
"departure": "2024-06-24T08:42:22Z"
},
"distance": 12835,
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
}
},
{
"activities": [
{
"jobId": "job_16",
"type": "delivery",
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
},
"time": {
"arrival": "2024-06-24T08:49:19Z",
"start": "2024-06-24T08:49:19Z",
"end": "2024-06-24T08:50:19Z"
}
}
],
"load": [
14
],
"time": {
"arrival": "2024-06-24T08:49:19Z",
"departure": "2024-06-24T08:50:19Z"
},
"distance": 15659,
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
}
},
{
"activities": [
{
"jobId": "job_17",
"type": "delivery",
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
},
"time": {
"arrival": "2024-06-24T08:53:30Z",
"start": "2024-06-24T08:53:30Z",
"end": "2024-06-24T08:54:30Z"
}
}
],
"load": [
13
],
"time": {
"arrival": "2024-06-24T08:53:30Z",
"departure": "2024-06-24T08:54:30Z"
},
"distance": 16459,
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
}
},
{
"activities": [
{
"jobId": "job_9",
"type": "delivery",
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
},
"time": {
"arrival": "2024-06-24T08:57:35Z",
"start": "2024-06-24T08:57:35Z",
"end": "2024-06-24T08:58:35Z"
}
}
],
"load": [
12
],
"time": {
"arrival": "2024-06-24T08:57:35Z",
"departure": "2024-06-24T08:58:35Z"
},
"distance": 17166,
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
}
},
{
"activities": [
{
"jobId": "job_4",
"type": "delivery",
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
},
"time": {
"arrival": "2024-06-24T09:00:00Z",
"start": "2024-06-24T09:00:00Z",
"end": "2024-06-24T09:01:00Z"
}
}
],
"load": [
11
],
"time": {
"arrival": "2024-06-24T09:00:00Z",
"departure": "2024-06-24T09:01:00Z"
},
"distance": 17690,
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
}
},
{
"activities": [
{
"jobId": "job_13",
"type": "delivery",
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
},
"time": {
"arrival": "2024-06-24T09:01:40Z",
"start": "2024-06-24T10:00:00Z",
"end": "2024-06-24T10:01:00Z"
}
}
],
"load": [
10
],
"time": {
"arrival": "2024-06-24T09:01:40Z",
"departure": "2024-06-24T10:01:00Z"
},
"distance": 17942,
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
}
},
{
"activities": [
{
"jobId": "job_5",
"type": "delivery",
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
},
"time": {
"arrival": "2024-06-24T10:06:05Z",
"start": "2024-06-24T10:06:05Z",
"end": "2024-06-24T10:07:05Z"
}
}
],
"load": [
9
],
"time": {
"arrival": "2024-06-24T10:06:05Z",
"departure": "2024-06-24T10:07:05Z"
},
"distance": 19518,
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
}
},
{
"activities": [
{
"jobId": "job_19",
"type": "delivery",
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
},
"time": {
"arrival": "2024-06-24T10:09:43Z",
"start": "2024-06-24T10:09:43Z",
"end": "2024-06-24T10:10:43Z"
}
}
],
"load": [
8
],
"time": {
"arrival": "2024-06-24T10:09:43Z",
"departure": "2024-06-24T10:10:43Z"
},
"distance": 19981,
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
}
},
{
"activities": [
{
"jobId": "job_8",
"type": "delivery",
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
},
"time": {
"arrival": "2024-06-24T10:16:58Z",
"start": "2024-06-24T10:16:58Z",
"end": "2024-06-24T10:17:58Z"
}
}
],
"load": [
7
],
"time": {
"arrival": "2024-06-24T10:16:58Z",
"departure": "2024-06-24T10:17:58Z"
},
"distance": 22568,
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
}
},
{
"activities": [
{
"jobId": "job_20",
"type": "delivery",
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685256
},
"time": {
"arrival": "2024-06-24T10:19:21Z",
"start": "2024-06-24T10:19:21Z",
"end": "2024-06-24T10:20:21Z"
}
}
],
"load": [
6
],
"time": {
"arrival": "2024-06-24T10:19:21Z",
"departure": "2024-06-24T10:20:21Z"
},
"distance": 23205,
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685256
}
},
{
"activities": [
{
"jobId": "job_2",
"type": "delivery",
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"time": {
"arrival": "2024-06-24T10:26:50Z",
"start": "2024-06-24T10:26:50Z",
"end": "2024-06-24T10:27:50Z"
}
}
],
"load": [
5
],
"time": {
"arrival": "2024-06-24T10:26:50Z",
"departure": "2024-06-24T10:27:50Z"
},
"distance": 25751,
"location": {
"lat": 52.5102,
"lng": 13.3444
}
},
{
"activities": [
{
"jobId": "job_1",
"type": "delivery",
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"time": {
"arrival": "2024-06-24T10:35:03Z",
"start": "2024-06-24T10:35:03Z",
"end": "2024-06-24T10:36:03Z"
}
}
],
"load": [
4
],
"time": {
"arrival": "2024-06-24T10:35:03Z",
"departure": "2024-06-24T10:36:03Z"
},
"distance": 28653,
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
}
},
{
"activities": [
{
"jobId": "job_6",
"type": "delivery",
"location": {
"lat": 52.52549759240047,
"lng": 13.3220280893147
},
"time": {
"arrival": "2024-06-24T10:40:45Z",
"start": "2024-06-24T10:40:45Z",
"end": "2024-06-24T10:41:45Z"
}
}
],
"load": [
3
],
"time": {
"arrival": "2024-06-24T10:40:45Z",
"departure": "2024-06-24T10:41:45Z"
},
"distance": 30705,
"location": {
"lat": 52.52549759240047,
"lng": 13.3220280893147
}
},
{
"activities": [
{
"jobId": "job_12",
"type": "delivery",
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
},
"time": {
"arrival": "2024-06-24T10:43:43Z",
"start": "2024-06-24T10:43:43Z",
"end": "2024-06-24T10:44:43Z"
}
}
],
"load": [
2
],
"time": {
"arrival": "2024-06-24T10:43:43Z",
"departure": "2024-06-24T10:44:43Z"
},
"distance": 31268,
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
}
},
{
"activities": [
{
"jobId": "job_14",
"type": "delivery",
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
},
"time": {
"arrival": "2024-06-24T10:53:29Z",
"start": "2024-06-24T10:53:29Z",
"end": "2024-06-24T10:54:29Z"
}
}
],
"load": [
1
],
"time": {
"arrival": "2024-06-24T10:53:29Z",
"departure": "2024-06-24T10:54:29Z"
},
"distance": 35452,
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
}
},
{
"activities": [
{
"jobId": "job_15",
"type": "delivery",
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
},
"time": {
"arrival": "2024-06-24T10:55:54Z",
"start": "2024-06-24T10:55:54Z",
"end": "2024-06-24T10:56:54Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T10:55:54Z",
"departure": "2024-06-24T10:56:54Z"
},
"distance": 36177,
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
}
},
{
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T11:03:57Z",
"start": "2024-06-24T11:03:57Z",
"end": "2024-06-24T11:03:57Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T11:03:57Z",
"departure": "2024-06-24T11:03:57Z"
},
"distance": 39327,
"location": {
"lat": 52.531,
"lng": 13.38461
}
}
],
"typeId": "car_vehicle_1",
"vehicleId": "car_vehicle_1_1"
}
]
}Problem with perWaitingTime cost
The following problem uses the same scenario but adds perWaitingTime: 0.08 to the vehicle costs, making waiting time 60% more expensive than driving time:
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"id": "car_vehicle_1",
"profile": "car",
"costs": {
"fixed": 120,
"time": 0.05,
"perWaitingTime": 0.08
},
"shifts": [
{
"start": {
"time": "2024-06-24T08:00:00Z",
"location": {
"lat": 52.531,
"lng": 13.38461
}
},
"end": {
"time": "2024-06-24T20:00:00Z",
"location": {
"lat": 52.531,
"lng": 13.38461
}
}
}
],
"capacity": [
300
],
"amount": 2
}
],
"profiles": [
{
"type": "car",
"name": "car"
}
]
},
"objectives": [
{
"type": "minimizeUnassigned"
},
{
"type": "minimizeCost"
}
],
"plan": {
"jobs": [
{
"id": "job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679571
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.52549759240047,
"lng": 13.322028089314701
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_11",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_12",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_13",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_14",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_15",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_16",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_17",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_18",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.52722,
"lng": 13.33226
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_19",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_20",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685255
},
"duration": 60,
"times": [
[
"2024-06-24T10:00:00Z",
"2024-06-24T11:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
},
{
"id": "job_21",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.526308577413644,
"lng": 13.315760605037214
},
"duration": 60,
"times": [
[
"2024-06-24T08:00:00Z",
"2024-06-24T09:00:00Z"
]
]
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution interpretation - perWaitingTime cost included
When perWaitingTime is configured in the problem, the optimization algorithm evaluated the trade-off between waiting time costs and deploying additional vehicles.
As a result, it deployed a second vehicle to completely eliminate the expensive waiting time. This solution, while doubling the fixed vehicle cost from 120 to 240, eliminates the 3,500 seconds of waiting that would have cost 280 (3,500 × 0.08) in the single-vehicle solution.
The following snippet shows the solution statistics:
{
"statistic": {
"cost": 659.8,
"distance": 52011,
"duration": 8396,
"times": {
"break": 0,
"driving": 7136,
"serving": 1260,
"stopping": 0,
"waiting": 0,
"intraStop": 0
},
"costs": {
"fixed": 240,
"time": 419.8
},
"intraStopDistance": 0
}
}Note
There is no
costs.perWaitingTimefield in this solution because the algorithm completely eliminated waiting time by deploying a second vehicle. When waiting time is 0 seconds, there's no waiting cost to report.
With perWaitingTime configured, the solution statistics change significantly:
- Total cost: 659.8
- Number of vehicles used: 2
- Distance: 52,011 meters (~52 km)
- Total waiting time: 0 seconds
- Driving time: 7,136 seconds (~2.0 hours)
- Service time: 1,260 seconds (21 minutes)
- Fixed costs: 240 (2 vehicles × 120)
The following visualization shows how the optimization algorithm eliminated waiting time by deploying two vehicles instead of one. The first vehicle (vehicle_1_1) completes its tour at 09:06:08, serving the 08:00-09:00 time window cluster. The second vehicle (vehicle_1_2) begins its tour at 10:00:00, serving the 10:00-11:00 time window cluster. This separation by time window cluster eliminates all waiting time:
The following section shows the full solution JSON:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 659.8,
"distance": 52011,
"duration": 8396,
"times": {
"break": 0,
"driving": 7136,
"serving": 1260,
"stopping": 0,
"waiting": 0,
"intraStop": 0
},
"costs": {
"fixed": 240,
"time": 419.8
},
"intraStopDistance": 0
},
"tours": [
{
"shiftIndex": 0,
"statistic": {
"cost": 318.4,
"distance": 23797,
"duration": 3968,
"times": {
"break": 0,
"driving": 3368,
"serving": 600,
"stopping": 0,
"waiting": 0,
"intraStop": 0
},
"costs": {
"fixed": 120,
"time": 198.4
},
"intraStopDistance": 0
},
"stops": [
{
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T08:00:00Z",
"start": "2024-06-24T08:00:00Z",
"end": "2024-06-24T08:00:00Z"
}
}
],
"load": [
10
],
"time": {
"arrival": "2024-06-24T08:00:00Z",
"departure": "2024-06-24T08:00:00Z"
},
"distance": 0,
"location": {
"lat": 52.531,
"lng": 13.38461
}
},
{
"activities": [
{
"jobId": "job_18",
"type": "delivery",
"location": {
"lat": 52.52722,
"lng": 13.33226
},
"time": {
"arrival": "2024-06-24T08:08:33Z",
"start": "2024-06-24T08:08:33Z",
"end": "2024-06-24T08:09:33Z"
}
}
],
"load": [
9
],
"time": {
"arrival": "2024-06-24T08:08:33Z",
"departure": "2024-06-24T08:09:33Z"
},
"distance": 3930,
"location": {
"lat": 52.52722,
"lng": 13.33226
}
},
{
"activities": [
{
"jobId": "job_10",
"type": "delivery",
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
},
"time": {
"arrival": "2024-06-24T08:12:33Z",
"start": "2024-06-24T08:12:33Z",
"end": "2024-06-24T08:13:33Z"
}
}
],
"load": [
8
],
"time": {
"arrival": "2024-06-24T08:12:33Z",
"departure": "2024-06-24T08:13:33Z"
},
"distance": 5312,
"location": {
"lat": 52.528408613763474,
"lng": 13.315070271492006
}
},
{
"activities": [
{
"jobId": "job_21",
"type": "delivery",
"location": {
"lat": 52.52630857741365,
"lng": 13.315760605037214
},
"time": {
"arrival": "2024-06-24T08:14:04Z",
"start": "2024-06-24T08:14:04Z",
"end": "2024-06-24T08:15:04Z"
}
}
],
"load": [
7
],
"time": {
"arrival": "2024-06-24T08:14:04Z",
"departure": "2024-06-24T08:15:04Z"
},
"distance": 5550,
"location": {
"lat": 52.52630857741365,
"lng": 13.315760605037214
}
},
{
"activities": [
{
"jobId": "job_4",
"type": "delivery",
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
},
"time": {
"arrival": "2024-06-24T08:25:55Z",
"start": "2024-06-24T08:25:55Z",
"end": "2024-06-24T08:26:55Z"
}
}
],
"load": [
6
],
"time": {
"arrival": "2024-06-24T08:25:55Z",
"departure": "2024-06-24T08:26:55Z"
},
"distance": 10567,
"location": {
"lat": 52.497059874107485,
"lng": 13.315885453484954
}
},
{
"activities": [
{
"jobId": "job_9",
"type": "delivery",
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
},
"time": {
"arrival": "2024-06-24T08:28:26Z",
"start": "2024-06-24T08:28:26Z",
"end": "2024-06-24T08:29:26Z"
}
}
],
"load": [
5
],
"time": {
"arrival": "2024-06-24T08:28:26Z",
"departure": "2024-06-24T08:29:26Z"
},
"distance": 11091,
"location": {
"lat": 52.49288040904542,
"lng": 13.316116333007814
}
},
{
"activities": [
{
"jobId": "job_17",
"type": "delivery",
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
},
"time": {
"arrival": "2024-06-24T08:32:56Z",
"start": "2024-06-24T08:32:56Z",
"end": "2024-06-24T08:33:56Z"
}
}
],
"load": [
4
],
"time": {
"arrival": "2024-06-24T08:32:56Z",
"departure": "2024-06-24T08:33:56Z"
},
"distance": 11865,
"location": {
"lat": 52.4899146179686,
"lng": 13.31645965576172
}
},
{
"activities": [
{
"jobId": "job_16",
"type": "delivery",
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
},
"time": {
"arrival": "2024-06-24T08:36:49Z",
"start": "2024-06-24T08:36:49Z",
"end": "2024-06-24T08:37:49Z"
}
}
],
"load": [
3
],
"time": {
"arrival": "2024-06-24T08:36:49Z",
"departure": "2024-06-24T08:37:49Z"
},
"distance": 12582,
"location": {
"lat": 52.485953406620425,
"lng": 13.32206149119884
}
},
{
"activities": [
{
"jobId": "job_7",
"type": "delivery",
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
},
"time": {
"arrival": "2024-06-24T08:44:21Z",
"start": "2024-06-24T08:44:21Z",
"end": "2024-06-24T08:45:21Z"
}
}
],
"load": [
2
],
"time": {
"arrival": "2024-06-24T08:44:21Z",
"departure": "2024-06-24T08:45:21Z"
},
"distance": 15729,
"location": {
"lat": 52.48393404568274,
"lng": 13.353554899804296
}
},
{
"activities": [
{
"jobId": "job_11",
"type": "delivery",
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
},
"time": {
"arrival": "2024-06-24T08:46:09Z",
"start": "2024-06-24T08:46:09Z",
"end": "2024-06-24T08:47:09Z"
}
}
],
"load": [
1
],
"time": {
"arrival": "2024-06-24T08:46:09Z",
"departure": "2024-06-24T08:47:09Z"
},
"distance": 15977,
"location": {
"lat": 52.48449593926587,
"lng": 13.356247837655248
}
},
{
"activities": [
{
"jobId": "job_3",
"type": "delivery",
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
},
"time": {
"arrival": "2024-06-24T08:55:02Z",
"start": "2024-06-24T08:55:02Z",
"end": "2024-06-24T08:56:02Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T08:55:02Z",
"departure": "2024-06-24T08:56:02Z"
},
"distance": 19007,
"location": {
"lat": 52.50488105730338,
"lng": 13.355333507786808
}
},
{
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T09:06:08Z",
"start": "2024-06-24T09:06:08Z",
"end": "2024-06-24T09:06:08Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T09:06:08Z",
"departure": "2024-06-24T09:06:08Z"
},
"distance": 23797,
"location": {
"lat": 52.531,
"lng": 13.38461
}
}
],
"typeId": "car_vehicle_1",
"vehicleId": "car_vehicle_1_1"
},
{
"shiftIndex": 0,
"statistic": {
"cost": 341.4,
"distance": 28214,
"duration": 4428,
"times": {
"break": 0,
"driving": 3768,
"serving": 660,
"stopping": 0,
"waiting": 0,
"intraStop": 0
},
"costs": {
"fixed": 120,
"time": 221.4
},
"intraStopDistance": 0
},
"stops": [
{
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T08:00:00Z",
"start": "2024-06-24T08:00:00Z",
"end": "2024-06-24T09:54:19Z"
}
}
],
"load": [
11
],
"time": {
"arrival": "2024-06-24T08:00:00Z",
"departure": "2024-06-24T09:54:19Z"
},
"distance": 0,
"location": {
"lat": 52.531,
"lng": 13.38461
}
},
{
"activities": [
{
"jobId": "job_14",
"type": "delivery",
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
},
"time": {
"arrival": "2024-06-24T10:00:00Z",
"start": "2024-06-24T10:00:00Z",
"end": "2024-06-24T10:01:00Z"
}
}
],
"load": [
10
],
"time": {
"arrival": "2024-06-24T10:00:00Z",
"departure": "2024-06-24T10:01:00Z"
},
"distance": 2854,
"location": {
"lat": 52.5430392785687,
"lng": 13.365628486499192
}
},
{
"activities": [
{
"jobId": "job_15",
"type": "delivery",
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
},
"time": {
"arrival": "2024-06-24T10:02:25Z",
"start": "2024-06-24T10:02:25Z",
"end": "2024-06-24T10:03:25Z"
}
}
],
"load": [
9
],
"time": {
"arrival": "2024-06-24T10:02:25Z",
"departure": "2024-06-24T10:03:25Z"
},
"distance": 3579,
"location": {
"lat": 52.547332456685005,
"lng": 13.357647322118284
}
},
{
"activities": [
{
"jobId": "job_12",
"type": "delivery",
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
},
"time": {
"arrival": "2024-06-24T10:11:47Z",
"start": "2024-06-24T10:11:47Z",
"end": "2024-06-24T10:12:47Z"
}
}
],
"load": [
8
],
"time": {
"arrival": "2024-06-24T10:11:47Z",
"departure": "2024-06-24T10:12:47Z"
},
"distance": 7769,
"location": {
"lat": 52.527869590895264,
"lng": 13.32648797426373
}
},
{
"activities": [
{
"jobId": "job_6",
"type": "delivery",
"location": {
"lat": 52.52549759240047,
"lng": 13.3220280893147
},
"time": {
"arrival": "2024-06-24T10:14:40Z",
"start": "2024-06-24T10:14:40Z",
"end": "2024-06-24T10:15:40Z"
}
}
],
"load": [
7
],
"time": {
"arrival": "2024-06-24T10:14:40Z",
"departure": "2024-06-24T10:15:40Z"
},
"distance": 8332,
"location": {
"lat": 52.52549759240047,
"lng": 13.3220280893147
}
},
{
"activities": [
{
"jobId": "job_1",
"type": "delivery",
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
},
"time": {
"arrival": "2024-06-24T10:21:13Z",
"start": "2024-06-24T10:21:13Z",
"end": "2024-06-24T10:22:13Z"
}
}
],
"load": [
6
],
"time": {
"arrival": "2024-06-24T10:21:13Z",
"departure": "2024-06-24T10:22:13Z"
},
"distance": 10730,
"location": {
"lat": 52.51635175288175,
"lng": 13.343661020679573
}
},
{
"activities": [
{
"jobId": "job_2",
"type": "delivery",
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"time": {
"arrival": "2024-06-24T10:27:20Z",
"start": "2024-06-24T10:27:20Z",
"end": "2024-06-24T10:28:20Z"
}
}
],
"load": [
5
],
"time": {
"arrival": "2024-06-24T10:27:20Z",
"departure": "2024-06-24T10:28:20Z"
},
"distance": 13015,
"location": {
"lat": 52.5102,
"lng": 13.3444
}
},
{
"activities": [
{
"jobId": "job_8",
"type": "delivery",
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
},
"time": {
"arrival": "2024-06-24T10:33:50Z",
"start": "2024-06-24T10:33:50Z",
"end": "2024-06-24T10:34:50Z"
}
}
],
"load": [
4
],
"time": {
"arrival": "2024-06-24T10:33:50Z",
"departure": "2024-06-24T10:34:50Z"
},
"distance": 15281,
"location": {
"lat": 52.50074532954443,
"lng": 13.341249846853316
}
},
{
"activities": [
{
"jobId": "job_20",
"type": "delivery",
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685256
},
"time": {
"arrival": "2024-06-24T10:36:13Z",
"start": "2024-06-24T10:36:13Z",
"end": "2024-06-24T10:37:13Z"
}
}
],
"load": [
3
],
"time": {
"arrival": "2024-06-24T10:36:13Z",
"departure": "2024-06-24T10:37:13Z"
},
"distance": 15918,
"location": {
"lat": 52.50018729187247,
"lng": 13.333464504685256
}
},
{
"activities": [
{
"jobId": "job_13",
"type": "delivery",
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
},
"time": {
"arrival": "2024-06-24T10:41:51Z",
"start": "2024-06-24T10:41:51Z",
"end": "2024-06-24T10:42:51Z"
}
}
],
"load": [
2
],
"time": {
"arrival": "2024-06-24T10:41:51Z",
"departure": "2024-06-24T10:42:51Z"
},
"distance": 18316,
"location": {
"lat": 52.494845354927705,
"lng": 13.315199310891332
}
},
{
"activities": [
{
"jobId": "job_5",
"type": "delivery",
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
},
"time": {
"arrival": "2024-06-24T10:47:56Z",
"start": "2024-06-24T10:47:56Z",
"end": "2024-06-24T10:48:56Z"
}
}
],
"load": [
1
],
"time": {
"arrival": "2024-06-24T10:47:56Z",
"departure": "2024-06-24T10:48:56Z"
},
"distance": 19892,
"location": {
"lat": 52.48830675428145,
"lng": 13.321520648896696
}
},
{
"activities": [
{
"jobId": "job_19",
"type": "delivery",
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
},
"time": {
"arrival": "2024-06-24T10:51:34Z",
"start": "2024-06-24T10:51:34Z",
"end": "2024-06-24T10:52:34Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T10:51:34Z",
"departure": "2024-06-24T10:52:34Z"
},
"distance": 20355,
"location": {
"lat": 52.48513672552518,
"lng": 13.32379419822246
}
},
{
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"arrival": "2024-06-24T11:08:07Z",
"start": "2024-06-24T11:08:07Z",
"end": "2024-06-24T11:08:07Z"
}
}
],
"load": [
0
],
"time": {
"arrival": "2024-06-24T11:08:07Z",
"departure": "2024-06-24T11:08:07Z"
},
"distance": 28214,
"location": {
"lat": 52.531,
"lng": 13.38461
}
}
],
"typeId": "car_vehicle_1",
"vehicleId": "car_vehicle_1_2"
}
]
}Solution comparison
The following table compares the two scenarios:
| Metric | Without perWaitingTime | With perWaitingTime | Change |
|---|---|---|---|
| Optimization cost (as reported) | 648.7 | 659.8 | +11.1 (+1.7%) |
| Actual cost (accounting for waiting time at 0.08/sec) | 753.7 | 659.8 | -93.9 (-12.5%) |
| Vehicles used | 1 | 2 | +1 vehicle |
| Distance | 39,327 m | 52,011 m | +12,684 m (+32.2%) |
| Waiting time | 3,500 seconds (~58 min) | 0 seconds | -3,500 seconds (-100%) |
| Driving time | 5,814 seconds | 7,136 seconds | +1,322 seconds |
| Fixed costs | 120 | 240 | +120 |
Understanding the cost comparison
In the previous table, Optimization cost represents the cost value the algorithm uses during optimization. In the first scenario, all time (including waiting time) is charged at 0.05/second, resulting in a lower optimization cost (648.7) for the baseline scenario (without the perWaitingTime cost).
However, Actual cost is the true operational cost when accounting for the real business cost of waiting time at 0.08/second. The baseline scenario's actual cost is 753.7 (120 fixed + 353.7 driving/service + 280 waiting), significantly higher than the solution that includes the perWaitingTime cost feature (659.8).
This example demonstrates a key fleet optimization trade-off between using one vehicle with waiting time and deploying an additional vehicle to eliminate waiting.
Without perWaitingTime
The optimization algorithm treats all time equally at 0.05/second, so using one vehicle with 58 minutes of waiting appears cheaper in the optimization (648.7). However, if waiting time actually costs 0.08/second in the sample business scenario, the true operational cost is much higher (753.7).
With perWaitingTime
By explicitly modeling the higher cost of waiting (0.08/second), the algorithm recognizes that deploying a second vehicle to eliminate waiting time is more economical. Even though this increases fixed costs by 120 and total distance by 32%, the elimination of 280 in waiting costs results in actual savings of 93.9 (12.5%).
Next steps
- For more information about request structure and available cost options, see API Reference.
- For more information about optimizing routes for cost, see Optimize tours for cost.
- For more information about setting flexible delivery windows with penalties, see Set soft time windows.
- For more information about calculating additional costs beyond the base route costs, see Calculate excess costs per tour.
- For more information about configuring different cost structures for different vehicle types, see Optimize tours for diverse vehicle types.
Updated 5 days ago