Modeling the Municipal Waste Collection Using Genetic Algorithms

: Calculating adequate vehicle routes for collecting municipal waste is still an unsolved issue, even though many solutions for this process can be found in the literature. A gap still exists between academics and practitioners in the ﬁeld. One of the apparent reasons why this rift exists is that academic tools often are not easy to handle and maintain by actual users. In this work, the problem of municipal waste collection is modeled using a simple but efﬁcient and especially easy to maintain solution. Real data have been used, and it has been solved using a Genetic Algorithm (GA). Computations have been done in two different ways: using a complete random initial population, and including a seed in this initial population. In order to guarantee that the solution is efﬁcient, the performance of the genetic algorithm has been compared with another well-performing algorithm, the Variable Neighborhood Search (VNS). Three problems of different sizes have been solved and, in all cases, a signiﬁcant improvement has been obtained. A total reduction of 40% of itineraries is attained with the subsequent reduction of emissions and costs.


Introduction
The improvement of the waste collection process can be considered aligned with the 11th Sustainable Development Goal (SDG) "Sustainable cities and communities" [1]. Nevertheless, this process is still far from being in an optimal status. As experts state [2], inadequate vehicle routes are among the problems the process should tackle. The optimization of the routes for waste collection vehicles with time window is known as the Waste Collection Vehicle Routing Problem (WCVRP).
As indicated by Caria, Todde, and Pazzona [3], the WCVRP is a specific case of the whole class of problems, known as the Vehicle Routing Problem (VRP). The oldest VRP type problem in the transport history is the Travelling Salesman Problem (TSP), solved for the first time by Lin [4], where the aim is to find the shortest route visiting each member of a collection of locations and returning to the starting point. The TSP has evolved towards solving similar problems with different and additional restrictions and objectives, including the WCVRP presented herein.
The WCVRP needs to organize routes, vehicles, and customers, while respecting the constraints that are imposed by the system. VRP allows for reaching the goals that are referred to as transport logistics, as well as the minimization of costs and carbon dioxide (CO 2 ) emissions [3]. On top of the overall VRP considerations, WCVRP is concerned with finding cost optimal routes for garbage trucks such that all garbage bins are emptied and the waste is driven to disposal sites while respecting customer time windows and ensuring that drivers are given the breaks that the law requires. The first waste collection problem was probably presented by Beltrami and Bodin [5]. Since then, the problem has evolved into the herein presented WCVRP. Many relevant references have studied this problem so far, offering different approaches for solving the same challenge (or similar ones). Concerning the most relevant and recent ones, Buhrkal, Larsen, and Ropke [6] propose an adaptive large neighborhood search algorithm for solving the problem. Babaee Tirkolaee, Mahdavi, and Seyyed Esfahani [7] apply an improved hybrid simulated annealing algorithm (SA) for optimizing the mathematical model developed. Hannan et al. [8] propose a particle swarm optimization algorithm to optimize a model that considers not only typical distance, total waste, collection efficiency, etc. parameters but also Threshold Waste Level (TWL) tightness factors. De Bruecker et al. [9] present an enhanced model for the WCVRP that models distinct labor cost types and collecting speeds; thus, they differentiate between cheaper regular shifts during traffic peak hours, against higher collection speeds but with expensive, non-regular shift-rates. Rodrigues Pereira Ramos, Soares de Moraisa, and Barbosa-Póvoa [10] study three operational management approaches to define dynamic optimal routes based on sensoring, Radio Frequency Identification (RFID), and considering the access to real-time information on the bins' fill-levels. Benjamin and Beasley [11] develop a model for the waste collection vehicle routing problem with time windows, driver rest period, and multiple disposal facilities as a differential aspect.
It is worth mentioning that the sometimes explicit, but always present idea of this optimization problem is the reduction of CO 2 emissions, as the current logistic methods used in this routing problems depend strongly on fossils fuels [12].
The fact of not having generalized optimized routes for the WCVRP is striking, as many solutions for this process can be found in the literature. When analyzing the potential causes of this breach between the practitioners and the academia, it could be stated that generic routing tools are considered incomplete for this variant of the traveling salesman problem [13], whereas more specific tools (such as [14,15]) have a related cost that often entities are not willing to afford. Additionally, many researchers developed their solutions to the problem, but normally they are more focused on publishing them than in offering them to entities that manage the waste collection. Thus, even though the problem has been deeply studied from a theoretical point of view, its application to real-world problems is scarce.
Within this context, the aim of this work has been to show the development and implementation of a procedure for the optimization for a local commonwealth for tackling the WCVRP of a region.
In the final solutions, Genetic Algorithms (GAs) have been applied. GAs belong to the more general classification of evolutionary optimization techniques or evolutionary programs and they are surely the most widely known type of Evolutionary Algorithms. They are based on selection, crossover, and mutation principles of Darwin's theory of evolution. In the last few years, there has been a growing effort to apply GAs to general constrained optimization problems as most of engineering optimization problems often see their solution constrained by a number of restrictions imposed on the decision variables [16].
The research method had three major steps: first, we performed a literature review of optimization algorithms applied to this case that is detailed in Section 1. The aim of this study was to analyze how this problem was modeled in the past, and to pre-select which types of algorithms could fit best to the end user requirements in terms of user friendliness, cost, and quality of results. Second, the characteristics of this specific optimization case (detailed in Section 2) were analyzed to offer the company a selection of the algorithm fitting best to its requirements. Finally, the designed solution was successfully implemented and tested with the pre-selected types of algorithms, to choose the one performing best, as it is detailed in Section 3 Methodology, Section 4 Algorithm, and Section 5 Results, remarking that the obtained results raised the interest of the surrounding communities.

Optimization Problems
Combinatorial optimization problems can be written mathematically as: where f : R n → R is the objective function, and h i : R n → R, i = 1, . . . , m and f j : R n → R, j = 1, . . . , s are the constraints. The optimization problem has been written as a minimization problem, but after some modifications it can be written as a maximization problem: In the same way, the equality constraints f j (x) = b j can be written as inequalities: The simplest constrained optimization problem arises when the objective function f (x) and the restrictions are linear functions. This type of problem is a linear programming problem, and it can be solved quite efficiently by the simplex algorithm. However, in the majority of the optimization problems, neither the objective function nor the restrictions are linear functions. The vast majority of these problems are NP-complete problems, which means that there is no any solving algorithm that can be executed in polynomial time in relation to the size of the problem. In complexity theory, NP-complete denotes the set of problems that are not solvable by a deterministic polynomial time algorithm. The feasible solutions' space is so large that the computation of the exact solution requires a lot of time. NP-complete problems can be solved by a restricted class of brute force search algorithms and they can be used to simulate any other problem with a similar algorithm. Genetic algorithms are also a good and efficient choice to find an approximate solution of these problems [17]. A classical NP-complete problem is the Travelling Salesman Problem (TSP), in which the shortest route for a traveling salesman starting and finishing in the same point and visiting every city once has to be found.
An efficient way to solve these types of problems is using genetic algorithms. The basic principles of genetic algorithms were established by Holland [18], and they are well described in several texts [19][20][21][22][23]. Owing to their simplicity, flexibility, ease of implementation, minimal requirements, fast convergence towards close-to-optimal solutions, and global perspective, GAs are successfully used in a wide variety of problems [16]. As these characteristics are essential for practitioners to have a utilizable solution, and as the performed literature review did not bring better solutions, the chosen option was to implement the simple GA (SGA) presented herein.

Traveling Salesman Problem
In the TSP problem, a collection of n cities are given. The objective is to determine the shortest route that a salesman has to follow, in which each city is visited once and then the salesman returns to the starting point of the route. This problem can be defined mathematically as follows: Given an integer n and an n × n matrix D = (d ij ) in which each d ij is the distance between two cities, the cyclic permutation π of the integers i = 1, 2, . . ., n that minimizes the distances has to be determined. As a first approximation, the feasible search space is formed by all cyclic permutations of the numbers {1, 2, . . . , n}: F = (π 1 π 2 . . . π n )| π i ∈ {1, 2, . . . , n} and π i = π j ∀i = j .
The number of elements of this space is n!, being n the number of cities. In this way, the length of a permutation π = (π 1 , π 2 , . . . , π n ) can be expressed as: For each permutation π, there are (n − 1) permutations that starting in a different city are similar to the given one. That is to say, the distance of these n permutations is the same. Taking into account this consideration, the size of the feasible space is n!/n = (n − 1)!. Moreover, if the distance matrix D is symmetric, the distance of each permutation in both directions is the same, and the size of the feasible space is reduced to (n − 1)!/2. As it can be observed, the main difficulty of this problem is the huge number of possible tours.

Methodology
The objective of this work is to find an optimal itinerary for the waste collection. This methodology will be applied to the data of Sopelana, a municipality in the province of Biscay, autonomous community of the Basque Country (Spain). Sopelana is located in the region of Plencia-Munguia or Uribe, and it is part of the Commonwealth of Services of Uribe Coast. It has an extension of 8.40 km 2 and a population of 13,510 inhabitants, a figure that in summer is usually multiplied by four due to summer visitors.
It is the responsibility of the commonwealth everything related to waste management. There are various trash cans to collect waste: Other types of waste such as big volume wastes are collected once per week following the same route as for the restwaste; there are eight points to collect lamps and fluorescent lightings and they are collected when the container is full; there are some locations in which CDs are collected when the containers are full. All the aforementioned data were given by the local government.
In this work, three problems of different sizes will be analyzed. In the three cases, the aim is to improve the waste collection itinerary in the sense of obtaining a shorter route than the one followed nowadays. A small problem of reusable waste with seven trash cans, a medium problem of organic waste consisting of 29 trash cans, and a big problem consisting of the first route of restwaste with a total of 186 trash cans will be considered. In the case of restwaste, there are several trash cans in the same location. Specifically, the 186 trash cans are distributed in 147 different locations; thus, these locations will be considered in the problem. The data of these problems can be seen in Table 1. According to the data given by the enterprise in charge of restwaste collection, between 8000 kg and 13,000 kg of restwaste are collected everyday in Sopelana. A truck is enough to carry out this collection. The truck used has a load of 13 tons, and it has a compaction mechanism. Each container has 1.1 m 3 , which is reduced to 0.183 m 3 after compaction. This means that the volume of 125 trash cans that are full can fit in the truck (125 × 0.183 m 3 = 22.875 m 3 ). In the event that the truck was filled during the collection of the 186 containers (147 location points), it would be emptied in the dump intended for it and, after that, it would continue with the route. However, this event is not very probable as it means that 125 trash cans out of 186 are full up (which is the 67.20%).

Algorithms
For the three problems, the coordinates of the locations and the distance matrices have been calculated using Google Maps (https://www.google.com/maps, data from October and November 2019). The coordinates of all locations and the distance matrices can be found in Appendix A. The smallest distance between two locations has been considered in the distance matrices. The distance matrices are not symmetric, as the way back and forth from a location to another may be different.
The three problems have been solved using a VNS and a GA. The smallest problem (reusable waste, seven locations) has also been solved using the brute force algorithm. These two algorithms were chosen among all the set of alternatives for developing the final solution for maintainability reasons. The developers of the solutions are academic institutions, so we cannot provide maintenance services. As both literature [24] and the news [25] state, there is a lack of availability of computer science technicians. Because of this fact, the final user of the solution wanted a competitive but mainly easy to maintain algorithm. These algorithms being two of the most frequently applied when developing the syllabuses of subjects related to programming, the research team decided to compare them and offer the most effective possible solution. The distances that correspond to all the permutations of n = 7 elements have been calculated that is 7! = 5040. The process has been implemented as it is explained in Algorithm 1.
Algorithm 1 Algorithm to determine solutions using brute force. Create all the permutations of n = 7 elements 3: for i=1:7! do 4: Calculate the distance of the permutation 5: end for 6: Calculate the shortest distance among all the permutations 7: end procedure We have started by trying the VNS algorithm [26] for all the problems. The VNS consists of applying a local search method repeatedly in the neighborhood N k of the actual solution. When a local optimal is reached, the algorithm changes the system of neighborhood with the aim of escaping from local optima and reaching a better one. For this reason, it can be said that the VNS performs well both when searching local and global optima. In Algorithm 2, the process followed is explained. We have implemented two systems of neighborhoods: the 2-opt neighborhood and a swap-based neighborhood. The neighborhood structure 2-opt consists of changing a pair of edges between cities [27]. The swap-based neighborhood that we have created swaps the first element of the permutation with all the rest.
Algorithm 2 Algorithm to determine solutions using VNS.
Choose a set of neighborhood structures N k for k = 1, 2, . . . , k max 3: Generate the initial solution 4: Consider the initial solution as the best one 5: k ← 1 6: while k ≤ k max do 7: while There is an improvement do 8: Choose the neighborhood system that corresponds to k 9: Find the best solution among all the neighbors 10: if The solution is improved then 11: Update the best solution and its evaluation function value 12: Continue to search with k ← 1 13: else 14: Continue to search with k ← k + 1 15: end if 16: end while 17: end while 18: Output the shortest distance and the corresponding route of the overall process 19: end procedure Additionally, for all the problems n = 7, n = 129, and n = 147, another two algorithms have been implemented. In Algorithm 3, an initial population of m different individuals (permutations) has been created. The evaluation function (distance of the route) of each individual has been calculated. In each generation, the process of selecting two parents randomly, the crossover operator, the posterior correction of the individual in order to be a permutation, and the mutation process have been performed m/2 times. If the new descendants are different from the individuals of the population and if their evaluation function (fitness function) is smaller than the worst (the largest) of the population, the worst individuals are replaced by these new descendants. The fourth algorithm implemented only differs from the third in the fact that the routes followed nowadays in the trash collection (one route in each problem) are inserted as a seed in the initial population. Create an initial population of m different permutations randomly 3: Compute the evaluation function of each permutation 4: for i=1:generations do 5: for j=1:m/2 do 6: Select two parents randomly from the population 7: Cross with a certain probability to produce two descendants 8: Correct the descendants to be permutations 9: Mutate each individual with a certain probability 10: Compute the evaluation function of each descendant 11: if evaluation function of the descendants smaller than the largest evaluation then 12: if the descendants are not repeated in the population then 13: Replace the descendants by the permutations with largest evaluation 14: end if 15: end if 16: end for 17: Output the shortest distance and the corresponding route of each generation 18: end for 19: Output the shortest distance and the corresponding route of the overall process 20: end procedure The crossover operator used is the classical one [18]. A crossover point is selected randomly from which the two strings of the parents are broken into separate parts. The new descendants are formed by recombination of these parts. For example, consider n = 7 and the routes: ( 1 2 3 4 5 6 7) ( 2 4 5 3 7 1 6) Randomly, a crossover point in which the strings are broken into separate parts is selected. Suppose that the crossover point is chosen between the third and the fourth bit: (1 2 3 | 4 5 6 7 ) (2 4 5 | 3 7 1 6 ) Combining the head of the first route with the tail of the second route and vice versa, the result is the following: (1 2 3 6 7 4 5)

Results
In this section, the results obtained for each of the problems are presented. For n = 7, the brute force algorithm has been applied first. The shortest itinerary has 7.67 km and the longest 13.2 km. In Figure 1, the distances of all permutations (7! = 5040) are shown. All the permutations are represented in the horizontal axis (that is, 7! = 5040), and the distance that corresponds to each of them is plotted in the vertical axis. For the three problems, the VNS algorithm has been applied next. Ten executions have been done for each problem. The best, the worst, the mean, and the median distances of this executions are presented in Tables 2-4. In all the executions, an initial solution has been generated randomly. In addition, finally, the SGA (without and with a seed) has been performed. For n = 7, taking into account that the average of the shortest and the longest route is 10.4350 km, the route (6, 7, 3, 4, 2, 5, 1) of 10.45 km has been chosen as seed. In the cases of n = 29 and n = 147, the actual itineraries have been chosen as seed. These data are available in Table 5. Notice that, if the VNS algorithm is started, taking the actual itinerary as initial solution, all the executions have the same performance. In this case, for n = 7, a route of 8.2500 km is obtained; for n = 29, a route of 18.7670 km; and, for n = 147, a route of 34.4280 km. An execution for each problem has been performed. Parameters have been chosen according to [29]: a relatively high crossover rate (≥ 0.6), small mutation rate (range [0.001, 0.1]) and a moderate population size. Data and results are presented in Tables 6-8. In all the cases, the execution in which the seed is considered obtains better solutions.  (18, 16, 28, 27, 14, 25, 13, 12, 11, 9, (102, 103, 142, 113, 114, 125, 130, 134, 133, 132, − (141, 140, 135, 136, 107, 138, 137, 139, 142 The longest, the shortest, and the average-distance itineraries for n = 7 can be seen in Figure 2. The limit of the municipality of Sopelana is marked using a thick red line. Additionally, several executions have been performed for each of the problems (n = 7, 29, 147). The best, the worst, the mean, and the median distance of this performance are presented in Tables 9-11. The values of these tables are acquired after performing 10 executions for each version of each problem.  For the largest problems, n = 29 and n = 147, computation has been repeated choosing different parameters in order to obtain better results. The most important change is that a larger population size has been used, i.e., 4000 individuals. Execution data and results can be seen in Tables 12 and 13.  The actual itineraries are presented in Figures 3 and 4, and the improved itineraries of Tables 12 and 13 obtained with the new parameters in Figures 5 and 6. In the case of problem n = 147, Figures 4 and 6, the first and the last location of the route are marked in red.

Conclusions
In this work, three waste collection itineraries have been improved in a municipality of Biscay (Spain). The average itinerary of the reusable waste (n = 7 problem) has had a reduction of 2.78 km; and the actual itineraries of organic waste (n = 29 problem) and restwaste (n = 147 problem) have been reduced 5.98 km and 19.194 km, respectively. Taking into account the collection frequencies of these three itineraries, this makes a total reduction of 7400 km per year, that is to say, a reduction of the 40% of the total actual itineraries.
The truck has a continent of 13 tons and it has a compaction mechanism. Considering the following average data for the truck: vehicle of 26 Tn, speed limit 30 km/h, with 270 CV minimum engine power (1 CV = 735.39, 875 W= 0.986 HP) and diesel fuel type and 29 L/100 km consumption [30]. This implies a reduction of 5.58 Tn of CO 2 emissions, 0.43 Kg of CO, and 13.95 Kg of NOx per year. In addition to these improvements, a direct cost savings of 7294e was obtained (considering the direct cost per kilometer calculation model recommended by the Ministry of Transportation, Logistics and Urban Agenda of Spain [31]).
It is worth mentioning that the research team performed an additional validation for the developed model. Specifically, the actual consumptions versus the ones proposed by the model were analyzed at the two comparable routes (the ones the truck made before and after the optimization), obtaining negligible differences. This double check on the results and the easiness of the solution have raised the interest of other commonwealths, such as the one of Lea-Artibai. Thus, the short and midterm future steps would be oriented to the application of the same procedure to other local communities, incorporating other parameters such as the elevation information of the routes.

Acknowledgments:
We would like to thank the partners of the Deusto Digital Industry Chair (Etxe-Tar, General Electric, Idom, Accenture, Fundación Telefónica, Fundación BBK) the interest and support shown during this research. We would like also to thank the municipality of Sopelana and the commonwealth of the regions of Lea-Artibai for placing their trust and confidence in our organization.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript:  The distances between the 147 locations can be found in [32].