scieee AI-readable full text Open interactive document viewer

Heuristics for a cash-collection routing problem with a cluster-first route-second approach

Singh, Bismark,Oberfichtner, Lena,Ivliev, Sergey

Abstract

EconStor is a publication server for scholarly economic literature, provided as a non-commercial public service by the ZBW.

Full text

Singh, Bismark; Oberfichtner, Lena; Ivliev, Sergey Article — Published Version Heuristics for a cash-collection routing problem with a cluster-first route-second approach Annals of Operations Research Provided in Cooperation with: Springer Nature Suggested Citation: Singh, Bismark; Oberfichtner, Lena; Ivliev, Sergey (2022) : Heuristics for a cash-collection routing problem with a cluster-first route-second approach, Annals of Operations Research, ISSN 1572-9338, Springer US, New York, NY, Vol. 322, Iss. 1, pp. 413-440, https://doi.org/10.1007/s10479-022-04883-1 This Version is available at: https://hdl.handle.net/10419/312474 Standard-Nutzungsbedingungen: Die Dokumente auf EconStor dürfen zu eigenen wissenschaftlichen Zwecken und zum Privatgebrauch gespeichert und kopiert werden. Sie dürfen die Dokumente nicht für öffentliche oder kommerzielle Zwecke vervielfältigen, öffentlich ausstellen, öffentlich zugänglich machen, vertreiben oder anderweitig nutzen. Sofern die Verfasser die Dokumente unter Open-Content-Lizenzen (insbesondere CC-Lizenzen) zur Verfügung gestellt haben sollten, gelten abweichend von diesen Nutzungsbedingungen die in der dort genannten Lizenz gewährten Nutzungsrechte. Terms of use: Documents in EconStor may be saved and copied for your personal and scholarly purposes. You are not to copy documents for public or commercial purposes, to exhibit the documents publicly, to make them publicly available on the internet, or to distribute or otherwise use the documents in public. If the documents have been made available under an Open Content Licence (especially Creative Commons Licences), you may exercise further usage rights as specified in the indicated licence. https://creativecommons.org/licenses/by/4.0/ Annals of Operations Research (2023) 322:413–440 https://doi.org/10.1007/s10479-022-04883-1 ORIGINAL RESEARCH Heuristics for a cash-collection routing problem with a cluster-first route-second approach Bismark Singh1,2 ·Lena Oberfichtner3·Sergey Ivliev4 Accepted: 15 July 2022 / Published online: 30 August 2022 © The Author(s) 2022 Abstract Motivated by a routing problem faced by banks to enhance their encashment services in the city of Perm, Russia, we solve versions of the traveling salesman problem (TSP) with clustering. To minimize the risk of theft, suppliers seek to operate multiple vehicles and determine an efficient routing; and, a single vehicle serves a set of locations that forms a cluster. This need to form independent clusters—served by distinct vehicles—allows the use of the so-called cluster-first route-second approach. We are especially interested in the use of heuristics that are easily implementable and understandable by practitioners and require only the use of open-source solvers. To this end, we provide a short survey of 13 such heuristics for solving the TSP, five for clustering the set of locations, and three to determine an optimal number of clusters—all using data from Perm. To demonstrate the practicality and efficiency of the heuristics, we further compare our heuristic solutions against the optimal tours. We then provide statistical guarantees on the quality of our solution. All of our anonymized code is publicly available allowing extensions by practitioners, and serves as a decision-analytic framework for both clustering data and solving a TSP. Keywords Traveling salesman problem ·Clustering ·Decision analysis ·Heuristics · Approximations ·Open-source solvers List of symbols Abbreviations TSP Traveling Salesman Problem VRP Vehicle Routing Problem CTSP Clustered Traveling Salesman Problem BBismark Singh [email protected] 1Department of Data Science, Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, Germany 2Department of Mathematics, Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, Germany 3Fraunhofer Institute for Machine Tools and Forming Technology IWU, Chemnitz, Germany 4Department of Economics, Perm State University, Perm, Russia 123 414 Annals of Operations Research (2023) 322:413–440 PAM Partitioning Around Medoids FPAM Fast Partitioning Around Medoids FKM Simple and Fast k-Medoid RKM Ranked k-Medoid IKM Improved k-Medoids Clustering EM Elbow Method ASM Average Silhouette Method GSM Gap Statistic Method NN Nearest Neighbor NNR Nearest Neighbor Repeat NI Nearest Insertion FI Farthest Insertion CI Cheapest Insertion AI Arbitrary Insertion 2O Two-Opt 2ONN 2O version of NN 2ONNR 2O version of NNR 2ONI 2O version of NI 2OFI 2O version of FI 2OCI 2O version of CI 2OAI 2O version of AI Sets and Parameters i∈ISet of locations k∈KSet of clusters CkSet of locations within cluster k k∗An optimal number of clusters Di,lDistance from location ito location l TDjTotal distance of cluster j TD Total distance of entire clustering 1 Introduction We consider a problem of optimizing the collection of cash from different merchants or points of sales (POSs) and automated teller machines (ATMs) by multiple vehicles. This problem is increasingly faced by banks to enable effective encashment services (Dandekar and Ranade, 2015;Gubaretal.,2011). We are motivated by a similar problem faced by banks in the city of Perm, Russia, where several vehicles collect cash on a periodic basis from over two hundred POSs and ATMs. The particular problem we address in this work was initially proposed by Perm’s branch of Sberbank—Russia and Eastern Europe’s largest bank as of 2014. Earlier the bank’s routing was a manual exercise that became a bottleneck in its growing market of cash-collection and growth of its ATM-network. Although cash-collection and cash-dispersion for ATMs are of relatively low risk due to the use special secured cassettes, major risks are associated with cash-collection from merchants and POSs where unsecured cash is transferred (Scott, 2001). Here, cash is transported as banknotes in safe boxes within vehicles (Kurdel and Sebestyénová, 2013). To minimize the risk of cash-in-transit robberies (Bozkaya et al., 2017; Gill, 2001), vehicles carrying cash seek to reduce the time spent on the road. Perm has an elongated landscape—the city spans 123 Annals of Operations Research (2023) 322:413–440 415 70 kms along the Kama River and has two major railroad crossings, which significantly limit the connectivity of the city’s districts; see Fig. 1. For a study of the history of crime in Perm, see Varese (2001). Thus, to enhance security, suppliers prefer multiple vehicles as opposed to a single vehicle. There are a number of classical routing problems with close connections to our work. To describe the problem we consider in this work, we begin with a few subtle differences from the classical routing problems. Due to the use of multiple vehicles, our problem differs from a direct application of a classical traveling salesman problem (TSP). Instead, our problem is more related to the multiple traveling salesman problem (mTSP) with possibly multiple depots, where multiple vehicles complete their respective tours visiting locations only once and the overall sum of the tour lengths is minimized, see, e.g., Çetiner et al. (2010). A similar problem is studied by Svestka and Huckfeldt (Svestka and Huckfeldt, 1973). An optimal solution for the traditional mTSP fulfills the following conditions: (i) It finds a route for every vehicle that starts and ends at a depot (the depot may be a single central depot or different regional depots for different vehicles), (ii) It visits every location—apart from the depots—exactly once, and (iii) It minimizes the overall transportation cost. For the case of a single vehicle, the mTSP reduces to the classical TSP.ThemTSP is a relaxation of another classical problem, namely the vehicle routing problem (VRP), where the capacity restrictions on the vehicles are removed (Bektas, 2006; Laporte, 2010; Osman, 1993). Although classical variants of the VRP allow both a single depot or multiple depots (Bullnheimer et al., 1999), the VRP is unrelated to this work. This is because we do not include any capacity restrictions, time windows, or bounded tour lengths. To fulfill the needs of Perm’s suppliers, we allow the possibility of multiple depots as opposed to a single central depot and search for multiple independent tours. We do not consider a fixed set of locations that serve as depots, thus vehicles can start a valid tour at any location. This is because the vehicles used by Perm’s suppliers are also deployed in other businesses, and we do not know a vehicle’s location at the start of the day. This assumption further simplifies our problem. To this end, we partition our set of locations into different clusters, or partitions, that are served by independent vehicles. Then, within each cluster we derive the optimal routing by solving a standard TSP. This approach for solving a routing problem is known as the cluster-first route-second approach (Miranda-Bront et al., 2016;Raff,1983). As we show later in this work, this approach provides two benefits over a direct solution of the mTSP:(i) it is computationally cheaper, and (ii) it allows the use of open-source solvers with only a slight loss in optimality. Another related problem is the clustered traveling salesman problem (CTSP); in the CTSP certain locations and the associated partitions are visited contiguously and in a pre-specified order, respectively, see, e.g., Laporte and Osman (1995). Tours within the different clusters are connected by edges, thereby forming a single overall tour for all the locations. When all the clusters are singletons, the CTSP reduces to the classical TSP. Chisman solves this CTSP by inflating inter-partition distances, thereby discouraging their inclusion in the original tour (Chisman, 1975). Later, Guttmann-Beck et al. (2000)and Ahmed(2012) study exact solution methods for this problem, and Baniasadi et al. (2020) provide an algorithm for its solution. In contrast, we treat clusters independently and do not reconnect them. In this sense, our work is similar to Ding et al. (2007), where the authors find a Hamiltonian cycle within every partition, disconnect an edge, and then reconnect the partitions. The approach we follow in this work differs in the sense that we do not reconnect the edges and are flexible in the choice of our initial partitions. Further, as opposed to the classical single-depot VRP we do 123 416 Annals of Operations Research (2023) 322:413–440 not consider a central depot. As we mention before, we are also flexible for depots within a partition; i.e., vehicles can start a valid tour from any location. Summarizing, closest to the existing literature our problem can be described as a mTSP that we solve using a cluster-first route-second approach. To this end, the following are the key questions we consider in this work: Q.1 What is a “good” set of locations that form part of each of the clusters? Q.2 What is a “good” number of clusters? Q.3 What is an “efficient” routing within a cluster? Since the mTSP is a relaxation of the VRP, Q.1–Q.3 are also answered by the VRP.Inthe first phase of our analysis, we answer questions Q.1 and Q.2 of the list above and quantify “good”. Multiple algorithms, without consensus, exist to determine good clustering, and the choice of the algorithm depends on the underlying application. We focus on centroid-based methods, that are popular within the last few decades (Kaufman and Rousseeuw, 1990; Schubert and Rousseeuw, 2019). In the second phase, we solve a TSP to determine the tours within the clusters that minimize the total distance. In general, finding an optimal tour is NP- hard (Garey and Johnson 1979), and we discuss a variety of heuristics exist for “efficiently” solving the TSP to answer question Q.3. The main contributions of this article are the following: (i) We provide a comparison and review of several heuristic methods for both clustering and the TSP; (ii) We present extensive computational results on a real-world case study to guide practitioners facing similar problems, and statistically validate the quality of our results; (iii) We use only open-source software and demonstrate the competitiveness of existing implementations to the state-of-the art solution methods; (iv) We publicly and freely provide our code in R to serve as a modeling guide for future applications. The structure of the rest of this article is as follows. In Sect. 2, we describe the dataset from Perm that we use as an example throughout the article. We present five heuristics for clustering and our computational experiments in Sect. 3. We summarize three methods for determining the number of clusters, and explain our decision-making process, in Sect. 4.In Sect. 5, we focus on finding tours for the clusters; we present both heuristics and a method guaranteed to find the optimal tours. Finally, we present some limitations of our work and a summary in Sect. 6. 2 Data sources and estimation For our computational experiments, we use a list of 237 POSs and ATMs in Perm. Perm lies on the banks of the Kama River near the Ural Mountains; all locationsare within the latitude range of (57◦57’05.8”N, 58◦09’43.0”N) and longitude range of (55◦55’09.5”E, 56◦26’36.0”E). Figure 1visualizes our dataset, and we provide an anonymized dataset at: https://github. com/Oberfichtner/Clustering_and_TSP_with_R.git. Most of the locations are present in the center of the city, with the Kama river forming a natural boundary between the locations. We use the great-circle-distances between two locations to construct a matrix of distances, D, instead of the actual road distances. Let Di,ldenote the distance between locations iand l. Then, the distance matrix is symmetric in our study; i.e., Di,l=Dl,i. Existing literature on routing problems often distinguish two classes—the asymmetric routing problem and the symmetric routing problem—and both classes have a rich history. 123 Annals of Operations Research (2023) 322:413–440 417 Fig. 1 Dataset of the considered 237 locations on the map of Perm. For details, see Sect. 2 Formally, an asymmetric distance function, f(x,y), between two locations xand ysatisfies f(x,y)=f(y,x)only if x=y. For other mathematical differences between these two functions that are beyond the scope of this work, see, e.g., Mennucci (2013). Although the asymmetric routing problem caters better to real-world problems, it is a significantly more challenging problem and heuristics towards it are less developed than its symmetric counterpart (Rodríguez and Ruiz, 2012). Rodríguez and Ruiz (Rodríguez and Ruiz, 2012) study the effect of asymmetry on heuristics of the TSP, and provide reasons in support of the use of both versions. The asymmetric routing problem also involves the use of a geographic information system (GIS) to compute road distances. GIS services could be expensive (Sutton et al., 2009)1and/or have privacy concerns (Blatt, 2012). For these reasons, and in a similar spirit to several classical works (Fischetti et al., 1995; Snyder and Daskin, 2006; Potvin, 1996), our work is on the symmetric TSP. For a detailed computational comparison between these two classes, we direct the interested reader to Cirasella et al. (2001). 3 Answering Q.1: clustering In this section, we seek to answer question Q.1 from Sect. 1. As we mention in Sect. 2,wehave a distance matrix Davailable. This allows a direct application of so-called centroid methods as opposed to hierarchical clustering methods. Within centroid based methods, k-means and 1We later learned of the large-scale open-source OSRM Project that enables computations of urban asymmetric distances in several different programming languages (Open Source Routing Machine Project, 2018). An implementation of ORSM in the language R is also available via the package ‘osrm’ (Giraud et al., 2022). For a usage guide, see, e.g., Brust (2018) (available in Spanish). 123 418 Annals of Operations Research (2023) 322:413–440 k-medoids are two popular choices; however, the k-means method is more sensitive to outliers than k-medoids. To ensure robustness in our clustering, in this work we use the k-medoid method; for a survey of clustering methods, see, e.g., Leskovec et al. (2014); Rokach and Maimon (2005). Questions Q.1 and Q.2 go hand-in-hand. As we mention in Sect. 1, we serve each cluster independently with a single vehicle. If the number of vehicles is known apriori, then we simply partition our locations into that many clusters and this answers question Q.2. We then proceed to determine the set of locations that form these clusters (methods for which we describe below). If the number of vehicles is not known, we seek to determine both a good number of clusters from a range of practical values and the corresponding locations in each cluster. In Sect. 4, we describe three methods to determine a good number of clusters; we then conclude k∗=4 clusters provide a good fit to our data. However, to ensure generality of our observations, we describe clustering our dataset between k=2andk=20 clusters. For values beyond 20, we get a significant number of clusters with just one location in them rendering them impractical. The structure of the rest of this section is as follows. In Sects. 3.1–3.5, we study five heuristic methods for clustering. For each of the five methods, we first provide a review of the algorithm and a reference for the details. Then, we provide computational experiments on our dataset, using open-source packages implemented in R. We also provide guidelines on identifying good clustering. In Fig. 2we visualize the clustering for the five methods for k=2,4,6; we present the other clusters in the Appendix. We begin with a notation and definitions that are general to all the five algorithms. The five methods divide the total set of nlocations into kdistinct clusters, C1,C2,...,Ck,wherekis known. Then, ∪jCj= {1,2,...,n}and Cj∩Cj=φ,∀j,j∈{1,2,...k}. Our goal is to determine the set of locations that form Cj,∀j=1,...,k. The methods proceed by iteratively determining a set of locations assigned to a set of medoids, m, to form clusters. The medoid is a location that forms part of the dataset. We denote the set of locations that are not yet assigned to a medoid as “non-selected”. We calculate the total distance, TDj, within cluster jat each iteration as p∈CjDp,mj, and the total overall distance, TD,ask j=1TDj. All methods are separated into two phases — build and swap. In the build phase we determine the initial medoids, and in the swap phase we exchange these medoids until a termination criteria is fulfilled. 3.1 Partitioning around medoids 3.1.1 Background We first employ the Partitioning Around Medoids algorithm (PAM)ofKaufmanand Rousseeuw (1990). By default, PAM starts by selecting klocations from the set of nlocations in a manner that “locally” minimizes the average dissimilarities of objects, see Simovici (2019) for details. We then initialize PAM by using these klocations as the initial medoids m1,...,mk. This completes the build phase. After assigning every location to a medoid, and determining TD the build phase finishes, and we update the medoids. We exchange every selected medoid successively with all non-selected locations and recompute TDfor the corresponding clustering. We find the minimum of these and compare it with the TD from the previous iteration. If the minimum is less than before, we update the set the medoids and repeat the process of exchanging every selected medoid. We stop when we either reach a maximum number of iterations or when TDdoes not decrease further. For details on PAM, see Kaufman and Rousseeuw (1990). 123 Annals of Operations Research (2023) 322:413–440 419 Fig. 2 aPAM bFPAM cFKM dRKM eIKM with α=1.1fIKM with α=1.5. Clusters obtained using the five clustering methods, with two rows for the IKM method, shown on the map of Perm. The left, middle, and right panels display the clustering for k=2,4,6, respectively 123 420 Annals of Operations Research (2023) 322:413–440 3.1.2 Computational experiments We use the implementation of PAM in R from Maechler (2019). Figure 2a presents our results for k=2,4,6. Loosely speaking, the clustering partitions the locations into three regions— the city center, locations to the west of the river, and locations to the north of the river. Different values of khone in on this observation further, see Fig. A1 in the Appendix for details. We revisit this method in Sect. 4, where we determine an optimal number of clusters. 3.2 Fast partitioning around Medoids 3.2.1 Background The Fast Partitioning Around Medoids (FPAM) algorithm is an improvement of the PAM algorithm where both the build and swap phases are improved (Schubert and Rousseeuw, 2019). In the initialization of the build phase, we choose the first medoid as the one that is closest to all the other locations. The rest of the initial medoids are determined successively by relating the minimum overall TDwith the already determined medoid. The swap phase is similar to PAM in the sense that both methods choose the new candidate as the one that minimizes TDfrom the existing kmedoids, and that the methods terminate if the revised TDis not reduced. The difference is that FPAM saves all the best candidates that are swapped for each medoid, whereas PAM saves only the single-best. FPAM proceeds by choosing one of the following two choices determined by the user: (i) swapping any of the k−1 medoids to the new one if TDdecreases further, or (ii) exchanging only if the swap still obtains at least the same decrease in TDas before. For details on FPAM, see Schubert and Rousseeuw (2019). 3.2.2 Computational experiments FPAM is part of the same R package as PAM (Maechler, 2019). Although FPAM is theoretically faster than PAM and capable of handling larger datasets (Schubert and Rousseeuw, 2019), in our computational experiments we do not notice any significant difference. Figure 2b presents our results for k=2,4,6, and Fig. A2 in the Appendix presents results for the other clusters. Most of the clusters are similar to PAM, except k=9andk=12 where the clusters differ on the west side of the center. 3.3 Simple and fast k-Medoid 3.3.1 Background Next, we look at the Simple and Fast k-Medoid (FKM) algorithm of Park and Jun Park and Jun (2009). FKM initializes with the kmost “centered” locations as the starting medoids. To this end, it computes a metric, vi, as follows: vi= n  l=1 Dl,i n p=1Dl,p ,i∈{1,2,...,n}. Then, we set the klocations with the smallest vivalues as our starting medoids. We assign all non-selected locations to their closest medoid. We update the medoids by searching 123 Annals of Operations Research (2023) 322:413–440 427 Table 2 Suggested optimal number of clusters for the different clustering methods of Sect. 4 PAM FPAM FKM RKM IKM α=1.1α=1.5 EM 44 434 3 ASM 33 424 3 GSM 44 424 3 4.3.2 Computational results We use B=500 for our computational experiments with the GSM.FortheRKM,weuse the same 500 reference datasets. In the thousand runs, the GSM computes k∗=2,3,4,5in 858, 134, 7, 1 of the runs, respectively; i.e., we conclude k∗=2fortheRKM.Fortheother four methods 2,Fig.5c presents the values of Gapkwith circles indicating k∗. Here, the GSM suggests k∗=3forIKM with α=1.5; however, the GSM computes k∗=4 for consistently for all the other methods. 4.4 Summary of computational results The three methods in Sects. 4.1–4.3 suggest different choices of k∗; in this section, we summarize our key results and provide a reasoning for our final choice of k∗.Table2provides a summary; here, the suggested k∗for the RKM is the one suggested in most of its thousand runs. Excluding the RKM—given its different outputs for every run—our choice of k∗is then between k∗=3ork∗=4. From the 18 instances in Table 2, 10 suggest k∗=4. Further, EM and GSM provide a strong suggestion indication for k∗=4 across all the methods except RKM and IKM with α=1.5. Thus, we decide in the favor of k∗=4 and answer question Q.2. Given k∗=4, we next seek to answer question Q.1—specifically, which method’s clustering with k∗=4 do we choose? We observe that FKM and IKM with α=1.1resultink∗=4 for all the three methods. Further, both the FKM and IKM have the same set of medoids. Thus, we use the clusters provided by the clustering methods FKM and IKM with k∗=4. Although we presented these clusters in Fig. 2, for the sake of clarity we present these again in Fig. 6a and denote them as C1(red), C2(green), C3(blue), C4(yellow), respectively. Clusters C1 and C4are the larger clusters, and both are located in the center of the city; these include 77 and 113 locations, respectively. Clusters C2and C3are significantly smaller with 23 and 24 points, respectively; these are located in the west and northeast, respectively. Some existing work on clustering algorithms within the routing literature also considers the notion of fairness. This is especially pervasive in works on wireless sensor networks, see, e.g., (Haseeb et al., 2017; Jiang et al., 2009;Zahedietal.,2016). Nallusamy et al. (2010) study a problem with multiple traveling salesman where each salesman visits the same number of locations. Such concerns are beyond the scope of our work, but can be easily incorporated by using a so-called balanced k-means clustering method (Malinen and Fränti, 2014). Then, the clusters have an equal number of locations. We conclude this section with a summary of the three methods we consider in Table 3. 2For the two IKM methods, we do not use an independent sample of 500 reference datasets as this resulted in empty clusters in the implementation in R. Thus, we sample 10 batches of reference datasets of B=50 each. 123 428 Annals of Operations Research (2023) 322:413–440 Fig. 5 aElbow Method. k∗=3forIKM with α=1.5, while k∗=4forPAM,FPAM,FKM and IKM with α=1.1. bAverage Silhouette Method. k∗=3forPAM,FPAM,andIKM with α=1.5, while k∗=4forFKM and IKM with α=1.1. cGap Statistic Method. k∗=3forIKM with α=1.5, while k∗=4forPAM,FPAM,FKM and IKM with α=1.1. Comparison of three methods to determine an optimal number of clusters, k∗.Thex-axis denotes the number of clusters, while the y-axis denotes the corresponding metric. The circles indicate k∗. For details, see Sect. 4 123 Annals of Operations Research (2023) 322:413–440 429 Fig. 6 aThe four optimal clusters. For details, see Sect. 4.4 bThe shortest tours for the four clusters. For details, see Sect. 5.5. The four optimal clusters of the 237 locations in Perm — C1(red), C2(blue), C3(green), and C4(yellow) 123 430 Annals of Operations Research (2023) 322:413–440 Table 3 Summary of three methods described in Sect. 4to determine an optimal number of clusters Trade-off Metric Criteria EM Cluster size and TD A function of TD First bend of TD ASM Fit within a luster to other clusters Average silhouette value Maximum of average silhouette value GSM Within-cluster dispersion to its expectation A function of GapkFirst ksatisfying the function 5 Answering Q.3: routing within clusters In Sects. 3and 4, we distribute our data locations into four clusters with the idea that each cluster is served by a single vehicle. In this section, we determine the optimal tour for a vehicle within a cluster by solving a TSP. To assist practitioners, we restrict ourselves to open-source and pre-implemented solvers for the TSP that are available in R. We use five methods— Nearest Neighbor, Nearest Neighbor Repeat, Nearest Insertion, Farthest Insertion, Cheapest Insertion, Arbitrary Insertion, and Two-Opt—all of which are included in the “Traveling Salesperson Problem - R package” (Hahsler and Hornik, 2020) (henceforth, “TSP-Package”). Since all of these methods are heuristics without a guarantee of finding the optimal route, we next compare the respective tours with an optimal tour. To this end, we determine the optimal tour using the so-called subtour elimination method from Miller et al. (1960), using an implementation in GAMS (Rosenthal (2007); GAMS (2020)). We employ a similar structure for this section as that of Sects. 3and 4. We first provide a short review of the heuristic methods tests for determining the routing, and then we provide computational experiments on our dataset. As the heuristics can return a different tour for each run, we repeat each of the heuristics 5000 times for our results to have a statistical relevance. Table 5summarizes our results, and we discuss this in greater detail below. Next, in Sect. 5.5 we compare the quality of the heuristic tours against an optimal routing. In Sect. 5.6 we repeat our computational experiments, but without clustering and then compare our overall tour lengths. 5.1 Nearest neighbor 5.1.1 Background The Nearest Neighbor (NN) heuristic starts with an arbitrarily chosen location. The method iterates by successively adding the nearest location, that is not yet included, to the last added location. The process repeats until all the locations are included, and a tour is formed. Despite the heuristic’s simplicity, a performance guarantee on the tour length is available, see Table 4. For details on NN, see Bellmore and Nemhauser (1968). 5.1.2 Computational experiments Two versions of NN are available in the TSP-Package: (i) the plain NN that we describe in Sect. 5.1.1, and (ii) a version where every possible location is used as the initial starting point, we denote this version as “Nearest Neighbor Repeat” (NNR). In NNR, the minimum tour length over all initial locations is returned; thus, if the number of locations is small then 123 Annals of Operations Research (2023) 322:413–440 431 Table 4 Summary of some performance guarantees for heuristics discussed in Sect. 5 Heuristic Bound Source NN 1 2lg2(n)+ 1 2Rosenkrantz et al. (1977) page 565 Insertion lg2(n)+1 Rosenkrantz et al. (1977) page 571 NI,CI 2 Rosenkrantz et al. (1977) page 573 2O n 2Hougardy et al. (2020) The Bound column denotes a bound on the ratio of the tour length of the heuristic to the optimal tour length NNR is advisable over NN. Also, NN can return tours within a wide range due to the arbitrary choice of the initial point. Since NNR returns the best possible tour available from NN at each run, there is no dispersion in its output. See the first two rows of Table 5for details. 5.2 Nearest insertion, farthest insertion, cheapest insertion, and arbitrary insertion 5.2.1 Background Insertion methods work on the principle of greedily “inserting” a location, p, to an existing edge connecting locations iand jsuch that the quantity Di,p+Dp,j−Di,jis minimized. Thus, at each iteration, the size of an existing tour size is increased by one location and exactly one existing edge is updated. The second row of Table 4provides a performance guarantee for any insertion method. We use four insertion methods as heuristics for solving our TSP. In the Nearest Insertion (NI) heuristic, we choose the location closest to the existing location in the tour. In the Farthest Insertion (FI) heuristic, we choose the location farthest to the locations in the tour. In the Cheapest Insertion (CI) heuristic, we choose the location where the cost or gain of tour length is the minimum, while in the Arbitrary Insertion (AI) heuristic, we choose an arbitrary location that is not part of the existing tour. For more details on insertion methods, see, e.g., Bentley (1992); Rosenkrantz et al. (1977). 5.2.2 Computational experiments The third to sixth rows of Table 5provide results of our computational experiments for the four insertion methods. For cluster C2the four insertion methods provide nearly the same results; the dispersion between the maximum (24.59 kms) and minimum (23.80 kms) tour lengths is less than a kilometer. For the other three clusters, we observe NI performs worse than FI; the maximum tour length of FI is less than the minimum tour length of NI. Thus, we prefer FI over NI for these three clusters. FI also performs better in a comparison with CI—for C3the worst tour of FI is nearly half a kilometer better than the best tour of CI,and for C1the worst tour of FI is only 120 meters more than the best tour of CI. The average tour length for CI is over 4.5 kms more than that of FI. Although the minimum tour lengths of AI are the best of the four insertion methods, it has a high variance reflected in large ranges of tour lengths. 123 432 Annals of Operations Research (2023) 322:413–440 Fig. 7 abefore bafter. Example of one iteration for the 2O heuristic. The edges connecting the locations a,b,c,dare changed. For details, see Sect. 5.3.1 5.3 Two-Opt 5.3.1 Background The Two-Opt (2O) method is based on Croes (1958). The method seeks to improve already existing tours by inverting edges; i.e., we remove two edges and reconnect them in the opposite order, thereby inverting the order for a part of the tour. We explain this with an example. Consider the tour 1,2,...12,1inFig.7a. Assume that we remove the two edges between locations 3,4and9,10. Now, we reconnect the locations to have two new edges— 3,9and4,10—and we invert the direction of the tour between 4 and 9. Thus, the new tour is 1,2,3,9,8,7,6,5,4,10,11,12,1, see Fig. 7b. In general, we only switch the edges if there is a decrease in the length of a tour; i.e., Da,b+Dd,c>Da,d+Db,c, with a,b,c,ddefined as in Fig. 7. We improve until the result is “two-optimal”; i.e., the tour length can not decrease further with these two-edge inversions. For a so-called “metric” TSP, where the distances satisfy the triangle inequality, Table 4provides a performance guarantee for 2O; i.e., the ratio of the length of a tour with nlocations calculated by 2O to that of an optimal tour is no more than n 2. 5.3.2 Computational experiments In the TSP-Package, 2O heuristic is initialized with an arbitrary tour that is then improved until it is two-optimal. The seventh row in Table 5presents our results. The 2O heuristic results in tour lengths of a wide range, e.g., C1has a range of almost 14 kms that is 30% of the minimum tour. This observation leads to the conclusion that 2O is strongly dependent on the initial tour. Since we already have tours from six heuristics in Sects. 5.1–5.2,wenowusethemas the initial tours for the 2O method. We denote these new schemes as 2ONN,2ONNR,2ONI, 2OFI,2OCI,2OAI. The last six rows of Table 5present these results. The cluster C2has short tour lengths already for all the heuristics with a dispersion of less than 5%. For the other methods, the mean and maximum tour length both decrease after implementing 2O; e.g., for C1the mean tour length drops from 56.21 with NN to 49.80 with 2ONN.Asthe2O heuristic is guaranteed to improve a tour, we suggest additionally using the 2O heuristic after running any other heuristic method. 123 Annals of Operations Research (2023) 322:413–440 433 5.4 Choice of the best heuristic In this section, we employ statistical tests to compare the optimal tours obtained from the various heuristics against each other. First, we determine if the tour lengths across the 13 heuristics indeed differ. We have 5000 runs for each of the four clusters for the 13 methods. To this end, we use the Friedman Rank Test with n=5000 samples and k=13 groups (Friedman, 1937). The null hypothesis for this test is that the heuristics produce identical tours; from Table 5we do not expect this hypothesis to hold. Indeed, the null hypothesis is rejected for each of the four clusters with p-values of practically zero. Thus, there is statistically significant evidence to suggest that the choice of the heuristics affects the optimal tour lengths. The next question is if a single heuristic method can be declared as the one that provides the best tour. We seek to determine this in the current section. From Table 5, we observe that 2OAI achieves the minimum tour length across all the 13 methods for C1and C4.ForC2and C3,2OAI again achieves the minimum tour length— this minimum tour length is also achieved by four and eight other heuristics for C2and C3, respectively. To validate this good performance of 2OAI, we further employ a statistical test. To this end, let μXand μYdenote the mean length of a tour found by heuristic Xand Yover 5000 runs. Then, consider the following null and alternative hypotheses: H0:μX=μY HA:μX= μY. For Y=2OAI, we test all four clusters and all the 13 heuristics, at a significance level of α=5%, and compute a z-score. For the large sample size of 5000, a normal distribution suffices instead of a Student-tdistribution. Three cases exist: (i) −1.96 <z<1.96; i.e., we have no statistical significant evidence to reject H0. (ii) z<−1.96; i.e., we have statistically sufficient evidence to reject H0, and conclude that method Xperforms better than Y, (iii) z>1.96; i.e., we have statistically sufficient evidence to reject H0, and conclude that method Xperforms worse than Y. For C1, we are in the third case for all the heuristics except 2OFI.Thus,wenexttest the hypotheses with Y=2OFI. Then, we are always in the third case; thus, we conclude that the mean tour length obtained using 2OFI is statistically shorter than any other method for C1. This trend repeats for C2as well. Analogously for C3,forY=2OAI and X= NNR,FI,2ONNR,2OFI,2OCI we are in the second case. Repeating the process with Y= 2ONNR, we are always in the third case; i.e., we conclude the mean tour length obtained using 2ONNR is statistically shorter than any other method for C3. Similarly, for C4we conclude the winner is 2OAI. To summarize, we have statistically significant evidence to conclude that, on average, the shortest tours for clusters C1,C2,C3,C4are determined by 2OFI,2OFI,2ONNR,and 2OAI, respectively. This is loosely reflected in Table 5as well—the upper limit of 95% CI of the best-performing heuristic is lower than the lower limit of the competing methods. Had we not employed a statistical test we could have erroneously concluded 2OAI as the best performing heuristic. 123 434 Annals of Operations Research (2023) 322:413–440 Table 5 Summary of the computational results of the 13 heuristic methods for TSP presented in Sects. 5.1–5.3 using 5000 runs C1C2C3C4 Mean Range 95% CI Mean Range 95% CI Mean Range 95% CI Mean Range 95% CI NN 56.21 (51.01, 62.62) (56.13, 56.29) 24.93 (24.27, 28.76) (24.90, 24.96) 41.07 (37.06, 48.20) (40.98, 41.17) 63.96 (59.57,70.05) (63.89, 64.03) NNR 51.01 (51.01, 51.01) (51.01, 51.01) 24.27 (24.27, 24.27) (24.27, 24.27) 37.06 (37.06, 37.06) (37.06, 37.06) 59.57 (59.57, 59.57) (59.57, 59.57) NI 53.78 (51.40, 54.38) (53.77, 53.80) 24.04 (23.87, 24.13) (24.04, 24.04) 42.99 (38.32, 44.31) (42.95, 43.03) 60.16 (59.30, 61.87) (60.14,60.18) FI 48.10 (46.26, 51.24) (48.07, 48.13) 23.92 (23.80, 24.14) (23.92, 23.93) 37.08 (37.01, 37.85) (37.08, 37.09) 54.49 (52.31, 57.86) (54.46, 54.52) CI 52.75 (51.12, 54.06) (52.73, 52.78) 23.94 (23.87, 24.02) (23.94, 23.94) 43.37 (38.32, 44.31) (43.32, 43.40) 58.25 (57.17, 60.22) (58.22, 58.28) AI 48.96 (45.93, 55.41) (48.93, 49.00) 24.02 (23.80, 24.59) (24.02, 24.02) 40.34 (37.01, 46.29) (40.28, 40.40) 54.92 (51.66, 59.58) (54.89, 54.96) 2O 50.60 (46.04, 60.03) (50.54, 50.65) 24.17 (23.80, 24.83) (24.16, 24.18) 40.76 (37.01, 49.81) (40.68, 40.84) 55.78 (51.82, 61.94) (55.73, 55.82) 2ONN 49.80 (46.38, 55.20) (49.75, 49.85) 24.26 (23.93, 24.47) (24.25, 24.26) 38.71 (37.01, 42.11) (38.66, 38.76) 55.49 (51.34, 59.29) (55.45, 55.54) 2ONNR 48.03 (48.03, 48.03) (48.03, 48.03) 24.27 (24.27, 24.27) (24.27, 24.27) 37.01 (37.01, 37.01) (37.01, 37.01) 53.91 (53.91, 53.91) (53.91, 53.91) 2ONI 49.86 (48.66, 54.04) (49.83, 49.90) 23.94 (23.87, 24.02) (23.94, 23.95) 39.67 (37.01, 42.60) (39.61, 39.73) 56.60 (55.06, 59.04) (56.58, 56.62) 2OFI 47.38 (46.11, 49.84) (47.36, 47.39) 23.83 (23.80, 24.14) (23.83, 23.84) 37.03 (37.01, 37.80) (37.03, 37.04) 53.95 (51.59, 55.94) (53.93, 53.97) 2OCI 49.49 (48.33, 52.91) (49.47, 49.52) 23.94 (23.87, 24.02) (23.94, 23.94) 37.48 (37.01, 43.26) (37.45, 37.51) 55.81 (53.31, 57.11) (55.80, 55.83) 2OAI 47.88 (45.89, 53.58) (47.85, 47.91) 23.92 (23.80, 24.29) (23.92, 23.92) 37.70 (37.01, 44.01) (37.66, 37.74) 53.75 (51.21, 58.57) (53.73, 53.78) All values are in kilometers, and the 95% CI columns denote the 95% confidence interval ranges 123 Annals of Operations Research (2023) 322:413–440 435 Table 6 Optimal tour lengths for the four clusters Cluster C1C2C3C4 Tour length 45.89 23.80 37.01 50.97 All values are in kilometers. For details, see Sect. 5.5 5.5 Shortest tours 5.5.1 Background As we describe above, the heuristics offer the advantage of simplicity and solutions can be obtained using open-source solvers. However these advantages come at the expense of a suboptimal tour. We now benchmark the tours computed by the heuristic methods by comparing them with the shortest possible tours. Finding an optimal tour of the TSP requires the so-called subtour elimination constraints (SECs) that eliminate any tours not involving the entire set of considered locations. Let xi,j=1 if location iis directly connected to location jin a tour, and 0 otherwise. And, let uidenote the position of node iin the tour, with i>1. Then, model 2 presents a formulation of the TSP (Miller et al., 1960). min x,u n  i=1 n  j=1;j=i Di,jxi,j(2a) s.t. n  i=1,i= j xi,j=1j=1,...,n(2b) n  j=1,j=i xi,j=1i=1,...,n(2c) ui−uj+nxi,j≤n−12≤i,j≤n(2d) u1=1(2e) ui∈{2,...,n}i=2,...,n(2f) xi,j∈{0,1}i=1,...,n;j=1,...,n.(2g) Constraints (2b)–(2c) ensure that each location is visited only once, while constraints (2d)– (2f) are the SEC from Miller et al. (1960). The objective function in (2a) minimizes the total tour length. 5.5.2 Computational experiments We solve model 2 with n=|Cj|,j=1,...,4 for the clusters we present in Sect. 3.Weuse the pre-implemented TSP solver—“Traveling Salesman Problem - Five” (GAMS, 2020)—in the modeling language GAMS; this solver is again based on the formulation by Miller et al. (1960). Table 6presents the lengths of optimal tours. From Tables 5and 6we observe that at least one of the heuristics manages to obtain the optimal tour for clusters C1,C2,andC3. For cluster C4—the largest cluster with 113 locations—none of the heuristics manage to determine the optimal tour for this cluster in any of their 5000 runs. Our preferred method 2OAI falls short by 0.5% from the optimal, however the mean tour length is significant larger by 5.6%. For cluster C1—with 77 locations—2OAI 123 436 Annals of Operations Research (2023) 322:413–440 Table 7 Analogous results to Table 5for the 13 heuristic methods without clustering Mean Range 95% CI NN 185.60 (168.02, 218.49) (185.32, 185.89) NNR 168.02 (168.02, 168.02) (168.02, 168.02) NI 188.70 (181.63, 191.54) (188.67, 188.74) FI 160.92 (157.40, 167.15) (160.87, 160.97) CI 185.96 (179.52, 189.62) (185.91, 186.01) AI 167.00 (157.25, 186.52) (166.90, 167.10) 2O 167.08 (156.35, 191.72) (166.94, 167.21) 2ONN 163.27 (156.57, 173.11) (163.17, 163.37) 2ONNR 158.27 (158.27, 158.27) (158.27, 158.27) 2ONI 174.68 (168.08, 181.00) (174.61, 174.75) 2OFI 159.80 (155.87, 167.01) (159.76, 159.84) 2OCI 172.64 (165.09, 175.10) (172.58, 172.70) 2OAI 161.05 (155.42, 182.59) (160.98, 161.12) All values are in kilometers finds the optimal tour. Our choice of the best performing heuristic, 2OFI, could not find the optimal tour and its shortest tour is 0.5% larger. However, the mean tour lengths for 2OAI and 2OFI are 4.2% and 3.3% away from the optimal, lending credence to our choice of 2OFI as a preferred method in Sect. 5.4. For cluster C2—the smallest cluster with 23 locations— five of the 13 heuristic methods find the optimal tour. The mean of our preferred method, 2OFI, falls short by less than 0.01% from the optimal tour length. For cluster C3—with 24 locations—ten of the thirteen methods find the optimal tour. 2ONNR, our preferred method, finds the optimal tour as well. Summarizing the the total tour length over the four clusters by the use of the preferred heuristics from Sect. 5.4 is in the range (161.93,162.02). The optimal tour length over the four clusters is 157.67; i.e., the best heuristics are worse by at least 4.26 kms and at most 4.35 kms. 5.6 A tour without clustering 5.6.1 Background In the preceding sections, to satisfy the needs of our particular problem’s application, we solve a TSP separately on our four clusters assuming a different vehicle serves each cluster. Next, we solve a single TSP over the entire set of locations to provide another benchmark for our four tours. Both versions of the problem have the same number of edges. If clusters are far away from each other, with few outliers close to other clusters, then the total tour length of the cluster-first route-second version is expected to be shorter than that of the benchmark version. However, if our clustering is poor and with locations closer to other clusters, we expect the benchmark version to provide a shorter tour length. This intuition serves to provide another indicator of the quality of clustering. 123