Simulated Annealing Algorithm for Determining Travelling Salesman Problem Solution and Its Comparison with Branch and Bound Method

ABSTRACT


A. INTRODUCTION
Travelling Salesman Problem (TSP) is a problem where a person must visit some places, starting from one city to others. The places visited can only be passed precisely once and then go back to the starting city. TSP is often used to solve the distribution activities of a company. The company will undoubtedly try to keep costs to a minimum to get the maximum possible profit and minimize distribution activities costs. (Lalang et al., 2018) modeled a distribution problem of vehicle routing with time windows and occasional drivers. Then this problem is expanded by the existence of multi-depots (Making et al., 2018). Minimizing the cost of distribution activities can be done by finding the shortest route because distance positively affects distribution costs. The closer the distance traveled, the less the cost of the distribution activity.
TSP problems can be solved by an exact method or approach method, namely the heuristic or metaheuristic method. In solving TSP with the exact method, TSP is modeled as Integer Linear Programming (ILP). ILP is classified into four based on the number of decision variables with integer values. One of which is Mixed Integer Linear Programming (MILP), where not all decision variables are integer. Then the MILP problem can be solved by one of the exact methods. One of the exact methods applied to accomplish MILP problems is Branch and Bound (B-and-B) (Jünger et al., 1995).
Simulated annealing (SA) (Zhan et al., 2016;Botsali & Alaykiran, 2020) is one of the oldest metaheuristic methods and is one of the first algorithms to have the ability to keep away from minimum local traps. SA uses the analogy of cooling and freezing metal into a crystal structure with minimal energy. In principle, the liquid molecules have enormous energy at big temperatures, so it is easier for these molecules to relocate toward other molecules. Then a decrease in temperature will slowly form a stable state with a minimum energy level (Zhan et al., 2016).
The mechanisms in SA avoid seeking for solutions to rapidly centre around local minimums. During the search, SA is unique in that it accepts not only a better solution but also a worse solution but decreases its probability. The likelihood of a worse solution being taken is set by two parameters, namely the temperature and the distinction between the current solution objective function values and the neighboring solutions. The purpose of taking a worse solution is to prevent convergence of the search to the local minimum. At larger temperatures, the chances of receiving a worse solution were much higher. However, as the temperature becomes less, the chances of accepting a worse solution decrease (Bayram & Şahin, 2013).
The simulated annealing algorithm is still developing for some TSP problems, which are also evolving. For example: improving the SA algorithm in TSP (He et al., 2018); SA based on symbiotic organisms optimization algorithm for TSP (Ezugwu et al., 2017); enlarging listbased SA algorithm to large-scale traveling salesman problem (Wang et al., 2019); SA with a nest box for solving large-scale TSP problem (Yang et al., 2020).
This research aims to accomplish the TSP optimization problem with the simulated annealing algorithm and then compare the results of this approximation method with the Branch and Bound method. We choose to use the SA algorithm because of its advantage avoiding the trap at a local minimum. We use the B-and-B method for the exact algorithm because the B-and-B method produces an exact optimum value. Then the results of the SA algorithm and the B-and-B method are compared in terms: total distance traveled, number of iterations, and execution time. The computation results showed that the SA method could be used to solve TSP problems with a good approach value.

B. METHODS 1. Travelling Salesman Problem (TSP)
The Travelling Salesman Problem (TSP) can be viewed as a problem in determining Hamilton's cycle on a graph, namely the cycle that passes through all vertices of the graph exactly once (Fournier, 2009). TSP is a situation of deciding the most effective route or minimizing the distance that a person will travel to visit exactly once every predetermined place starting from one place and going back to that starting place. The following is the formula for the TSP problem (Benhida & Mir, 2018). The function that will be optimized in TSP is: , with constraints: a. Each place is visited exactly once, ∈ {0,1}, ∀ = 1,2, … , ; ∀ = 1,2, … , where, = the amount of places to be visited, = distance of place i to place j, = the order of place i in the tour. and with the decision variables:

= {
1, when there is a route from place to place 0, else

Simulated Annealing (SA) Algorithm
The working principle of this algorithm is that at high temperatures the liquid particles have a high energy level so they are relatively easy to move to other particles, then when the temperature is lowered the particles will arrange themselves to find a stable arrangement with a minimum energy level (Rere et al., 2015). The flow of the SA algorithm is shown in Figure 1.
The following is the SA algorithm step-by-step flow. a. The initial data is given in x and y coordinate points, so it is necessary to compute the distance between places using the Euclidean formula: = √( − ) 2 + ( − ) 2 where: = the distance between place i and place j.
= the x coordinate at place i. = the x coordinate at place j. = the y coordinate at place i. = the y coordinate at place j. b. Determine the initial route with the random function and calculate the length of the initial route f( ). c. Determine the initial control parameter 0 and the parameter α which will be used to derive control parameters. d. Run the iteration by swapping two places from the initial route randomly by generating two random numbers in the range (0,n) then calculating the length of the new route f( ). e. Evaluating the new route. If the length of the new route is less than the length of the initial route, define the new route as the initial route. f. If the length of the new route is greater than the length of the initial route, a random number (r) is generated at the interval (0,1) and calculate the probability p: = control parameter. Then do the criteria test: 1) If r < p then route is accepted, define new route as current route. 2) If r > p then the new route is ignored.
g. Cooling schedule, = • −1 , 0 < < 1, = 1,2, … where is a constant to derive the control parameter. h. The iteration stops when the termination criteria have been met, that is when the iteration maximum has been reached. i. Return to step 4 if the termination criteria have not been met, as shown in Figure 1.

Data
A solution to TSP problems carried out using the SA method and the B-and-B method. There are three TSP issues that will be resolved. The first problem consists of 25 places, the second problem consists of 40 places, and the third problem consists of 68 places. The data used are data obtained from random functions with coordinates and which indicate the location of the places in Cartesian coordinates. The data are presented in Table 1.

Case I
In case I, several testings were done with the parameters as presented in Table 2. After doing several experiments using different parameters and iterations, the smallest approach distance is 394.34 km with 15000 iterations, and it takes 14 seconds. The route with the smallest distance obtained is presented in Figure 2.

Case II
In case II, several experiments have been done using parameters such as Table 3. From the experimental results using different parameters and iterations, the smallest approach distance is 587.61 km with 50000 iterations, and it takes 1 minute 15 seconds. The route with the smallest distance is presented in Figure 3.

Case III
In case III several experiments were carried out using the parameters as shown in Table 4. After conducting several experiments using different parameters and iterations, the smallest approach distance is 727.90 km with 3000000 iterations, and it takes 1 hour 18 minutes 42 seconds. The route with the smallest distance obtained is shown in Figure 4.

Solution using Branch and Bound (B-and-B)
In this scientific paper, LINGO 17.0 software is used to find TSP solutions using B-and-B with the syntax as follows.

Case II
In case II there are 40 places and 631296 iterations are carried out. After being executed using LINGO 17.0 software, the minimum distance is obtained which is 546.448 km and it takes 3 minutes 5 seconds. The output using the LINGO 17.0 is presented in Figure 6.

Case III
In case III there are 68 places and 546168160 iterations are carried out. After being executed using LINGO 17.0, the minimum distance is obtained, namely 669.449 km and it takes 44 hours 44 minutes 41 seconds. The output using the LINGO 17.0 is presented in Figure 7.  Table 5 compares the total distance, the number of iterations, and the time required by the two methods used, the exact method, namely Branch and Bound (B-and-B), and the approximation method, namely SA. The B-and-B method produces the optimal distance, while the SA method produces the approximate distance. In case I, the percentage difference between the distance generated using the SA method with the B-and-B method is 0%, in case II it is 7% and in case III it is 8%, as shown in Table 5  Based on Table 5, it can also be seen that the number of iterations and the time required by the SA method is much less and faster. For case I, the number of iterations of the SA method is 8 times less and the time required is 2 times faster than the B-and-B method. For case II, the number of iterations of the SA method is 12 times less and the time required is 2 times faster than that of the B-and-B method. For case III, the number of iterations of the SA method is 182 times less and the time required is 34 times faster than that of the B-and-B method.

D. CONCLUSIONS AND SUGGESTIONS
The results showed that the SA method could be used to solve TSP problems. But just like other metaheuristic methods, SA only accomplishes it using an approach so that it gets good results, but it cannot be determined that SA has the most optimal results, but the time needed by the SA method is faster than the B-and-B method. From the three cases that have been resolved using the SA method above, it can be seen that for case I where there are 25 places, the SA method has a difference of 0% from the B-and-B method, while the time needed by the SA method is 2 times faster than method B -and-B. For case II where there are 40 places, the SA method has a difference of 7% from the B-and-B method with the time needed 2 times faster than the B-and-B method. For case III where there are 68 places, the SA method has a difference of 8% from the B-and-B method but the time required is 34 times faster than the Band-B method.
ACKNOWLEDGEMENT I would like to thank my colleagues and students involved in this research. I also thank the mathematics department of FMIPA IPB which has provided financial assistance for this research.