I was comparing the optimized paths, and I realised that the POST route optimization problem is not showing the shortest stops first. For example:
{
"relations": [
{
"type": "in_sequence",
"groups": ["order_1", "order_2"],
"vehicle_id": "v1"
},
{
"type": "in_same_route",
"ids": ["s1", "s2", "s3", "s4"]
}
],
"configuration": {
"routing": {
"calc_points": true,
"return_snapped_waypoints": true
}
},
"objectives": [
{
"type": "min",
"value": "completion_time"
}
],
"vehicles": [
{
"vehicle_id": "v1",
"type_id": "custom_vehicle_type",
"start_address": {
"location_id": "v1",
"lat": 10.06645,
"lon": -69.30911
},
"earliest_start": 1508839200,
"return_to_depot": false
}
],
"vehicle_types": [
{
"type_id": "custom_vehicle_type",
"profile": "car"
}
],
"services": [
{
"id": "s1",
"type": "pickup",
"address": {
"location_id": "s1",
"lat": 10.06659,
"lon": -69.31078
},
"group": "order_1"
},
{
"id": "s2",
"type": "delivery",
"address": {
"location_id": "s2",
"lat": 10.06682,
"lon": -69.30875
},
"group": "order_1"
},
{
"id": "s3",
"type": "pickup",
"address": {
"location_id": "s4",
"lat": 10.06872,
"lon": -69.30731
},
"group": "order_2"
},
{
"id": "s4",
"type": "delivery",
"address": {
"location_id": "s3",
"lat": 10.06771,
"lon": -69.30763
},
"group": "order_2"
}
]
}
It has chosen a stop with 0.71 km of distance, that belongs to the group order_1.
Now when I try the second group order_2 isolated, it shows a shortest distance.
{
"relations": [
{
"type": "in_sequence",
"groups": ["order_2"],
"vehicle_id": "v1"
},
{
"type": "in_same_route",
"ids": ["s3", "s4"]
}
],
"configuration": {
"routing": {
"calc_points": true,
"return_snapped_waypoints": true
}
},
"objectives": [
{
"type": "min",
"value": "completion_time"
}
],
"vehicles": [
{
"vehicle_id": "v1",
"type_id": "custom_vehicle_type",
"start_address": {
"location_id": "v1",
"lat": 10.06645,
"lon": -69.30911
},
"earliest_start": 1508839200,
"return_to_depot": false
}
],
"vehicle_types": [
{
"type_id": "custom_vehicle_type",
"profile": "car"
}
],
"services": [
{
"id": "s3",
"type": "pickup",
"address": {
"location_id": "s1",
"lat": 10.06872,
"lon": -69.30731
},
"group": "order_2"
},
{
"id": "s4",
"type": "delivery",
"address": {
"location_id": "s2",
"lat": 10.06771,
"lon": -69.30763
},
"group": "order_2"
}
]
}
It shows in the first stop a 0.57 km of distance which is shorter than the order_1.
In other words, combining these two orders it should start by the shortest distance which is order_2 and then order_1. That’s how I see the “Optimization Route”, let me know if I am missing something.
Thanks.