GuidesAPI Reference
Guides

Plan efficient routes for waste management fleets

Efficient tour planning can provide significant benefits to multiple types of industries, including the waste management industry. Optimizing routes for waste collection vehicles minimizes fuel consumption, reduces travel time, and lowers vehicle wear and tear.

The following sections address problems and provide corresponding solutions tailored to tour planning use cases related to managing waste management fleets.

In general, all presented problems follow these objectives:

  • Trucks must collect all bins along their route. When a truck becomes full, it must travel to a designated dumping site to unload.
  • Dumping sites are added as reload locations. The dumping process has a fixed duration. When a truck is full, it goes to the reload location to empty its load, then resume bin pickups.
  • At the end of their routes, trucks must finish their shift at a dumping site to offload any remaining rubbish. In summary, trucks leave the depot empty and must return empty after completing the assigned tasks.

The following figure provides a visual overview of these objectives:

Typical waste management use case

Option #1: Define the dumping site as the shift end location

In the following problem, the reload location coordinates match the coordinates for the shift end. This ensures that waste collection trucks dump any remaining trash at the end of the tour, before proceeding to the depot empty, as required.

Marking the dumping site as the location for the shift end means that the final part of the tour (from the dumping site to the depot) is not optimized. To account for the travel between the dumping site and the depot after the tour has been completed, the vehicle shift time is reduced from 8 hours to 7 hours and 30 minutes. The final trip from the dumping site to the depot is a static segment and is not included in the optimization.

In addition, the sample problem also includes the following specifications:

  • The fleet consists of a single vehicle type for which 3 vehicles are available
  • Each vehicle has the capacity value of 30
  • The tour plan includes 15 pickup jobs, each with the demand set to 10
  • The problem includes an advanced objective to minimize tour overlap in case multiple vehicles are involved.
  • The vehicle routing profile includes a constraint to avoid u-turns to account for the larger turning radius of trucks, as compared to cars, as well as a speed cap of 20 km/h.

The following section contains the full problem JSON:

Click to expand/collapse the sample JSON
{
    "configuration": {
        "experimentalFeatures": ["advancedObjectives"]
    },
    "fleet": {
        "types": [
            {
                "id": "garbage_truck",
                "profile": "truck",
                "costs": {
                    "fixed": 5,
                    "distance": 0,
                    "time": 0.005
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2023-05-28T08:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "end": {
                            "time": "2023-05-28T15:30:00Z",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            }
                        },
                        "reloads": [
                            {
                                "location": {
                                    "lat": 52.488148,
                                    "lng": 13.369797
                                },
                                "duration": 600
                            }
                        ]
                    }
                ],
                "capacity": [30],
                "amount": 3
            }
        ],
        "profiles": [
            {
                "name": "truck",
                "type": "truck",
                "avoid": {
                    "features": ["uTurns"]
                },
                "options": {
                    "speedCap": 20
                }
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "Job_1",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.56182,
                                        "lng": 13.497167
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_2",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.534553,
                                        "lng": 13.519429
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_3",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.482275,
                                        "lng": 13.502456
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_4",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.473537,
                                        "lng": 13.505414
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_5",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.463341,
                                        "lng": 13.49061
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_6",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.434003,
                                        "lng": 13.466142
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_7",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447476,
                                        "lng": 13.433062
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_8",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458414,
                                        "lng": 13.392079
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_9",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.446407,
                                        "lng": 13.36047
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_10",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.440807,
                                        "lng": 13.351399
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_11",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.462867,
                                        "lng": 13.342188
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_12",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458232,
                                        "lng": 13.338698
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_13",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.457629,
                                        "lng": 13.323742
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_14",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.552057,
                                        "lng": 13.349613
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_15",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447377,
                                        "lng": 13.363822
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            }
        ]
    },
    "advancedObjectives": [
        [
            {
                "type": "minimizeUnassigned"
            }
        ],
        [
            {
                "type": "minimizeCost"
            }
        ],
        [
            {
                "type": "minimizeTourOverlap"
            }
        ]
    ]
}

Solution

The following section provides the full solution of the previous problem:

Click to expand/collapse the sample JSON
{
    "statistic": {
        "cost": 131.365,
        "distance": 115071,
        "duration": 23273,
        "times": {
            "driving": 13073,
            "serving": 10200,
            "waiting": 0,
            "stopping": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "garbage_truck_1",
            "typeId": "garbage_truck",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:15:48Z",
                        "departure": "2023-05-28T08:25:48Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_3",
                            "type": "pickup",
                            "location": {
                                "lat": 52.482275,
                                "lng": 13.502456
                            },
                            "time": {
                                "start": "2023-05-28T08:15:48Z",
                                "end": "2023-05-28T08:25:48Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.482275,
                        "lng": 13.502456
                    },
                    "distance": 8425
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:27:48Z",
                        "departure": "2023-05-28T08:37:48Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_4",
                            "type": "pickup",
                            "location": {
                                "lat": 52.473537,
                                "lng": 13.505414
                            },
                            "time": {
                                "start": "2023-05-28T08:27:48Z",
                                "end": "2023-05-28T08:37:48Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.473537,
                        "lng": 13.505414
                    },
                    "distance": 9711
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:44:40Z",
                        "departure": "2023-05-28T08:54:40Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_5",
                            "type": "pickup",
                            "location": {
                                "lat": 52.463341,
                                "lng": 13.49061
                            },
                            "time": {
                                "start": "2023-05-28T08:44:40Z",
                                "end": "2023-05-28T08:54:40Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.463341,
                        "lng": 13.49061
                    },
                    "distance": 12652
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:12:49Z",
                        "departure": "2023-05-28T09:22:49Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T09:12:49Z",
                                "end": "2023-05-28T09:22:49Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 24881
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:33:03Z",
                        "departure": "2023-05-28T09:43:03Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_11",
                            "type": "pickup",
                            "location": {
                                "lat": 52.462867,
                                "lng": 13.342188
                            },
                            "time": {
                                "start": "2023-05-28T09:33:03Z",
                                "end": "2023-05-28T09:43:03Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.462867,
                        "lng": 13.342188
                    },
                    "distance": 30463
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:46:08Z",
                        "departure": "2023-05-28T09:56:08Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_12",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458232,
                                "lng": 13.338698
                            },
                            "time": {
                                "start": "2023-05-28T09:46:08Z",
                                "end": "2023-05-28T09:56:08Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458232,
                        "lng": 13.338698
                    },
                    "distance": 31674
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:00:35Z",
                        "departure": "2023-05-28T10:10:35Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_13",
                            "type": "pickup",
                            "location": {
                                "lat": 52.457629,
                                "lng": 13.323742
                            },
                            "time": {
                                "start": "2023-05-28T10:00:35Z",
                                "end": "2023-05-28T10:10:35Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.457629,
                        "lng": 13.323742
                    },
                    "distance": 33821
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:23:15Z",
                        "departure": "2023-05-28T10:23:15Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T10:23:15Z",
                                "end": "2023-05-28T10:23:15Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 40870
                }
            ],
            "statistic": {
                "cost": 47.975,
                "distance": 40870,
                "duration": 8595,
                "times": {
                    "driving": 4395,
                    "serving": 4200,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "garbage_truck_2",
            "typeId": "garbage_truck",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:23:27Z",
                        "departure": "2023-05-28T08:33:27Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_6",
                            "type": "pickup",
                            "location": {
                                "lat": 52.434003,
                                "lng": 13.466142
                            },
                            "time": {
                                "start": "2023-05-28T08:23:27Z",
                                "end": "2023-05-28T08:33:27Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.434003,
                        "lng": 13.466142
                    },
                    "distance": 12952
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:39:51Z",
                        "departure": "2023-05-28T08:49:51Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_7",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447476,
                                "lng": 13.433062
                            },
                            "time": {
                                "start": "2023-05-28T08:39:51Z",
                                "end": "2023-05-28T08:49:51Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447476,
                        "lng": 13.433062
                    },
                    "distance": 16481
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:57:03Z",
                        "departure": "2023-05-28T09:07:03Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_8",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458414,
                                "lng": 13.392079
                            },
                            "time": {
                                "start": "2023-05-28T08:57:03Z",
                                "end": "2023-05-28T09:07:03Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458414,
                        "lng": 13.392079
                    },
                    "distance": 20505
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:18:07Z",
                        "departure": "2023-05-28T09:28:07Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T09:18:07Z",
                                "end": "2023-05-28T09:28:07Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 25910
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:40:27Z",
                        "departure": "2023-05-28T09:50:27Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_10",
                            "type": "pickup",
                            "location": {
                                "lat": 52.440807,
                                "lng": 13.351399
                            },
                            "time": {
                                "start": "2023-05-28T09:40:27Z",
                                "end": "2023-05-28T09:50:27Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.440807,
                        "lng": 13.351399
                    },
                    "distance": 32474
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:53:00Z",
                        "departure": "2023-05-28T10:03:00Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_9",
                            "type": "pickup",
                            "location": {
                                "lat": 52.446407,
                                "lng": 13.36047
                            },
                            "time": {
                                "start": "2023-05-28T09:53:00Z",
                                "end": "2023-05-28T10:03:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.446407,
                        "lng": 13.36047
                    },
                    "distance": 33568
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:05:57Z",
                        "departure": "2023-05-28T10:15:57Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_15",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447377,
                                "lng": 13.363822
                            },
                            "time": {
                                "start": "2023-05-28T10:05:57Z",
                                "end": "2023-05-28T10:15:57Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447377,
                        "lng": 13.363822
                    },
                    "distance": 34587
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:26:54Z",
                        "departure": "2023-05-28T10:26:54Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T10:26:54Z",
                                "end": "2023-05-28T10:26:54Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 40083
                }
            ],
            "statistic": {
                "cost": 49.07,
                "distance": 40083,
                "duration": 8814,
                "times": {
                    "driving": 4614,
                    "serving": 4200,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "garbage_truck_3",
            "typeId": "garbage_truck",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:15:10Z",
                        "departure": "2023-05-28T08:25:10Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_2",
                            "type": "pickup",
                            "location": {
                                "lat": 52.534553,
                                "lng": 13.519429
                            },
                            "time": {
                                "start": "2023-05-28T08:15:10Z",
                                "end": "2023-05-28T08:25:10Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.534553,
                        "lng": 13.519429
                    },
                    "distance": 8613
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:37:10Z",
                        "departure": "2023-05-28T08:47:10Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_1",
                            "type": "pickup",
                            "location": {
                                "lat": 52.56182,
                                "lng": 13.497167
                            },
                            "time": {
                                "start": "2023-05-28T08:37:10Z",
                                "end": "2023-05-28T08:47:10Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.56182,
                        "lng": 13.497167
                    },
                    "distance": 13256
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:09:10Z",
                        "departure": "2023-05-28T09:19:10Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_14",
                            "type": "pickup",
                            "location": {
                                "lat": 52.552057,
                                "lng": 13.349613
                            },
                            "time": {
                                "start": "2023-05-28T09:09:10Z",
                                "end": "2023-05-28T09:19:10Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.552057,
                        "lng": 13.349613
                    },
                    "distance": 25022
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:37:44Z",
                        "departure": "2023-05-28T09:37:44Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T09:37:44Z",
                                "end": "2023-05-28T09:37:44Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 34118
                }
            ],
            "statistic": {
                "cost": 34.32,
                "distance": 34118,
                "duration": 5864,
                "times": {
                    "driving": 4064,
                    "serving": 1800,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ]
}

As the solution demonstrates, the optimization completed all assigned jobs, distributing them among three vehicles (garbage_truck_1, garbage_truck_2, garbage_truck_3). The following figure provides a visual breakdown of the tour:

A tour with a single dumping site as the reload and end-of-tour location

In this tour, both garbage_truck_1 (marked in green) and garbage_truck_2 (marked in blue) completed 7 tasks. These tasks included one reload at the dumping site. After collecting trash following the reload, both trucks returned to the dumping site to unload and complete the tour.

Option #2: Designate multiple dumping sites for reloads

The HERE Tour Planing API enables you to define up to 5 reload locations within a shift. Allowing multiple potential dumping sites for the reload activity enables trucks to spend more time collecting waste.

Trucks can travel to the nearest dumping site, reducing travel time compared to returning to a single, potentially distant location. This approach also helps prevent bottlenecks and overloading at any one site.

The following problem contains four reload locations, one of which is also designated as the one at which the shift ends. As was the case with the previous option, the final trip from the dumping site to the depot is a static segment and is not included in the optimization.

Click to expand/collapse the sample JSON
{
    "configuration": {
        "experimentalFeatures": ["advancedObjectives"]
    },
    "fleet": {
        "types": [
            {
                "id": "garbage_truck",
                "profile": "truck",
                "costs": {
                    "fixed": 5,
                    "distance": 0,
                    "time": 0.005
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2023-05-28T08:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "end": {
                            "time": "2023-05-28T15:30:00Z",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            }
                        },
                        "reloads": [
                            {
                                "location": {
                                    "lat": 52.559049,
                                    "lng": 13.533147
                                },
                                "duration": 600
                            },
                            {
                                "location": {
                                    "lat": 52.488148,
                                    "lng": 13.369797
                                },
                                "duration": 600
                            },
                            {
                                "location": {
                                    "lat": 52.453058,
                                    "lng": 13.429382
                                },
                                "duration": 600
                            },
                            {
                                "location": {
                                    "lat": 52.528158,
                                    "lng": 13.313056
                                },
                                "duration": 600
                            }
                        ]
                    }
                ],
                "capacity": [30],
                "amount": 3
            }
        ],
        "profiles": [
            {
                "name": "truck",
                "type": "truck",
                "avoid": {
                    "features": ["uTurns"]
                },
                "options": {
                    "speedCap": 20
                }
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "Job_1",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.56182,
                                        "lng": 13.497167
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_2",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.534553,
                                        "lng": 13.519429
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_3",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.482275,
                                        "lng": 13.502456
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_4",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.473537,
                                        "lng": 13.505414
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_5",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.463341,
                                        "lng": 13.49061
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_6",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.434003,
                                        "lng": 13.466142
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_7",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447476,
                                        "lng": 13.433062
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_8",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458414,
                                        "lng": 13.392079
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_9",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.446407,
                                        "lng": 13.36047
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_10",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.440807,
                                        "lng": 13.351399
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_11",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.462867,
                                        "lng": 13.342188
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_12",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458232,
                                        "lng": 13.338698
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_13",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.457629,
                                        "lng": 13.323742
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_14",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.552057,
                                        "lng": 13.349613
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_15",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447377,
                                        "lng": 13.363822
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            }
        ]
    },
    "advancedObjectives": [
        [
            {
                "type": "minimizeUnassigned"
            }
        ],
        [
            {
                "type": "minimizeCost"
            }
        ],
        [
            {
                "type": "minimizeTourOverlap"
            }
        ]
    ]
}

Solution

The following section provides the full solution of the previous problem:

Click to expand/collapse the sample JSON
{
    "statistic": {
        "cost": 120.435,
        "distance": 108253,
        "duration": 23087,
        "times": {
            "driving": 11687,
            "serving": 11400,
            "waiting": 0,
            "stopping": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "garbage_truck_3",
            "typeId": "garbage_truck",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:20:00Z",
                        "departure": "2023-05-28T08:30:00Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_11",
                            "type": "pickup",
                            "location": {
                                "lat": 52.462867,
                                "lng": 13.342188
                            },
                            "time": {
                                "start": "2023-05-28T08:20:00Z",
                                "end": "2023-05-28T08:30:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.462867,
                        "lng": 13.342188
                    },
                    "distance": 10938
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:33:05Z",
                        "departure": "2023-05-28T08:43:05Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_12",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458232,
                                "lng": 13.338698
                            },
                            "time": {
                                "start": "2023-05-28T08:33:05Z",
                                "end": "2023-05-28T08:43:05Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458232,
                        "lng": 13.338698
                    },
                    "distance": 12149
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:47:32Z",
                        "departure": "2023-05-28T08:57:32Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_13",
                            "type": "pickup",
                            "location": {
                                "lat": 52.457629,
                                "lng": 13.323742
                            },
                            "time": {
                                "start": "2023-05-28T08:47:32Z",
                                "end": "2023-05-28T08:57:32Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.457629,
                        "lng": 13.323742
                    },
                    "distance": 14296
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:16:28Z",
                        "departure": "2023-05-28T09:26:28Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.528158,
                                "lng": 13.313056
                            },
                            "time": {
                                "start": "2023-05-28T09:16:28Z",
                                "end": "2023-05-28T09:26:28Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.528158,
                        "lng": 13.313056
                    },
                    "distance": 30908
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:35:09Z",
                        "departure": "2023-05-28T09:45:09Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_14",
                            "type": "pickup",
                            "location": {
                                "lat": 52.552057,
                                "lng": 13.349613
                            },
                            "time": {
                                "start": "2023-05-28T09:35:09Z",
                                "end": "2023-05-28T09:45:09Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.552057,
                        "lng": 13.349613
                    },
                    "distance": 35313
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:10:51Z",
                        "departure": "2023-05-28T10:20:51Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_1",
                            "type": "pickup",
                            "location": {
                                "lat": 52.56182,
                                "lng": 13.497167
                            },
                            "time": {
                                "start": "2023-05-28T10:10:51Z",
                                "end": "2023-05-28T10:20:51Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.56182,
                        "lng": 13.497167
                    },
                    "distance": 46860
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:28:10Z",
                        "departure": "2023-05-28T10:38:10Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_2",
                            "type": "pickup",
                            "location": {
                                "lat": 52.534553,
                                "lng": 13.519429
                            },
                            "time": {
                                "start": "2023-05-28T10:28:10Z",
                                "end": "2023-05-28T10:38:10Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.534553,
                        "lng": 13.519429
                    },
                    "distance": 50609
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:45:14Z",
                        "departure": "2023-05-28T10:55:14Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T10:45:14Z",
                                "end": "2023-05-28T10:55:14Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 54905
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:15:13Z",
                        "departure": "2023-05-28T11:25:13Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_3",
                            "type": "pickup",
                            "location": {
                                "lat": 52.482275,
                                "lng": 13.502456
                            },
                            "time": {
                                "start": "2023-05-28T11:15:13Z",
                                "end": "2023-05-28T11:25:13Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.482275,
                        "lng": 13.502456
                    },
                    "distance": 67409
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:27:13Z",
                        "departure": "2023-05-28T11:37:13Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_4",
                            "type": "pickup",
                            "location": {
                                "lat": 52.473537,
                                "lng": 13.505414
                            },
                            "time": {
                                "start": "2023-05-28T11:27:13Z",
                                "end": "2023-05-28T11:37:13Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.473537,
                        "lng": 13.505414
                    },
                    "distance": 68695
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:44:05Z",
                        "departure": "2023-05-28T11:54:05Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_5",
                            "type": "pickup",
                            "location": {
                                "lat": 52.463341,
                                "lng": 13.49061
                            },
                            "time": {
                                "start": "2023-05-28T11:44:05Z",
                                "end": "2023-05-28T11:54:05Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.463341,
                        "lng": 13.49061
                    },
                    "distance": 71636
                },
                {
                    "time": {
                        "arrival": "2023-05-28T12:03:34Z",
                        "departure": "2023-05-28T12:13:34Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.453058,
                                "lng": 13.429382
                            },
                            "time": {
                                "start": "2023-05-28T12:03:34Z",
                                "end": "2023-05-28T12:13:34Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.453058,
                        "lng": 13.429382
                    },
                    "distance": 76873
                },
                {
                    "time": {
                        "arrival": "2023-05-28T12:21:20Z",
                        "departure": "2023-05-28T12:31:20Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_6",
                            "type": "pickup",
                            "location": {
                                "lat": 52.434003,
                                "lng": 13.466142
                            },
                            "time": {
                                "start": "2023-05-28T12:21:20Z",
                                "end": "2023-05-28T12:31:20Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.434003,
                        "lng": 13.466142
                    },
                    "distance": 81122
                },
                {
                    "time": {
                        "arrival": "2023-05-28T12:37:44Z",
                        "departure": "2023-05-28T12:47:44Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_7",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447476,
                                "lng": 13.433062
                            },
                            "time": {
                                "start": "2023-05-28T12:37:44Z",
                                "end": "2023-05-28T12:47:44Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447476,
                        "lng": 13.433062
                    },
                    "distance": 84651
                },
                {
                    "time": {
                        "arrival": "2023-05-28T12:54:56Z",
                        "departure": "2023-05-28T13:04:56Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_8",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458414,
                                "lng": 13.392079
                            },
                            "time": {
                                "start": "2023-05-28T12:54:56Z",
                                "end": "2023-05-28T13:04:56Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458414,
                        "lng": 13.392079
                    },
                    "distance": 88675
                },
                {
                    "time": {
                        "arrival": "2023-05-28T13:16:00Z",
                        "departure": "2023-05-28T13:26:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T13:16:00Z",
                                "end": "2023-05-28T13:26:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 94080
                },
                {
                    "time": {
                        "arrival": "2023-05-28T13:38:20Z",
                        "departure": "2023-05-28T13:48:20Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_10",
                            "type": "pickup",
                            "location": {
                                "lat": 52.440807,
                                "lng": 13.351399
                            },
                            "time": {
                                "start": "2023-05-28T13:38:20Z",
                                "end": "2023-05-28T13:48:20Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.440807,
                        "lng": 13.351399
                    },
                    "distance": 100644
                },
                {
                    "time": {
                        "arrival": "2023-05-28T13:50:53Z",
                        "departure": "2023-05-28T14:00:53Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_9",
                            "type": "pickup",
                            "location": {
                                "lat": 52.446407,
                                "lng": 13.36047
                            },
                            "time": {
                                "start": "2023-05-28T13:50:53Z",
                                "end": "2023-05-28T14:00:53Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.446407,
                        "lng": 13.36047
                    },
                    "distance": 101738
                },
                {
                    "time": {
                        "arrival": "2023-05-28T14:03:50Z",
                        "departure": "2023-05-28T14:13:50Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_15",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447377,
                                "lng": 13.363822
                            },
                            "time": {
                                "start": "2023-05-28T14:03:50Z",
                                "end": "2023-05-28T14:13:50Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447377,
                        "lng": 13.363822
                    },
                    "distance": 102757
                },
                {
                    "time": {
                        "arrival": "2023-05-28T14:24:47Z",
                        "departure": "2023-05-28T14:24:47Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.488148,
                                "lng": 13.369797
                            },
                            "time": {
                                "start": "2023-05-28T14:24:47Z",
                                "end": "2023-05-28T14:24:47Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.488148,
                        "lng": 13.369797
                    },
                    "distance": 108253
                }
            ],
            "statistic": {
                "cost": 120.435,
                "distance": 108253,
                "duration": 23087,
                "times": {
                    "driving": 11687,
                    "serving": 11400,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ]
}

In this case, the optimization algorithm designated a single vehicle to serve all the jobs, including four reloads, as the most efficient way of completing the tour. The following figure provides a visual tour breakdown:

A tour with multiple dumping sites as reload locations

The vehicle assigned by the optimization algorithm completes the tour by picking up waste until it reaches its maximum capacity. The vehicle unloads at the nearest dumping site, using all available sites along the way. This reduces the time spent driving to and from dumping sites, making the tour more efficient.

Option #3: Combine the position and skills features to designate the dumping site

Another method to achieve the use case objectives involves using the position and skills features. First, assign a skills value to each vehicle type in your fleet. Then, create a delivery job for each vehicle type that matches its skills value. To ensure this job is always the last one in the tour (so the load is emptied before returning to the depot), set the job's position to last.

📘

Note

When using this method, the route from the final dumping site to the depot, when the vehicle is empty, is included in the solution.

In this problem, each vehicle type (skills "1", "2", and "3") is assigned a job representing the final visit to the dumping site before returning to the depot. These jobs share the same location, with the position parameter set to last. The reloads location matches the location of the dumping site to enable multiple visits to unload trash, if needed.

The following section contains the full problem JSON:

Click to expand/collapse the sample JSON
{
    "fleet": {
        "types": [
            {
                "id": "garbage_truck_1",
                "profile": "truck",
                "costs": {
                    "fixed": 5,
                    "distance": 0,
                    "time": 0.005
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2023-05-28T08:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "end": {
                            "time": "2023-05-28T16:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "reloads": [
                            {
                                "location": {
                                    "lat": 52.559049,
                                    "lng": 13.533147
                                },
                                "duration": 600
                            }
                        ]
                    }
                ],
                "capacity": [30],
                "skills": ["1"],
                "amount": 1
            },
            {
                "id": "garbage_truck_2",
                "profile": "truck",
                "costs": {
                    "fixed": 5,
                    "distance": 0,
                    "time": 0.005
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2023-05-28T08:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "end": {
                            "time": "2023-05-28T15:30:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "reloads": [
                            {
                                "location": {
                                    "lat": 52.559049,
                                    "lng": 13.533147
                                },
                                "duration": 600
                            }
                        ]
                    }
                ],
                "capacity": [30],
                "skills": ["2"],
                "amount": 1
            },
            {
                "id": "garbage_truck_3",
                "profile": "truck",
                "costs": {
                    "fixed": 5,
                    "distance": 0,
                    "time": 0.005
                },
                "shifts": [
                    {
                        "start": {
                            "time": "2023-05-28T08:00:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "end": {
                            "time": "2023-05-28T15:30:00Z",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            }
                        },
                        "reloads": [
                            {
                                "location": {
                                    "lat": 52.559049,
                                    "lng": 13.533147
                                },
                                "duration": 600
                            }
                        ]
                    }
                ],
                "capacity": [30],
                "skills": ["3"],
                "amount": 1
            }
        ],
        "profiles": [
            {
                "name": "truck",
                "type": "truck",
                "avoid": {
                    "features": ["uTurns"]
                },
                "options": {
                    "speedCap": 20
                }
            }
        ]
    },
    "plan": {
        "jobs": [
            {
                "id": "Job_1",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.56182,
                                        "lng": 13.497167
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_2",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.534553,
                                        "lng": 13.519429
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_3",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.482275,
                                        "lng": 13.502456
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_4",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.473537,
                                        "lng": 13.505414
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_5",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.463341,
                                        "lng": 13.49061
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_6",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.434003,
                                        "lng": 13.466142
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_7",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447476,
                                        "lng": 13.433062
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_8",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458414,
                                        "lng": 13.392079
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_9",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.446407,
                                        "lng": 13.36047
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_10",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.440807,
                                        "lng": 13.351399
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_11",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.462867,
                                        "lng": 13.342188
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_12",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.458232,
                                        "lng": 13.338698
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_13",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.457629,
                                        "lng": 13.323742
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_14",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.552057,
                                        "lng": 13.349613
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Job_15",
                "tasks": {
                    "pickups": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.447377,
                                        "lng": 13.363822
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [10]
                        }
                    ]
                }
            },
            {
                "id": "Dumping_Site_1",
                "skills": ["1"],
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.559049,
                                        "lng": 13.533147
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [0],
                            "position": {
                                "type": "last"
                            }
                        }
                    ]
                }
            },
            {
                "id": "Dumping_Site_2",
                "skills": ["2"],
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.559049,
                                        "lng": 13.533147
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [0],
                            "position": {
                                "type": "last"
                            }
                        }
                    ]
                }
            },
            {
                "id": "Dumping_Site_3",
                "skills": ["3"],
                "tasks": {
                    "deliveries": [
                        {
                            "places": [
                                {
                                    "location": {
                                        "lat": 52.559049,
                                        "lng": 13.533147
                                    },
                                    "duration": 600
                                }
                            ],
                            "demand": [0],
                            "position": {
                                "type": "last"
                            }
                        }
                    ]
                }
            }
        ]
    },
    "advancedObjectives": [
        [
            {
                "type": "minimizeUnassigned"
            }
        ],
        [
            {
                "type": "minimizeTourOverlap"
            }
        ],
        [
            {
                "type": "optimizeTaskPosition"
            }
        ],
        [
            {
                "type": "minimizeCost"
            }
        ]
    ]
}

Solution

The following section provides the full solution of the previous problem:

Click to expand/collapse the sample JSON
{
    "statistic": {
        "cost": 191.005,
        "distance": 219765,
        "duration": 35201,
        "times": {
            "driving": 23201,
            "serving": 12000,
            "waiting": 0,
            "stopping": 0,
            "break": 0
        }
    },
    "tours": [
        {
            "vehicleId": "garbage_truck_1_1",
            "typeId": "garbage_truck_1",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:20:26Z",
                        "departure": "2023-05-28T08:30:26Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_14",
                            "type": "pickup",
                            "location": {
                                "lat": 52.552057,
                                "lng": 13.349613
                            },
                            "time": {
                                "start": "2023-05-28T08:20:26Z",
                                "end": "2023-05-28T08:30:26Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.552057,
                        "lng": 13.349613
                    },
                    "distance": 9830
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:56:08Z",
                        "departure": "2023-05-28T09:06:08Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_1",
                            "type": "pickup",
                            "location": {
                                "lat": 52.56182,
                                "lng": 13.497167
                            },
                            "time": {
                                "start": "2023-05-28T08:56:08Z",
                                "end": "2023-05-28T09:06:08Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.56182,
                        "lng": 13.497167
                    },
                    "distance": 21377
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:13:27Z",
                        "departure": "2023-05-28T09:23:27Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_2",
                            "type": "pickup",
                            "location": {
                                "lat": 52.534553,
                                "lng": 13.519429
                            },
                            "time": {
                                "start": "2023-05-28T09:13:27Z",
                                "end": "2023-05-28T09:23:27Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.534553,
                        "lng": 13.519429
                    },
                    "distance": 25126
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:30:31Z",
                        "departure": "2023-05-28T09:40:31Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T09:30:31Z",
                                "end": "2023-05-28T09:40:31Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 29422
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:03:44Z",
                        "departure": "2023-05-28T10:13:44Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_5",
                            "type": "pickup",
                            "location": {
                                "lat": 52.463341,
                                "lng": 13.49061
                            },
                            "time": {
                                "start": "2023-05-28T10:03:44Z",
                                "end": "2023-05-28T10:13:44Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.463341,
                        "lng": 13.49061
                    },
                    "distance": 43551
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:21:03Z",
                        "departure": "2023-05-28T10:31:03Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_3",
                            "type": "pickup",
                            "location": {
                                "lat": 52.482275,
                                "lng": 13.502456
                            },
                            "time": {
                                "start": "2023-05-28T10:21:03Z",
                                "end": "2023-05-28T10:31:03Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.482275,
                        "lng": 13.502456
                    },
                    "distance": 47269
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:33:03Z",
                        "departure": "2023-05-28T10:43:03Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_4",
                            "type": "pickup",
                            "location": {
                                "lat": 52.473537,
                                "lng": 13.505414
                            },
                            "time": {
                                "start": "2023-05-28T10:33:03Z",
                                "end": "2023-05-28T10:43:03Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.473537,
                        "lng": 13.505414
                    },
                    "distance": 48555
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:02:09Z",
                        "departure": "2023-05-28T11:12:09Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Dumping_Site_1",
                            "type": "delivery",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T11:02:09Z",
                                "end": "2023-05-28T11:12:09Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 61015
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:32:01Z",
                        "departure": "2023-05-28T11:32:01Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T11:32:01Z",
                                "end": "2023-05-28T11:32:01Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 73024
                }
            ],
            "statistic": {
                "cost": 68.605,
                "distance": 73024,
                "duration": 12721,
                "times": {
                    "driving": 7921,
                    "serving": 4800,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "garbage_truck_2_1",
            "typeId": "garbage_truck_2",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:21:57Z",
                        "departure": "2023-05-28T08:31:57Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_11",
                            "type": "pickup",
                            "location": {
                                "lat": 52.462867,
                                "lng": 13.342188
                            },
                            "time": {
                                "start": "2023-05-28T08:21:57Z",
                                "end": "2023-05-28T08:31:57Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.462867,
                        "lng": 13.342188
                    },
                    "distance": 11790
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:35:02Z",
                        "departure": "2023-05-28T08:45:02Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_12",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458232,
                                "lng": 13.338698
                            },
                            "time": {
                                "start": "2023-05-28T08:35:02Z",
                                "end": "2023-05-28T08:45:02Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458232,
                        "lng": 13.338698
                    },
                    "distance": 13001
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:49:29Z",
                        "departure": "2023-05-28T08:59:29Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_13",
                            "type": "pickup",
                            "location": {
                                "lat": 52.457629,
                                "lng": 13.323742
                            },
                            "time": {
                                "start": "2023-05-28T08:49:29Z",
                                "end": "2023-05-28T08:59:29Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.457629,
                        "lng": 13.323742
                    },
                    "distance": 15148
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:38:24Z",
                        "departure": "2023-05-28T09:48:24Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "reload",
                            "type": "reload",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T09:38:24Z",
                                "end": "2023-05-28T09:48:24Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 39313
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:20:22Z",
                        "departure": "2023-05-28T10:30:22Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_6",
                            "type": "pickup",
                            "location": {
                                "lat": 52.434003,
                                "lng": 13.466142
                            },
                            "time": {
                                "start": "2023-05-28T10:20:22Z",
                                "end": "2023-05-28T10:30:22Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.434003,
                        "lng": 13.466142
                    },
                    "distance": 58177
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:36:46Z",
                        "departure": "2023-05-28T10:46:46Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_7",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447476,
                                "lng": 13.433062
                            },
                            "time": {
                                "start": "2023-05-28T10:36:46Z",
                                "end": "2023-05-28T10:46:46Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447476,
                        "lng": 13.433062
                    },
                    "distance": 61706
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:53:58Z",
                        "departure": "2023-05-28T11:03:58Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_8",
                            "type": "pickup",
                            "location": {
                                "lat": 52.458414,
                                "lng": 13.392079
                            },
                            "time": {
                                "start": "2023-05-28T10:53:58Z",
                                "end": "2023-05-28T11:03:58Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.458414,
                        "lng": 13.392079
                    },
                    "distance": 65730
                },
                {
                    "time": {
                        "arrival": "2023-05-28T11:39:25Z",
                        "departure": "2023-05-28T11:49:25Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Dumping_Site_2",
                            "type": "delivery",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T11:39:25Z",
                                "end": "2023-05-28T11:49:25Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 88296
                },
                {
                    "time": {
                        "arrival": "2023-05-28T12:09:17Z",
                        "departure": "2023-05-28T12:09:17Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T12:09:17Z",
                                "end": "2023-05-28T12:09:17Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 100305
                }
            ],
            "statistic": {
                "cost": 79.785,
                "distance": 100305,
                "duration": 14957,
                "times": {
                    "driving": 10157,
                    "serving": 4800,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        },
        {
            "vehicleId": "garbage_truck_3_1",
            "typeId": "garbage_truck_3",
            "stops": [
                {
                    "time": {
                        "arrival": "2023-05-28T08:00:00Z",
                        "departure": "2023-05-28T08:00:00Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "departure",
                            "type": "departure",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T08:00:00Z",
                                "end": "2023-05-28T08:00:00Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 0
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:22:19Z",
                        "departure": "2023-05-28T08:32:19Z"
                    },
                    "load": [10],
                    "activities": [
                        {
                            "jobId": "Job_10",
                            "type": "pickup",
                            "location": {
                                "lat": 52.440807,
                                "lng": 13.351399
                            },
                            "time": {
                                "start": "2023-05-28T08:22:19Z",
                                "end": "2023-05-28T08:32:19Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.440807,
                        "lng": 13.351399
                    },
                    "distance": 10902
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:34:52Z",
                        "departure": "2023-05-28T08:44:52Z"
                    },
                    "load": [20],
                    "activities": [
                        {
                            "jobId": "Job_9",
                            "type": "pickup",
                            "location": {
                                "lat": 52.446407,
                                "lng": 13.36047
                            },
                            "time": {
                                "start": "2023-05-28T08:34:52Z",
                                "end": "2023-05-28T08:44:52Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.446407,
                        "lng": 13.36047
                    },
                    "distance": 11996
                },
                {
                    "time": {
                        "arrival": "2023-05-28T08:47:49Z",
                        "departure": "2023-05-28T08:57:49Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Job_15",
                            "type": "pickup",
                            "location": {
                                "lat": 52.447377,
                                "lng": 13.363822
                            },
                            "time": {
                                "start": "2023-05-28T08:47:49Z",
                                "end": "2023-05-28T08:57:49Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.447377,
                        "lng": 13.363822
                    },
                    "distance": 13015
                },
                {
                    "time": {
                        "arrival": "2023-05-28T09:35:31Z",
                        "departure": "2023-05-28T09:45:31Z"
                    },
                    "load": [30],
                    "activities": [
                        {
                            "jobId": "Dumping_Site_3",
                            "type": "delivery",
                            "location": {
                                "lat": 52.559049,
                                "lng": 13.533147
                            },
                            "time": {
                                "start": "2023-05-28T09:35:31Z",
                                "end": "2023-05-28T09:45:31Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.559049,
                        "lng": 13.533147
                    },
                    "distance": 34427
                },
                {
                    "time": {
                        "arrival": "2023-05-28T10:05:23Z",
                        "departure": "2023-05-28T10:05:23Z"
                    },
                    "load": [0],
                    "activities": [
                        {
                            "jobId": "arrival",
                            "type": "arrival",
                            "location": {
                                "lat": 52.50935,
                                "lng": 13.41997
                            },
                            "time": {
                                "start": "2023-05-28T10:05:23Z",
                                "end": "2023-05-28T10:05:23Z"
                            }
                        }
                    ],
                    "location": {
                        "lat": 52.50935,
                        "lng": 13.41997
                    },
                    "distance": 46436
                }
            ],
            "statistic": {
                "cost": 42.615,
                "distance": 46436,
                "duration": 7523,
                "times": {
                    "driving": 5123,
                    "serving": 2400,
                    "waiting": 0,
                    "stopping": 0,
                    "break": 0
                }
            },
            "shiftIndex": 0
        }
    ]
}

The following figure shows the visual breakdown of the tour:

A tour with the dumping site as last job before returning to the depot

As both the solution and the corresponding visualization indicate, all vehicles started and ended their tours at the depot location. For all vehicles, the dumping site served as both the reload location (in case they reached their capacity limit of 30) and the final stop to unload the remaining trash before heading back to the depot.

Conclusions

A wide range of available features in the HERE Tour Planning API allows you to tailor tour planning to different use cases, ensuring optimal solutions for your specific needs. Whether it is food delivery, passenger transport, or waste management, the tools offered by the API help to make your logistics operations more efficient.

Next steps

  • For more information about formulating problems in the HERE Tour Planning API, see Problem.
  • For an in-depth exploration of the HERE Tour Planning API methods, endpoints, and parameters, see the API Reference.