Vehicles dispatch
The vehicle dispatch feature is useful in the following cases:
- there is a fixed loading time at the beginning of the tour
- vehicles does not start at the depot
- a depot has certain capacity limitation on amount of vehicles loaded simultaneously
When the problem specifies more than one dispatch place, one of those is chosen as next from departure stop. Decision is made based on the following criteria:
- how close dispatch's location to vehicle's start location
- how much time vehicle has to wait till dispatch is open
- how long is dispatch's duration
Example
The problem definition has one dispatch place with three different time slots with maximum capacity of one vehicle. As result, three vehicles are dispatched at different times.
Problem
{
"plan": {
"jobs": [
{
"id": "job1",
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.52599,
"lng": 13.45413
},
"duration": 300.0
}
],
"demand": [
1
]
}
]
},
{
"id": "job2",
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5225,
"lng": 13.4095
},
"duration": 240.0
}
],
"demand": [
1
]
}
]
},
{
"id": "job3",
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5165,
"lng": 13.3808
},
"duration": 300.0
}
],
"demand": [
1
]
}
]
}
]
},
"fleet": {
"vehicles": [
{
"typeId": "vehicle",
"vehicleIds": [
"vehicle_1",
"vehicle_2",
"vehicle_3"
],
"profile": "normal_car",
"costs": {
"fixed": 22.0,
"distance": 0.0002,
"time": 0.004806
},
"shifts": [
{
"start": {
"earliest": "2019-07-04T09:00:00Z",
"location": {
"lat": 52.5352,
"lng": 13.3909
}
},
"dispatch": [
{
"location": {
"lat": 52.5316,
"lng": 13.3884
},
"limits": [
{
"max": 1,
"start": "2019-07-04T09:20:00Z",
"end": "2019-07-04T09:30:00Z"
},
{
"max": 1,
"start": "2019-07-04T09:30:00Z",
"end": "2019-07-04T09:40:00Z"
},
{
"max": 1,
"start": "2019-07-04T09:40:00Z",
"end": "2019-07-04T09:50:00Z"
}
]
}
]
}
],
"capacity": [
1
]
}
],
"profiles": [
{
"name": "normal_car",
"type": "car"
}
]
}
}
Solution
{
"statistic": {
"cost": 85.033838,
"distance": 9310,
"duration": 3573,
"times": {
"driving": 933,
"serving": 2640,
"waiting": 0,
"break": 0
}
},
"tours": [
{
"vehicleId": "vehicle_2",
"typeId": "vehicle",
"shiftIndex": 0,
"stops": [
{
"location": {
"lat": 52.5352,
"lng": 13.3909
},
"time": {
"arrival": "2019-07-04T09:00:00Z",
"departure": "2019-07-04T09:29:16Z"
},
"distance": 0,
"load": [
0
],
"activities": [
{
"jobId": "departure",
"type": "departure"
}
]
},
{
"location": {
"lat": 52.5316,
"lng": 13.3884
},
"time": {
"arrival": "2019-07-04T09:30:00Z",
"departure": "2019-07-04T09:40:00Z"
},
"distance": 435,
"load": [
1
],
"activities": [
{
"jobId": "dispatch",
"type": "dispatch"
}
]
},
{
"location": {
"lat": 52.5225,
"lng": 13.4095
},
"time": {
"arrival": "2019-07-04T09:42:55Z",
"departure": "2019-07-04T09:46:55Z"
},
"distance": 2187,
"load": [
0
],
"activities": [
{
"jobId": "job2",
"type": "delivery"
}
]
}
],
"statistic": {
"cost": 27.526954,
"distance": 2187,
"duration": 1059,
"times": {
"driving": 219,
"serving": 840,
"waiting": 0,
"break": 0
}
}
},
{
"vehicleId": "vehicle_1",
"typeId": "vehicle",
"shiftIndex": 0,
"stops": [
{
"location": {
"lat": 52.5352,
"lng": 13.3909
},
"time": {
"arrival": "2019-07-04T09:00:00Z",
"departure": "2019-07-04T09:19:16Z"
},
"distance": 0,
"load": [
0
],
"activities": [
{
"jobId": "departure",
"type": "departure"
}
]
},
{
"location": {
"lat": 52.5316,
"lng": 13.3884
},
"time": {
"arrival": "2019-07-04T09:20:00Z",
"departure": "2019-07-04T09:30:00Z"
},
"distance": 435,
"load": [
1
],
"activities": [
{
"jobId": "dispatch",
"type": "dispatch"
}
]
},
{
"location": {
"lat": 52.5165,
"lng": 13.3808
},
"time": {
"arrival": "2019-07-04T09:32:56Z",
"departure": "2019-07-04T09:37:56Z"
},
"distance": 2193,
"load": [
0
],
"activities": [
{
"jobId": "job3",
"type": "delivery"
}
]
}
],
"statistic": {
"cost": 27.82132,
"distance": 2193,
"duration": 1120,
"times": {
"driving": 220,
"serving": 900,
"waiting": 0,
"break": 0
}
}
},
{
"vehicleId": "vehicle_3",
"typeId": "vehicle",
"shiftIndex": 0,
"stops": [
{
"location": {
"lat": 52.5352,
"lng": 13.3909
},
"time": {
"arrival": "2019-07-04T09:00:00Z",
"departure": "2019-07-04T09:39:16Z"
},
"distance": 0,
"load": [
0
],
"activities": [
{
"jobId": "departure",
"type": "departure"
}
]
},
{
"location": {
"lat": 52.5316,
"lng": 13.3884
},
"time": {
"arrival": "2019-07-04T09:40:00Z",
"departure": "2019-07-04T09:50:00Z"
},
"distance": 435,
"load": [
1
],
"activities": [
{
"jobId": "dispatch",
"type": "dispatch"
}
]
},
{
"location": {
"lat": 52.52599,
"lng": 13.45413
},
"time": {
"arrival": "2019-07-04T09:57:30Z",
"departure": "2019-07-04T10:02:30Z"
},
"distance": 4930,
"load": [
0
],
"activities": [
{
"jobId": "job1",
"type": "delivery"
}
]
}
],
"statistic": {
"cost": 29.685564,
"distance": 4930,
"duration": 1394,
"times": {
"driving": 494,
"serving": 900,
"waiting": 0,
"break": 0
}
}
}
]
}
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"arrival": "2019-07-04T09:00:00Z",
"marker-size": "medium",
"stop_idx": "0",
"departure": "2019-07-04T09:29:16Z",
"jobs_ids": "departure",
"tour_idx": "0",
"marker-color": "#e6194b",
"marker-symbol": "warehouse"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3909,
52.5352
]
}
},
{
"type": "Feature",
"properties": {
"tour_idx": "0",
"stop_idx": "1",
"marker-symbol": "warehouse",
"arrival": "2019-07-04T09:30:00Z",
"marker-color": "#e6194b",
"departure": "2019-07-04T09:40:00Z",
"marker-size": "medium",
"jobs_ids": "dispatch"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3884,
52.5316
]
}
},
{
"type": "Feature",
"properties": {
"marker-color": "#e6194b",
"marker-symbol": "marker",
"marker-size": "medium",
"tour_idx": "0",
"stop_idx": "2",
"jobs_ids": "job2",
"departure": "2019-07-04T09:46:55Z",
"arrival": "2019-07-04T09:42:55Z"
},
"geometry": {
"type": "Point",
"coordinates": [
13.4095,
52.5225
]
}
},
{
"type": "Feature",
"properties": {
"marker-color": "#808080",
"stop_idx": "0",
"marker-size": "medium",
"marker-symbol": "warehouse",
"jobs_ids": "departure",
"arrival": "2019-07-04T09:00:00Z",
"departure": "2019-07-04T09:19:16Z",
"tour_idx": "1"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3909,
52.5352
]
}
},
{
"type": "Feature",
"properties": {
"tour_idx": "1",
"marker-size": "medium",
"stop_idx": "1",
"departure": "2019-07-04T09:30:00Z",
"marker-color": "#808080",
"arrival": "2019-07-04T09:20:00Z",
"marker-symbol": "warehouse",
"jobs_ids": "dispatch"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3884,
52.5316
]
}
},
{
"type": "Feature",
"properties": {
"jobs_ids": "job3",
"tour_idx": "1",
"departure": "2019-07-04T09:37:56Z",
"marker-symbol": "marker",
"marker-color": "#808080",
"stop_idx": "2",
"marker-size": "medium",
"arrival": "2019-07-04T09:32:56Z"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3808,
52.5165
]
}
},
{
"type": "Feature",
"properties": {
"jobs_ids": "departure",
"arrival": "2019-07-04T09:00:00Z",
"marker-size": "medium",
"marker-symbol": "warehouse",
"stop_idx": "0",
"tour_idx": "2",
"marker-color": "#000075",
"departure": "2019-07-04T09:39:16Z"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3909,
52.5352
]
}
},
{
"type": "Feature",
"properties": {
"marker-size": "medium",
"stop_idx": "1",
"marker-symbol": "warehouse",
"departure": "2019-07-04T09:50:00Z",
"jobs_ids": "dispatch",
"tour_idx": "2",
"arrival": "2019-07-04T09:40:00Z",
"marker-color": "#000075"
},
"geometry": {
"type": "Point",
"coordinates": [
13.3884,
52.5316
]
}
},
{
"type": "Feature",
"properties": {
"arrival": "2019-07-04T09:57:30Z",
"departure": "2019-07-04T10:02:30Z",
"jobs_ids": "job1",
"tour_idx": "2",
"marker-color": "#000075",
"stop_idx": "2",
"marker-size": "medium",
"marker-symbol": "marker"
},
"geometry": {
"type": "Point",
"coordinates": [
13.45413,
52.52599
]
}
},
{
"type": "Feature",
"properties": {
"shift_idx": "0",
"stroke-width": "4",
"tour_idx": "0",
"vehicle_id": "vehicle_2",
"activities": "3",
"departure": "2019-07-04T09:29:16Z",
"arrival": "2019-07-04T09:42:55Z",
"distance": "2187",
"stroke": "#e6194b"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
13.3909,
52.5352
],
[
13.3884,
52.5316
],
[
13.4095,
52.5225
]
]
}
},
{
"type": "Feature",
"properties": {
"stroke": "#3cb44b",
"departure": "2019-07-04T09:19:16Z",
"tour_idx": "1",
"shift_idx": "0",
"activities": "3",
"vehicle_id": "vehicle_1",
"distance": "2193",
"arrival": "2019-07-04T09:32:56Z",
"stroke-width": "4"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
13.3909,
52.5352
],
[
13.3884,
52.5316
],
[
13.3808,
52.5165
]
]
}
},
{
"type": "Feature",
"properties": {
"distance": "4930",
"activities": "3",
"arrival": "2019-07-04T09:57:30Z",
"tour_idx": "2",
"shift_idx": "0",
"departure": "2019-07-04T09:39:16Z",
"stroke-width": "4",
"stroke": "#4363d8",
"vehicle_id": "vehicle_3"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
13.3909,
52.5352
],
[
13.3884,
52.5316
],
[
13.45413,
52.52599
]
]
}
}
]
}