1. Introduction
The traveling salesman problem (TSP) [
1] involves finding the shortest tour distance for a salesperson who wants to visit each city in a group of fully connected cities exactly once. TSP is a discrete optimization problem. It is a classic example of a category of computing problems known as NP-hard problems [
2,
3]. Although there are simple algorithms for solving these problems, these algorithms require exponential time, which makes them impractical for solving large-size problems. Hence, metaheuristic optimization algorithms are usually applied to find good solutions, although these solutions may not be optimal.
The TSP problem can be used for modeling several wireless sensor network (WSN) problems [
4]. In a WSN, the sensors are located in a sensing field to collect data, and send these data to the source node wirelessly. There are two ways to increase the lifetime of the sensors: first, by reducing the size and number of data [
5,
6], and second, by reducing the cost of transferring the data [
4]. For example, a good solution to the TSP problem can also be considered an efficient diffusion method for reducing the transferring cost.
Many methods, including heuristic or hybrid, have been proposed for solving the TSP, but most of them were unable to avoid the stagnation problem, or they may have obtained good solutions but took a long execution time to do so [
7]. In this work, we enhanced the ant colony optimization (ACO) algorithm based on imaginary ants that can fly. These ants deposit their pheromones with neighboring nodes while flying by injecting them from a distance. This allows not only the nodes on a good path to receive some pheromones but also the neighboring nodes. The algorithm also makes use of the 3-Opt algorithm to help avoid reaching a local minimum.
The main contributions of this work on the flying ACO (FACO) algorithm are as follows: (1) proposing a dynamic neighboring selection mechanism to balance between exploration and exploitation, (2) reducing the execution time of FACO by making flying ants equal to half the ants, and (3) adapting the flying process to work with the TSP problem.
The main contributions of this work in general are as follows: (1) obtaining better-quality solutions, (2) significantly reducing the execution time, and (3) avoiding getting stuck at a local minimum.
The paper is organized as follows: in
Section 2, we discuss related works;
Section 3 presents the proposed enhancement of the ACO algorithm;
Section 4 shows the experimental results; and the conclusion is shown in
Section 5.
3. Dynamic Flying Ant Colony Optimization (DFACO) Algorithm
Many methods, including heuristic or hybrid, have been proposed for solving the TSP, but most of them cannot avoid the stagnation problem, or they may obtain solutions but take a long execution time [
7]. In this work, we proposed an enhanced ACO algorithm that finds better solutions in less computation time and a robustness mechanism to avoid the stagnation problem.
In this section, we present a modification of the FACO algorithm to make it suitable for the TSP problem in the following ways.
First, the number of neighboring nodes in FACO were static based on the experiments. However, the number of neighbors in DFACO that may be injected with pheromones was dynamic. The number of neighboring nodes varied in each iteration depending on the quality of the best solution reached so far compared to the other solutions. The number of neighbors was determined based on two cases: (1) If the best solution is slightly better than the other solutions, then the number of neighbors should be large to obtain more neighbors. This encourages exploration in future iterations. (2) If the best solution is considerably better than the other solutions, then the number of neighbors should be small to encourage exploitation in future iterations.
The number of nearest neighbors,
NS, was determined according to the following formula:
where
Lgb(
t) is the tour length of the global best tour at time
t,
Lkl(
t) is the tour length of ant
k at time
t,
S is the number of ants, and
N is the number of cities.
The second modification aimed to reduce the execution time. If all ants were flying ants (such as in FACO), we would have to determine many neighbors for each node on the best path, which may substantially increase the execution time. Therefore, here, only 50% of the ants were flying ants and the rest were normal walking ants.
The third modification aimed to encourage exploration at early stages and exploitation at later stages. This modification is similar to the FACO algorithm, but we modified the process to adapt it to the TSP problem. The intuition behind this is that at early stages, we have no idea about the location of the best solution in the search space; and therefore, ants should be encouraged to explore the search space. On the other hand, at later iterations, the region that contains the best solution is more likely to have been located, and therefore, exploitation should be encouraged. This was achieved by injecting pheromones at farther neighbors during early iterations, while at later iterations, we injected the pheromones at only the nearest neighbors. Equation (6) was used to determine the amount of pheromone for each neighbor.
As a final modification, we embedded the 3-Opt algorithm in FACO to reduce the chances of getting stuck at a local minimum.
Figure 4 shows the complete algorithm in detail, and
Figure 5 illustrates the process of the DFACO algorithm.
4. Experimental Results
We conducted empirical experiments using TSP datasets from TSPLIB [
34] to test the performance of the proposed algorithm. We performed three comparisons. First, we compared DFACO combined with the 3-Opt algorithm with ACO combined with the 3-Opt algorithm using 24 datasets. Second, we compared DFACO performance with PACO-3Opt [
7] in detail using 21 datasets. Third, we compared DFACO performance with five more recent methods [
8,
9,
18,
20,
21] using 24 datasets.
We compared the methods with respect to the average of the best solutions for all runs (Mean), the standard deviation (SD), and the best solution for each run (Best). We also compared DFACO, PACO-3Opt, and ACO with respect to execution time in seconds.
Table 1 lists the parameter values of both algorithms, which were empirically determined. These values were also used to compare DFACO to all of the other methods.
Both ACO and DFACO were run for 100 iterations (Z) and each dataset was used in 30 independent experiments.
Table 2 lists the comparison results for DFACO and ACO. The first column shows the name of the TSP datasets. The second column shows the best-known solution (BKS) as reported on the TSPLIB website (
http://comopt.ifi.uni-heidelberg.de/software/TSPLIB95/STSP.html). Bold font indicates the best results.
Table 2 indicates that DFACO was able to find the BKS in all runs for 16 datasets with zero SD, while ACO was able to find the BKS in all runs for 15 datasets with zero SD. However, the proposed method obtained the BKS in all runs faster than ACO for four datasets (bier127, ch130, kroB150, and kroA200), while ACO obtained the BKS faster than DFACO for two datasets (eil101 and ch150).
Figure 6 shows the average of the best solutions, while
Figure 7 presents the execution time in seconds for all datasets in the table. As can be seen in
Figure 6, DFACO was better than ACO in terms of the average of the best solutions and obtains a shorter distance on average for all datasets. Also, DFACO was faster than ACO by 54.7 s for all datasets.
For the remaining eight datasets, DFACO found the best Mean solution for seven datasets, while ACO found the best Mean solution for one dataset (fl1400). These results were found to be statistically significant according to the Wilcoxon signed-rank test, with N = 8 and p ≤ 0.05. A t-test was used to see if the results were statistically significant in the 30 independent runs for each one of the eight datasets. The results indicate that the proposed method’s results were statistically significant for four out of eight datasets, namely, for the datasets rat575, rat783, rl1323, and d1655. We did not perform a t-test for the remaining 16 datasets because both algorithms achieved the BKS.
For the second set of comparisons, we followed the comparison method of PACO-3Opt [
7]. In the PACO-3Opt experiments, the TSP datasets were divided based on the problem size into small-scale and large-scale datasets (the size of the large-scale datasets was between 400 and 600). The small-size datasets used 10 TSP datasets (shown in
Table 3), and for the large size, 11 TSP datasets were used (shown in
Table 4).
Table 3 presents the experimental results of comparing DFACO with PACO-3Opt for small-scale TSP instances. The table shows the best, worst, and average values of both algorithms for comparison. Boldface text indicates the better results for both algorithms. The results reveal that the DFACO obtained the optimum distances for all datasets in terms of best, worst, and average values. Meanwhile, PACO-3Opt obtained the optimum distances for only six datasets, one dataset, and one dataset in terms of best, worst, and average, respectively. With regard to execution time,
Table 3 shows that DFACO significantly reduced the execution time and obtained better results faster than PACO-3Opt for all TSP instances.
Table 4 presents the results of comparing DFACO with PACO-3Opt for large-scale TSP instances. It also shows the best, worst, and average values of both algorithms for comparison. Boldface text indicates the better results for both algorithms. The results reveal that DFACO obtained better distances for all datasets in terms of best, worst, and average values, except for rat783. With regard to execution time,
Table 4 shows that DFACO significantly reduced the execution time and obtained better results faster than PACO-3Opt for all TSP instances except for rat783, where DFACO was faster than PACO-3Opt but did not obtain better results.
Table 5 shows the third type of comparison between DFACO and five recent methods [
5,
6,
7,
8,
9]. In this set of experiments, we used 24 TSP datasets and 30 independent runs.
The table reveals that the proposed algorithm achieved the best results for all datasets except one (rat783), for which Deng’s method [
9] achieved the best result. Also, DFACO found the BKS for 18 datasets, and for one dataset (rat575), it found an even better solution than the BKS.
Figure 8,
Figure 9,
Figure 10,
Figure 11,
Figure 12,
Figure 13,
Figure 14,
Figure 15,
Figure 16,
Figure 17,
Figure 18,
Figure 19,
Figure 20,
Figure 21,
Figure 22,
Figure 23,
Figure 24,
Figure 25,
Figure 26,
Figure 27,
Figure 28,
Figure 29,
Figure 30 and
Figure 31 show the average of the best solutions for each TSP instance obtained by different algorithms. These figures visualize the results of the 24 datasets shown in
Table 5. From these figures, it is clear that DFACO’s performance was better than that of the other algorithms for most datasets except rat783.
Table 6 compares DFACO with five recent methods with respect to the percentage deviation of the average solution to the BKS value (
PDav) and the percentage deviation of the best solution to the BKS value (
PDbest) in the experimental results.
PDav and
PDbest were calculated using Equations (9) and (10), respectively:
The results revealed that the values of
PDav and
PDbest for DFACO were better than those for the other methods on all datasets except one (rat783), for which Deng’s method [
9] was better.