A greedy heuristic for the capacitated minimum spanning tree problem

Abstract This paper develops a greedy heuristic for the capacitated minimum spanning tree problem (CMSTP), based on the two widely known methods of Prim and of Esau–Williams. The proposed algorithm intertwines two-stages: an enhanced combination of the Prim and Esau–Williams approaches via augmented and synthetic node selection criteria, and an increase of the feasible solution space by perturbing the input data using the law of cosines. Computational tests on benchmark problems show that the new heuristic provides extremely good performance results for the CMSTP, justifying its effectiveness and robustness. Furthermore, excluding the feasible space expansion, we show that we can still obtain good quality solutions in very short computational times.


Introduction
The Capacitated Minimum Spanning Tree problem (CMSTP) can be defined as the design of a minimum cost tree which spans over all vertices of an undirected graph G, so that the sum of demands of every main subtree does not exceed a given capacity Q. The CMSTP plays an important role in the design of backbone telecommunications networks, as well as in distribution, transportation, and logistics. Gavish (1991), formulated telecommunication network design problems as CMSTPs. In addition a CMSTP solution provides a lower bound on the capacitated vehicle routing problem (CVRP) defined on G (Toth and Vigo, 1995).
The CMSTP can be divided into two categories based on whether the weights of vertices are identical or not. The first is the homogeneous CMSTP where all vertices have the same weight. The second is the heterogeneous CMSTP where different vertices have different weights. When the weights of all vertices are equal to unity the problem reduces to finding a minimum cost rooted spanning tree in which each subtree contains at most Q (the capacity) vertices; this unit demand case is usually referred to as the CMSTP in the literature (Oncan and Altinel, 2009). The general homogeneous problem can be transformed into a unity problem by dividing the weights of the vertices and the capacity Q by the common vertex weight. In our work, we propose an algorithm for the CMSTP when the weights of all vertices are equal to unity.
The CMSTP is a difficult combinatorial optimization problem. It has been shown to be NP-hard even in the case of unit demand (Papadimitriou, 1978); thus, the solution of the CMSTP with exact methods is very time consuming and even impossible even for moderate size instances (Ruiz et al, 2015), and as a result heuristics are widely used in practice. Due to the importance of the problem, there is a vast literature that addresses modelling and solutions aspects of the CMSTP. Several mathematical formulations and exact algorithms have been proposed for the CMSTP. Exact algorithms are based on branch and bound and dynamic programming methods. The existing exact algorithms only solve small scale CMSTPs or find lower bounds on the optimal solution-see e.g., Chandy and Russell (1972), Chandy and Lo (1973), Gavish (1982), Gouveia and Paixao (1991), Malik and Yu (1993), Hall (1996), Han et al (2002), Gouveia and Martins (2005), and Uchoa et al (2008).
Early heuristics based on the greedy paradigm are those of Esau and Williams (1966)-the most widely known and the one used as a benchmark in computational tests-and the unified algorithm of Kershenbaum and Chou (1974). More sophisticated heuristics have been developed by Amberg et al (1996), Sharaiha et al (1997), Patterson et al (1999), Ahuja et al (2001Ahuja et al ( , 2003 and Souza et al (2003), that employ techniques such as local search. The problem with these approaches is that in each iteration the new solution does not always improve the objective function, thus they are quite slow in converging to high quality trees. More recent metaheuristics include: (a) the hybrid ant colony algorithm of Raimann and Laumanns (2006) that solves the CVRP and applies an implementation of Prim's algorithm to obtain a feasible CMST solution; (b) the work of Martins (2007) that proposes an enhanced version of the second order (SO) algorithm originally described by Karnaugh (1976), one of the first metaheuristics applied for the CMSTP; (c) the tabu search heuristic of Rego et al (2010) introducing dual and primal-dual RAMP algorithms, (d) the filter and fan algorithm by Rego and Mathew (2011); and (e) the biased random-key genetic algorithm (BRKGA) of Ruiz et al (2015).
The enhancements of construction algorithms, play a great role in producing very good solutions to complex classical combinatorial problems such as the VRP and the CMSTP. Altinel and Oncan (2005) reported that to improve the accuracy of the Clarke and Wright (1964) heuristic for the VRP problem without harming its speed and simplicity is an interesting question and proposed a new enhancement of the savings criterion; the new method was both fast and very accurate. Bruno and Laporte (2002) suggested a simple enhancement of the Esau-Williams heuristic for the CMSTP removing the longest edge on the path linking vertex j to the root against removing the first edge in the path linking j to the root of the tree according to the Esau-Williams heuristic. Oncan and Altinel (2009) proposed three parametric enhancements of the Esau-Williams heuristic for the CMSTP: In the first enhancement they parametrized the classical saving criterion of Esau-Williams; in the second enhancement, they added a term expressing the asymmetry between two vertices with respect to the central vertex. In the third enhancement the authors took into account the fact that CMSTP is a combination of the minimum spanning tree and of the bin packing problem; so they added a third term that included demand information over the joining process. Battara et al (2012) justified the popularity of the Esau-Williams heuristic in practice and the motivation behind its enhancements, recognizing the problem that the best metaheuristic implementations outperform classical heuristics but they require long computational times and many are not very easy to implement. Additionally, they claimed that the parameters involved in the Esau-Williams enhancements improve their competition with the best metaheuristics and proposed a genetic algorithm procedure to tune efficiently a three-parameter enhancement of the latter algorithm. The proposed evolutionary approach produced high quality results without affecting its simplicity in a limited amount of computing time.
In our work we proposed a two-stage algorithm for the CMSTP: First, motivated by the results of Oncan and Altinel (2009), we develop a new greedy function that measures the cost of linking vertex j to the partial -under construction-capacitated minimum spanning tree. This composite greedy function combines the effects of several metrics and the heuristic follows Prim's optimization framework. Then we increase the space of feasible solutions by perturbing the input data using the law of cosines, in order to explore multiple and possibly not easily reachable solutions by applying the previous framework. Computational tests on benchmark problems from the literature show that the new heuristic provides extremely good performance results for the CMSTP. Furthermore, excluding the feasible space expansion, we show that we can still obtain good quality solutions in very short computational times.
The remainder of the paper is organized as follows: Section 2 provides an overview of the steps embedded within the proposed heuristic, the selection criteria, and the cosinebased engine for the expansion of the feasible solution space. Section 3 offers the computational results while the conclusions are summarized in Section 4.

The heuristic and the feasible solution space expansion mechanism
Let G = (V, E) be an undirected graph, where V = {0, 1, 2, …, n} is the vertex set, with 0 as the root vertex, and E = {(i, j): i, j e V, i = j} is the edge set. A nonnegative weight or demand q i is associated with each vertex i[V-{0}, and a length or cost c ij is associated with each edge {i, j}. Given a spanning tree, any subtree linked to the root by a single edge is called a main subtree. Given a vertex i[V-{0} the main subtree containing j is called the subtree of j. We refer to the first vertex in the subtree of j as the gate vertex g(j) of the subtree of j.
Our work is based on the pioneering algorithms of Prim (1957) and Esau-Williams (1966). Prim's algorithm starts only with the root vertex in the spanning tree and at each iteration, the vertex whose distance or cost to any vertex already in the tree is minimal is brought into the tree. Esau-Williams's algorithm, on the other hand, starts with each vertex and the root vertex in separate components; then they define a tradeoff function C ij (different from c ij ) as the minimum cost of connecting the component containing vertex i to the root vertex minus the cost of connecting vertices i and j. Thus, at each stage, the algorithm finds C i*j* = max(C ij ) and brings in line (i*,j*), forming a new component without exceeding the capacity constraint.
The algorithm we propose requires the definition of the ''shortest point'' for a vertex i, i.e., the root vertex or a vertex in the tree that has the minimum direct distance with i and the linking is feasible (does not violate the capacity constraint); we denote the shortest point for vertex i by s(i). Furthermore, let C s(i) i be the value of the composite selection criterion that is associated with the selection of vertex i; C s(i) i will be properly defined later in this section.
Given all the previous definitions and notation, the steps of the new heuristic are as follows: PEW Heuristic Step 0 Initialization. Read n, c ij , Q V i, j = 0, …, n Step 1 Select the vertex nearest to the root to start the spanning tree Step 2 Find the feasible vertex j that minimizes the composite criterion C s(j) j : Step 2a Select the shortest point s(j) and calculate C s(j) j Step 2b Repeat step 2a for all vertices not linked to the spanning tree Step 2c Select vertex j with the minimum C s(j) j Step 3 Link the selected vertex j to its shortest point on the current spanning tree and update the spanning tree; set vertex j as a tree vertex Step 4 If there are vertices remaining to be linked to the spanning tree, return to Step 2; otherwise proceed to Step 5 Step 5 Terminate; get sequence of vertices in each subtree and total distance The overall loop is performed until all vertices have been assigned to the spanning tree. The solution procedure is straightforward adopting a very simple execution mechanism. However, it is based on new criteria for vertex selection and linking, which are motivated by the minimization function of the new enhancement heuristics for the CMSTP.

Selection criteria
To form our new composite selection function, we combine six metrics through a weighted linear relationship.
The first metric is C s(j)j 1 defined as the direct distance of vertex j to the subtree s(j) (the shortest point of vertex j), namely c s(j)j .
The second metric is C s(j)j 2 defined as the direct distance of vertex j to the gate node (or vertex) of s(j), that is c jg(s(j)) .
The third metric is C ij 3 i.e., the distance of the shortest point s(j) to the gate vertex of s(j), named c g(s(j))s(i) .
The fourth metric is C ij 4 defined as the inverse of the following parameterized saving expression (Oncan and Altinel, 2009), adjusted for the component case with one vertex inside: C s(j)j 4 = (c dj -a9c s(j)j ) -1 , where d is the root vertex and a is the positive tree shape parameter. This formula is the inverse of the parameterized extension of the savings formula of the Esau-Williams heuristic because our composite vertex selection criterion ensures that a vertex j selected for subtree connection will minimize the selection criterion.
The fifth metric is motivated by Paessens (1988) who introduced a new term to the savings expression of the Vehicle Routing Problem solution algorithm, that was the asymmetry between customers i and j with respect to their distances to the depot. Oncan and Altinel (2009) used the same term to extent the first enhancement of the Esau-Williams heuristic for the CMSTP. The inverse of the asymmetry is included in our selection criterion by the metric: The sixth metric involves the notion of a ''moving vertex'' m, i.e., a vertex that is second, third, fourth, etc. in distance from the root vertex; this is to capture additional information about the spatial distribution of vertices in a space expanding mechanism logic embedded within the selection criteria. In the first iteration of the metric calculations, the moving vertex is the second in distance vertex nearest to the root; in the next iteration, m is the third in distance and so on so forth.
Consequently, the calculation of this new metric involves an iterative scheme based on the moving vertex m. The criterion is defined as C s(j)j 6 = |c j,f -b9c j,m |, where b is a tuning parameter taking values between 0 and 1, f is the nearest to the root vertex, and the final value of C s(j)j 6 is the minimal one along all possible m's examined.
To summarize, we can state the following: • Criteria C 1 , C 2 and C 3 are simple distance-based functions we define to link vertex j to other points of the network.
• Criterion C 4 is the inverse of the parametrized extension of the saving formula of Esau-Williams proposed by Oncan and Altinel (2009).
• Criterion C 5 is the inverse of the third term within the second enhancement of the saving formula of Esau-Williams proposed by Oncan and Altinel (2009).
• Criterion C 6 is a new composite criterion we propose for the first time.
Now we can define the overall vertex selection criterion which accounts for all previously defined metrics. We use a simple linear relationship to merge the effects of the six metrics. The greedy function that measures the cost of connecting vertex j to its shortest point s(j) in the minimum spanning tree under construction is denoted as C s(j) j . This composite greedy function is defined as follows: In ( Note that the weights b 1 , b 2 , b 3 , b 4 , b 5 , b 6 define the relative importance of the associated metric in the selection of vertex j. It is important to note that a  M. Kritikos and G. Ioannou-A greedy heuristic for the capacitated minimum spanning tree problem determinant factor for the effective deployment of the proposed greedy heuristic is the selection of appropriate weights and the metrics' parameters embedded in the composite greedy function. The tuning of these parameters requires statistical experimentation. We discuss the determination of the intervals of weights and parameters of the metrics in the computational results section. The composite greedy function allows for the exploration of a large solution space, and thus, we expect the criterion by itself to lead an unsophisticated method to solutions of high quality; such expectations are proven by the application of the proposed heuristic to literature benchmarks. Furthermore, the diversity of the individual selection metrics can capture the specific and the unique characteristics of each problem instance, thus leading a simple greedy approach to evolve in a manner similar to that of meta-heuristics. Hart and Shogan (1987) suggested the perturbation of the problem's data and the reapplication of the relevant algorithm as one way to improve the performance of a heuristic. Thus, instead of applying a heuristic only to the original data, they claimed that improvements can be achieved when several minor perturbations of the data are used as starting points for the algorithm's execution. The best of the solutions obtained can then be implemented using the original data.

Mechanism for feasible solution space expansion
Based on this observation, to improve the performance of any proposed greedy heuristic for the CMSTP, we can proceed to data perturbation by altering the distance between the root vertex and the second in distance vertex nearest to the root. We opt to move this particular vertex because it is included in the selection criterion of our algorithm (C s(j)j 6 ); furthermore, according to Kershenbaum and Chow (1974), the second nearest feasible neighbor leads to significant benefits for the overall solution.
To perturb the CMSTP data, we move the second in distance nearest to the root vertex B cyclically by an angle h, while also changing its distance from vertex O (which is the root vertex 0) as shown in Figure 1. Thus, first B moves to B 0 and then B 0 moves to D, and using the law of cosines we can calculate the distance DE (where E is any random vertex) as follows: so the angle BOE is known. Because the angle BOD is known by the cyclic move of vertex B, we conclude that \DOE = \BOD -\BOE. The law of cosines also states: As a result, the distance between new location of B (which is D now) and the random vertex E is known. Our mechanism of feasible solution space expanding calculates all the new distances between the vertices of the graph and the new location of the second nearest to the root vertex. Our proposed greedy algorithm implemented to new distance matrix producing a new spanning tree under the capacity restriction. Then, we can recalculate the cost of the solution using the real distance matrix. The final results should lead to improvements in the objective function value for data sets, as per the claim of Hart and Shogan (1987).
The sequential steps of this expanded procedure, denoted as PEW-PLC heuristic, are shown in Figure 2. Note that PLC refers to the recalculation of distances after the perturbation via the angle rotation.

Computational results
The proposed heuristic in both its versions (PEW and PEW-PLC) has been implemented in FORTRAN 90, using the Fortran PowerStation 4.0 compiler. The computational experiments have been performed on a PC with an Intel Core i5 processor. The heuristics were tested on the classical unit demand data sets from the OR-Library (http://people.brunel. ac.uk/*mastjjb/jeb/info.html). The tc instances in this library have the central vertex in a central position with respect to the other ones. The te instances have the central vertex in a corner with respect to the other ones. The problems include ten instances with fully connected graphs of 40-vertices with arc capacities 3, 5 and 10, and ten instances with fully connected graphs of 80-vertices with arc capacities 5, 10 and 20. Thus, a total of 60 problem instances are examined solved. One requirement in our approach is the determination of the intervals of weights b 1 , b 2 , b 3 , b 4 , b 5 , and b 6 in the selection formula, as well as the setting of parameters a and b in the metrics of the cost function. In our experiments, the weights b 1 , b 2 , b 3 , b 4 , b 5 , and b 6 are chosen within the interval [0.0, 1.0] in an incremental manner with increment set to 0.5. Parameters a and b are set in the same manner.
The experimental results of the proposed greedy heuristic PEW are reported in Tables 1, 2, 3 and 4. The test problems reference in OR Library and its capacity are shown in columns one and two of each table. The optimal known (literature) solutions for each instance or the relevant lower bound if the optimal is not reached are listed in the third column, while the best solutions produced by PEW are reported in the fourth column (distance of the capacitated minimum spanning tree and moving vertex in parenthesis). In the fifth column, we provide the number of capacitated spanning trees produced up to point when the best solution is obtained. The sixth column of each table offers the CPU time in seconds that PEW requires to find the best solution.
The seventh column depicts the percentage deviation of each instance with respect to the best known solution; they are calculated according to the formula 100 9 (z -z*)/z*, where z is the objective value obtained by proposed heuristic and z* is the best known value reported in the literature that is listed in the third column. The eighth column entitled EW3 reports the percentage deviation of the best enhancement of Esau-Williams heuristic according to Oncan and Altinel (2009) from the best-known solutions. The ninth column presents the CPU times in seconds of the Oncan and Altinel (2009) heuristic. Note that we cannot directly compare computational times between our approach and that of Oncan and Altinel (2009) since different processors were used and no scaling has been applied. In the last column, we indicate instances for which our heuristic outperforms (or is equal to) the best enhancement of Esau-Williams with '*'. The solution derived by our heuristic is equal to or better than those of the best enhancement heuristic in more than 50% of the data sets. From Tables 1, 2, 3 and 4, it is evident that PEW improves upon classical heuristic approaches and provides results that are comparable to the ones produced by more computationally expensing metaheuristics. Tables 5, 6 and 7 further support this statement. Specifically, Table 5 shows the average improvement in the solution quality for each set of instances examined versus the fraction of the CPU time required to reach this improvement -the effectiveness of PEW is obvious.
In Table 6, we compare the PEW heuristic to the results obtained by EWBF3 and EW3 reported by Battara et al (2008) and Oncan and Altinel (2009) respectively. The EWBF3 is an enhancement of the Esau-Williams heuristic towards a singlestage genetic search procedure for finding the best parameter values of the savings expression for the three-parameter EW enhancement (EW3) of Oncan and Altinel (2009). Also, Oncan and Altinel (2009) determine the best values of the parameters using a brute force evaluation procedure within given intervals. The overall average percentage deviation from the best known solution values is 1.60% for our proposed PEW (2016) heuristic compared to 2.39% for the EWBF3 (2008) and to 2.07% for the EW3 (2009). Also, our approach reduces the computational time considerably. For example, the total time to find the best solution for all problems is 4088.85 s against the 18585.00 s of EWBF3 and 7026.32 s of EW3 respectively.
In Table 7, we continue the comparison of PEW with previously developed approaches. The ''Imp (%)'' columns reports the average percentage improvement of a heuristic over Esau-Williams for each data set. We summarize the results obtained by consideration the following solution approaches when applied to the same data sets: (a) the enhancement of Battara et al (2008) Table 7, it is clear that PEW outperforms all approaches apart from EWR, which is a more complex metaheuristic.
As an overall conclusion, we can state that PEW outperforms heuristics and is close to metaheuristics with respect to solution quality since it examines a larger portion of the solution space than simple heuristics. Note that the total number of runs using one moving vertex without using the expanding mechanism is 3 8 = 6561. The total number of runs for the recent enhancement heuristic (Oncan and Altinel, 2009) is 7600 runs. Using all the 39 vertices (the nearest Figure 3 Best CMST for te40-5(3). neighbor vertex not included), the number of capacitated spanning trees produced is 6561 9 39 = 255879 for the 40-vertex instances, and 6561 9 79 = 518319 for the 80-vertex instances. The total CPU time in seconds spent to perform all iterations of our heuristic per instance is approximately 70 s for the 40 vertex instances and 1000 s for the 80 vertex instances.
The experimental results of the proposed PEW-PLC heuristic are reported in Tables 8, 9, 10 and 11. The PEW-PLC heuristic was compared to the results obtained by EW3. Also, for each test set, the average percentage improvement with respect to EW are reported. The test problems are shown in columns one and two, the best known solution for each instance is listed in the third column. The Esau-Williams solutions are reported in the fourth column. The fifth column depicts the average percentage deviations of the EW3. The sixth column presents the best solution produced by the proposed PEW-PLC heuristic. The seventh columns reports the average percentage deviation of each instance from the best solution. In the last column we present the average percentage deviation of the PWE-PLC heuristic from the Esau-Williams heuristic. The final column shows a ''*'' whenever our result is better than EW3 and a ''**'' whenever our result is the best known to-date.
When we apply the PLC procedure, a crucial point is the determination of the increments of the angle in the space [0, 3.14] and of the length of the change interval in the space [0.1, 2.2], both with an increment of 0.5. This means that we permit the distance of the moving vertex m to vary between 0.1 9 c m,0 and 2.2 9 c m,0 , where c m,0 is the actual distance of the moving vertex m to the root vertex 0. As a result the total number of iterations to cover all possible parameter values is 35, while the number of CMST's produced is 6561 9 35 = 229635.
When the increments reduce or/and the intervals increase the required computational effort becomes excessive. On the other hand, we often may obtain better solutions. Note that as Figure 4 Best CMST for te80-4(5). moving vertex m, in our implementation of PLC, we use the best according to PEW applied before.
In Table 12, we provide some aggregate comparison between the results derived by PEW and PEW-PLC vis-à-vis the best enhancements of the EW heuristic. Specifically, we report the percentage deviation from the optimal solution or lower bound of EW3, PEW and PEW-PLC heuristics aggregated across the individual data sets with identical capacities. From the results, it is obvious that PEW-PLC provides the best solutions overall, followed by PEW and EW3. This result was expected since Table 12 aggregates the results of Tables 1, 2 , 3, 4, 8, 9, 10 and 11. Subsequently, we compare the results of our approaches to existing optimal solutions reported by Ruiz et al (2015) and Osman and Atikson (2009).The comparison is provided in Table 13. The optimal solutions or lower bounds are reported in the second column from Ruiz et al (2015) for the data sets mentioned in the first column. The solutions produced by Osman and Atikson's heuristic (2009) and PEW-PLC are shown in the third and fourth column, respectively.
From Table 13, it is evident that PEW-PLC reaches the optimal solution or provides a new best solution with respect the cost of the spanning tree for all data sets examined. Specifically, the results indicate that we produce a new best literature solution for data sets te40-5(3) and te80-4(5); the structure of the resulting minimum spanning trees is shown in Figures 3 and 4, respectively. Table 14 provides an aggregate comparison of the results obtained using the metaheuristic EWR of Battara et al (2012) and the ones reached by PEW-PLC. The results indicate that our simple heuristic outperforms a metaheuristic in 3 of the 4 groups (indicated by an asterisk in the last column of Table 14) as well as in the global average. This is an indication of the unique strength of our approach.
Finally, in Tables 15 and 16 we have further explored the contribution of each metric in the derivation of the best solution obtained by our proposed heuristic PEW. They show the values of the b i weights in the respective best solutions found.
By examining the percentage of instances in each data set where the relevant weights were non-zero, and aggregating instances with b i 's taking values of 0.5 and 1.0, it becomes clear the our proposed metric (C 6 ), together with the Essay-Williams metric modified by Oncan and Altinel (C 4 ) are the two dominant metrics in terms of contribution to the objective function value in the best solutions found. On the opposite side (and quite expected we would add) are metrics C 1 and C 2 , which are simple distance-based criteria that could be eliminated. Finally, although C 3 is a distance-related metric, it is associated with the shortest point and gate vertex that we have introduced in our approach and provide significant value to the solution quality.

Conclusions
In this paper we have developed a new heuristic with two versions to solve the capacitated minimum spanning tree problem. Our approach, which is based upon Prim's (1957) and Esau and Williams (1966) heuristics for the minimum spanning tree and capacitated minimum spanning tree problems respectively, utilizes several metrics exploiting the interrelationships between vertices introduced and dictates the sequence in which the vertex linking takes place.
The second version of the new method allows the expansion of the feasible solution space using the Law of Cosines Procedure (LCP). This procedure allows the search to be Table 15 Non-zero b i 's from metrics C 1 -C 6 in the best solution of PEW displaced to other regions of the feasibility set, producing additional spanning trees. The paper also emphasizes the importance of a good choice of weights and parameters in the cost function criterion. The proposed algorithm is simple and easy to implement and to apply to capacitated minimum spanning tree problems with minimal computational effort. It performs very well on test problems from the literature, providing high quality solutions with respect to the cost of the capacitated minimum spanning tree within short computational times. The new method increases remarkably the accuracy of the classical heuristic of Esau-Williams and its enhancements for the capacitated minimum spanning tree problem, without increasing much the complexity and the speed because the new search effort.
The results presented indicate that the heuristic provides solutions that are competitive with the best solutions of metaheuristics for a large number of literature problems. Comparison with optimal solutions show that the new approach reaches near optimal solutions for most problem instances. Our purpose in developing the new method was not to compete with metaheuristics but to produce a simple and powerful heuristic that can match some metaheuristics in terms of solution quality.
In terms of further research we can state the following: (a) better exploitation of information gathering during the linking phase about the structure of the CMST problem; (b) the placement of vertices; (c) the weights and the parameters of the selection criteria in the heuristic; (d) the solution for variants of the large scale CMST problems; and (e) the use CMSTP approaches for vehicle routing; all are worth pursuing research directions.