Handling one shipment at a time. "Does not fit into any vehicle due to capacity"

I’m trying Graphhopper to handle take out deliveries.
Trips are coming in one by one. When a trip(shipment) is scheduled, the pickup and delivery time is locked. The vehicle may change.

Scenario:
I only have one vehicle, scheduled from 07:00 to 23:00.
Shipment 1: Pickup earliest 13:45 and delivery earliest 13:45.
This is easy. Graphhopper will assign shipment to the vehicle ending the pickup at 13:35 and ending the delivery at 13:56 cause of the distance.

Shipment 2: Pickup earliest 13:40 and delivery earliest 13:40.
I’m telling Graphhopper that Shipment 1 has earliest and latest pickup at 13:35 using time window.
Graphhopper is enforced to schedule Shipment 2 for pickup at 14:07 and delivery at 14:18, which is perfect. It takes 9 minutes to get from Shipment 1’s delivery to Shipment 2’s pickup. And 1 minute to get from Shipment 2’s pickup to Shipment 2’s delivery.

Now happens something I don’t understand.
Shipment 3: Pickup earliest 13:35 and delivery earliest 13:35.
Both Shipment 1 and 2 is locked by time windows.
I expect Graphhopper to move Shipment 3 until after 14:18, but instead I get this error.
“does not fit into any vehicle due to capacity” referring to Shipment 1.
job_id: b77ba41d-c67a-453f-a129-4cd61cab2db0

Complete request body:
{
“vehicles”: [
{
“vehicle_id”: “1”,
“start_address”: {
“location_id”: “1”,
“lon”: 10.4024,
“lat”: 55.4038
},
“type_id”: “car”,
“return_to_depot”: false,
“earliest_start”: 1564549200,
“latest_end”: 1564606800
}
],
“vehicle_types”: [
{
“type_id”: “car”,
“profile”: “car”,
“capacity”: [
1
],
“cost_per_meter”: 0,
“cost_per_second”: 0,
“cost_per_activation”: 0
},
{
“type_id”: “bike”,
“profile”: “bike”,
“capacity”: [
1
],
“cost_per_meter”: 0,
“cost_per_second”: 0,
“cost_per_activation”: 0
}
],
“shipments”: [
{
“id”: “1”,
“pickup”: {
“address”: {
“location_id”: “Company #1”,
“lon”: 10.40116839,
“lat”: 55.37052859,
“name”: “4 Spaces Barbecue”,
“street_hint”: “Lucernemarken 7”
},
“duration”: 0,
“preparation_time”: 60,
“time_windows”: [
{
“earliest”: 1564573500,
“latest”: 1564573560
}
]
},
“delivery”: {
“address”: {
“location_id”: “Orderer #1”,
“lon”: 10.42676805,
“lat”: 55.38860725,
“name”: “Bestiller 1”,
“street_hint”: “Johannes Larsens Vej 14”
},
“duration”: 0,
“preparation_time”: 210,
“time_windows”: [
{
“earliest”: 1564573500
}
]
},
“name”: “DeliverIt_5d416707f2e53”,
“size”: [
1
]
},
{
“id”: “6”,
“pickup”: {
“address”: {
“location_id”: “Company #1”,
“lon”: 10.40116839,
“lat”: 55.37052859,
“name”: “4 Spaces Barbecue”,
“street_hint”: “Lucernemarken 7”
},
“duration”: 0,
“preparation_time”: 60,
“time_windows”: [
{
“earliest”: 1564574827,
“latest”: 1564574887
}
]
},
“delivery”: {
“address”: {
“location_id”: “Orderer #6”,
“lon”: 10.42668639,
“lat”: 55.38828153,
“name”: “Martin Hansen”,
“street_hint”: “Johannes Larsens Vej 8”
},
“duration”: 0,
“preparation_time”: 210,
“time_windows”: [
{
“earliest”: 1564573200
}
]
},
“name”: “DeliverIt_5d41787aa8399”,
“size”: [
1
]
},
{
“id”: “7”,
“pickup”: {
“address”: {
“location_id”: “Company #1”,
“lon”: 10.40116839,
“lat”: 55.37052859,
“name”: “4 Spaces Barbecue”,
“street_hint”: “Lucernemarken 7”
},
“duration”: 0,
“preparation_time”: 60,
“time_windows”: [
{
“earliest”: 1564572900
}
]
},
“delivery”: {
“address”: {
“location_id”: “Orderer #7”,
“lon”: 10.42668639,
“lat”: 55.38828153,
“name”: “Martin Hansen”,
“street_hint”: “Johannes Larsens Vej 8”
},
“duration”: 0,
“preparation_time”: 210,
“time_windows”: [
{
“earliest”: 1564572900
}
]
},
“name”: “DeliverIt_5d417887769dc”,
“size”: [
1
]
}
],
“objectives”: [
{
“type”: “min-max”,
“value”: “completion_time”
},
{
“type”: “min-max”,
“value”: “activities”
}
],
“configuration”: {
“routing”: {
“consider_traffic”: true,
“network_data_provider”: “openstreetmap”
}
}
}

Would you mind to remove the cost_per parameters? They are zero which does not make much sense. Furthermore, it seems that setting them to zero yields unexpected results. For example, it seems that this results in a cost objective that favours assigning only 2 shipments.

Aha! Now Shipment 3 is scheduled. Perfect. Thank you :slight_smile:

1 Like