Design and Implementation of the Shortest Path Navigation in Samosir District using Branch and Bound Algorithm

Samosir has a wide area and several tourist attractions, making it difficult for visitors to explore the island. Not knowing the route can make the journey less fun and waste time. In general, tourists seek to know the fastest path to a tourist location to save time and money while on vacation. As a result, we require an application that will offer directions to the shortest path. This research aims to develop a web-based application that may display a map of the shortest travel to a tourist site. This website will display a map that marks from the origin point to the destination point. The Branch and Bound algorithm is used to determine the shortest path. The Python libraries OSMnx, Folium, and NetworkX modify paths and show a route map with OpenStreetMap. The error value of the distance between the branch, bound algorithm


Introduction
Samosir Island is in the middle of the largest volcanic lake in the world, Lake Toba.In 2015, the Government designated Lake Toba as one of 10 super-priority tourist destinations in Indonesia [1].The productive land area in Samosir District (2002) reached 69,798 ha [2].The determination of Samosir as a super-priority destination has intended to boost tourism and economic development on the island.Samosir is known as the beautiful land of pieces of heaven because of its stunning natural beauty, with beautiful forests and panoramic views of Lake Toba [3].It is also home to a rich cultural heritage, with a unique blend of Batak and Dutch colonial architecture, traditional music and dance, and delicious local cuisine [4].With this local wisdom, many tourist destination developments can be presented [5].Visitors to Samosir can enjoy various activities such as climate [6], cultural tourism, natural and artificial tourism, and see the historical heritage or fascinating Batak civilization.Promotional activities are required to increase the economic level and income in the area [7].One way to promote Samosir is to improve facilities with information media [8], [9].From 2015 to 2018, the number of tourists to Samosir Island increased from local and foreign tourists.Tourists have increased more than 100% in 3 past three years, from 141,215 in 2015 to 312,925 in 2018 for local tourists and 34,248 in 2015 to 65,724 in 2018 for foreign tourists.The image of Lake Toba Tourism has a positive and significant effect on those travelling to Lake Toba, Samosir district, for a vacation [10].Therefore, activities such as tour organization, responsive tour operators, products and services offered during the trip, facilities and infrastructure in the tourist environment, advertisements, and the presence of the tourist's credibility are significant in improving the image of tourism and boosting tourist visits [11].According to tourists, Samosir is broad, so it is challenging to find tourist attractions, so tourists need to learn the path.In the era of globalization, information and communication technology that continues to grow has an impact on changes in the use of technology, which makes human work more accessible and more efficient [12].Samosir is relatively wide, a solution is needed to determine the shortest path to reach the tours that tourists will visit tourists will visit.Searching for the shortest path is needed by visitors so that they can make travel plans and visit all the destinations they want with an estimated time and a lower cost [13], [14].
The search for the shortest path can be completed by applying the Traveling Salesman Problem (TSP).TSP is a nondeterministic polynomial (NP) that is still challenging to solve in combinatorial mathematics [15].Nondeterministic polynomials indicate that no definite rule can be used to solve the problem.Therefore, many approaches have been formed to find the best solution to solve the problem [16].The TSP is a method that pays attention to the distance between cities (nodes) by passing and calculating the weight values between them and then looking for the distance or the smallest value [17], [18].
There are many problems related to finding the shortest path such as finding the exit in a maze game.Algorithms are required for the creation of an artificial intelligence-based game.The maze game is one form of game in which participants must discover a route out of the maze.The shortest path concept is implemented to find paths in a maze game.The way it works is by checking each route recursively with all possibilities.By taking the shortest path, the maze game gets a solution with a processing time of 2.16 seconds [19].In some cases, the shortest path has problems such as a circular path constraint.The main reason for needing to employ a search method by effectively locating the global least circular path is that it is inefficient and timeconsuming [20].In this research, an intelligent system that can determine the shortest path to reach the tourist destinations to be visited is urgently needed [21].
TSP can be solved with many algorithms such as Branch and bound (BnB) Algorithm.There is research that implemented the BnB approach to the travelling salesman problem with a drone.When using drones to deliver items, branches and bounds are used to discover the most optimum path.According to the study, travelling salesman challenges with branch and bound can save battery use at a rate many times faster than carrying out delivery services with drones [22].Branch and bound are designed to exploit the characteristics of the problem.Branch-and-bound is a strategy of dividing a problem into sub-problems (branching) that leads to a solution by forming a search tree structure and bounding to reach an optimal solution [23].Each node represents a set of solutions which can be partitioned into independent sets [24].Each subset in the partition is represented by a child of the node.Branch-and bound algorithm procedure repeatedly forms a search tree and a bonding process by determining the upper and lower bound in finding the optimal solution [25].Comparing exact and approximate methods the conclusion is the exact method performs and has poor worst-case behavior [26].The exact algorithm used is brute force and branch and bound, stating that branch and bound is the most efficient algorithm [27].
Based on previous research using BnB in route determination, The primary benefit of the BnB algorithm is its capacity to ensure the search for optimal solutions, BnB accomplished by trimming nodes that are unlikely to provide a solution that outperforms the best solution discovered [28].This algorithm is the most appropriate for route navigation on Samosir Island.This research will compare the distance between BnB and Google Maps by determining transportation parameters such as walking, motorbike, and car mode.A web interface will be built to help users more easily enter location coordinates and visualize the shortest path on a map that shows the distance travelled to tourist sites.The map will display instructions in the form of a line which is the path from the initial position to the destination, making it easier for visitors during the trip.

Branch and Bound
The Branch and Bound algorithm performs a search process that starts with tree initiation, takes a new mode, and checks whether the tree is empty.If the tree is empty, then the output is a solution, and the process is complete, whereas if the tree is not empty, then take a new node and make iterations for each possible solution.If the point leads to a solution, then the optimum solution is obtained, and the process is complete, but if it does not lead to a solution, then eliminate the branch, and the process is complete [29].The principle of this branch and bound algorithm is: (1) Enter the root node into the Q queue.A solution has been found if the root node is a solution node (goal node).Stop; (2) If Q is empty, there is no solution.Stop; (3) If Q is not empty, select from the queue Q node i, which has the smallest cost c(i).If there are several vertices i that satisfy, choose one arbitrarily; (4) The solution has been found if node i is a solution node.Stop.If node i is not a solution node, generate all its children.If I have no children, go back to step 2; (5) For each root node, calculate the cost c(i), where the cost of c(i) is the total cost of the root reaching node i.
From the principle, BnB can illustrated as Figure 1.From Table 1, Tele View Tower -Spirit Hill of Sibeabea is the selected node with the lowest cost to branch.Temporary bounds = 0 Step 3:   3, Tele View Tower -Spirit Hill of Sibeabea -Sidihoni Lake is the selected node with the lowest cost to branch.Temporary bounds = 0 Step 5: Do the steps according to algorithm steps 2, 3, 4. All Steps will check the least cost and work out their respective paths.At this stage, no cost is found that is smaller than the temporary cost, so the direct search scheme is described after visiting the destination.Figure 7 is a complete image of the search path using Branch and Bound.The shortest path will be visualised using OpenStreetMap.Where in the title we choose relates to the graph to determine the fastest way or the best way when a user enters the coordinates of the destination location and our current location.
The value of the difference will be determined using the root-mean-squared error (RMSE) after developing using the Python library.RMSE is a standard calculation in statistics to measure the strength of a model's performance [31].The error estimation is going to utilize Google Maps, which is a popular map technology nowadays.Formula 1 illustrates the RMSE measurement employed in the current research.
represents the actual or observed values, ŷ is the estimated value,  is the sum of all data.
There is no general rule to consider the best value of RMSE.It is returned on the same scale as the target of predicting.If the value is closer to 0, it means the result is accurate [32].
Mean Absolute Percentage Error (MAPE) is a regression model measurement metric that is used to find differences in values that can be interpreted to find errors [32].Formula 2 illustrates the MAPE measurement employed in the current research (2) represents the actual or observed values, ŷ is the estimated value,  is the sum of all data.

Research Methodology
This research will apply a branch and bound algorithm to determine the shortest distance from one place to another.Branch and bound are implemented to reduce costs and save time spent due to mistakes in choosing a location.The location of tourist objects will be taken by conducting literature studies and seeking information through social media.After the tourist object has been obtained, the longitude and latitude coordinates will be taken using Google Maps, and then these coordinates will be input into the system.The system has been built and then visualized using Google Maps and analyzed the results of distance and time obtained with BnB.The research will design an interface that makes it easier for users to enter coordinate values and receive actions to display map results using the Flask Python framework.This research will produce a prototype that applies branch and bound and then will be compared with Google Maps and get the error value using the most negligible coefficient.Figure 9 is an overview of the research that will be conducted in this study.

Results and Implementation
The tree model from OpenStreetMap builds into a web interface using the Flask framework.The web interface is built to make it easier for users to evaluate the distance results obtained.Figure 10 is a web interface built so users can more easily input coordinate values for a place.For the needs of this research, it will be tested with the most popular tourist objects in Samosir, which can be seen in Table 6.
Therefore, this study will compare the distance traveled to a place using the motorbike, and drive the car of transportation.For the experiment, the user tried to enter the coordinates of the location of the tourist object with the initial location of the tomb of King Sidabutar towards the Tele View Tower. Figure 11 is the result of visualization of the shortest path using OpenStreetMap After getting the results in a visualization like Figure 11, the next step is to do an experiment by comparing it with a Google map.This study will compare Google Maps since it is thought to be good at delivering directions owing to a huge number of users and the development of the algorithm.Visualization of the search results for the shortest path using a Google Map can be illustrated in Figure 12.The next experiment will use Figure 5 to compare the results of searching for the shortest path between OpenStreetMap and Google Maps.When comparing distance, the resulting path shows some similarities.By car drive, the distance on OpenStreetMap is 59.03 km and takes 83 minutes, while the distance on Google Maps is 57 km and takes 104 minutes.Many tourist objects can be visited and can be written in Table 2 to explain the distance required to display the shortest path map.

Discussion and Result
At this stage, experiments calculate distance by using the BnB algorithm as in the stages explained in the example of calculating distances with BnB trees.This research will calculate the distance ratio in kilometres (km) and compare BnB with Google Maps.The km distance results are obtained after getting the shortest route calculated using BnB according to the algorithm illustration above.The distance is illustrated in Table 7. From Tabel 2, the error rate is calculated only on the distance because it focuses on the shortest path related to distance.To calculate the error Distance, Google Maps subtracts the Distance between OpenStreetMap & BnB from each row.Calculating Error value using RMSE and MAPE will be described, and the test results will be discussed.The final stage is to calculate the square root of the total error value.The error will be obtained from the results of reducing the Google Maps distance to BnB, as in Table 8.Table 9 will explain the Square of Error calculation.
After getting the value of MSE, accuracy can be calculated based on Formula 1.For each mode, the sum of the Square of Error will be calculated.

Conclusions
The implementation of a branch and bound algorithm using a website framework was successful in solving the challenge of determining the shortest distance.The depiction of the shortest route findings in maps is the same in OpenStreetMap and Google Maps.This application was evaluated by comparing the acquired distances and then calculating the accuracy of the estimated findings using RMSE.The RMSE score of 3.02 and MAPE of 0.0023 was determined from the test results.Because this figure is low, we may assume that the application was effectively created and can serve as a prototype in the later more thorough development.
The following development may be executed with a mobile platform and can include a recommendation system to select which tourist attractions to visit based on your preferences.

Figure 1 .
Figure 1.Illustrated Graph of the city in Samosir District

Figure 2 .
Figure 2. Start node as first Selected Node Selected node: Tele View Tower Temporary Bound: 0 Step 2:

Figure 3 .
Figure 3. Check the lower cost and select Be next nodeTable 1. Select the lowest cost to branch Path Cost Tele View Tower -Aek Rangat Pangururan 37 Tele View Tower -Spirit Hill of Sibea-bea 19

Figure 4 .
Figure 4. Check all costs and move to the lower-cost Table 2. Select the lowest cost to branch Path Cost Tele View Tower -Aek Rangat Pangururan 37 Tele View Tower -Spirit Hill of Sibea-bea -Sidihoni Lake 45

Figure 5 .
Figure 5. Check all costs and move to the lower-cost Table 3. Select the lowest cost to branch Path Cost Tele View Tower -Aek Rangat Pangururan -Stone of the Siallagan Parsidangan Chair 80

Figure 6 .
Figure 6.Goal node selected and updated temporary bound Table 4. Select the lowest cost to branch Path Cost Tele View Tower -Aek Rangat Pangururan -Stone of the Siallagan Parsidangan Chair 80

Figure 7 .
Figure 7.The final node of Graph of the city in Samosir DistrictFrom Table5, Branch and bound will look at each cost created rather than the number of nodes traversed.When the final node becomes the destination, it will set a temporary cost value and keep checking other nodes.If all nodes have been visited, the shortest path is the one with the lowest cost.Based on Figure12, the smallest cost is to take the Tele View Tower -Spirit Hill of Sibea-bea -Sidihoni Lake -The tomb of Raja Sidabutar path, with a cost of 122.

Figure 8 .
Figure 8. Flowchart Branch and Bound

Figure 10 .
Figure 10.Web Interface of TSP in Samosir District

Figure 12 .
Figure 12.Shortest path using OpenStreetMap using BnB(a) and (b) shortest path using Google Map networks, where OSMnx is to open or interpret the shortest path.Folium is a Python library that makes it easier to visualize and manipulate points in the Python environment on top of a leaflet map.And NetworkX is a Python library used to create, manipulate, and study complex graph network's structure, dynamics, and functions.
The libraries used in this study are OSMnx, Folium, and NetworkX.OSMnx is a Python library used to download geospatial data from OpenStreetMap and model, project, visualize and analyze road

Table 6 .
Popular Tourist Object in Samosir Figure 11.Visualization shortest path in Samosir District

Table 7 .
Experiment Using Google Maps and BnB The sum of the Square of Error mode Bike is 147.37.The sum of the Square of the Error mode Car is 35.3023.The sum of the Square of Error in all modes is 182.6682.After getting the total Square of Error, the next step will be to divide the number of experimental data carried out, namely by using a car 10 times and using a bike 10 times so that the total number of experiments is 20 times.The mean square of errors of 182.6682 divided by 20 is 9.13.Next step, calculate the root of 9.13, So the Root-mean-squared error (RMSE) is 3.02.This score is a low error value, so the implementation of branch and bound has shown good performance.3.02 is a tiny percentage when compared to the error values obtained.This demonstrates that the model developed has produced small errors or is near the baseline.

Table 8
The research concludes that BnB is an efficient method for finding the shortest distance on Samosir Island.Next, this model can be deployed as a smartphone application, which is expected to help visitors save time when moving about Samosir Island.

Table 9 .
Square of Error Calculation