An Algorithm for the Optimal Waste Collection in Urban Areas