Keywords

1 Introduction

In today’s bustling world of tourism, effective transportation services are necessary to provide a seamless travel experience. In this context, our project, BusPathFinder, aims to revolutionise the tourist travel bus industry through the usage of advanced pathfinding map algorithms. Due to the millions of tourists that arrive at Changi Airport Terminal 3 each year, it is paramount to find optimal bus routes to hotels to streamline operations and raise service standards. Our project investigates advanced pathfinding algorithms and seeks to implement them with BusPathFinder, to significantly save costs as well as improve operations in the current landscape.

The approach of this project is founded on a combination of the Google Map API and 3 pathfinding algorithms: Dijkstra Algorithm, Bellman-Ford, and the Travelling Salesperson. These algorithms will be used to calculate the shortest and most efficient routes between Changi Airport Terminal 3 and different hotels. Simultaneously, the Google Map API will be used to extract real-time data from Google to find which path will have the least amount of Electronic Road Pricing (ERP) gantries to determine the most cost-effective path.

2 Related Works or Literature

Scenic Athens is a context-aware mobile city guide for Athens (Greece) which uses an innovative algorithmic approach in an attempt to solve the Tourist Trip Design Problem (TTDP). The mobile city guide formulates the optimization problem as a Mixed Team Orienteering Problem with Time Windows (MTOPTW) and presents a metaheuristic method, such as the Iterated Local Search method to solve it [1]. The modified adaptive large neighbourhood search (MALNS) method, using the four destructions and the four reconstructions approach, was proposed in 2021 to present a solution to the family tourism route problem in Thailand [2]. To efficiently determine the shortest tourist route while visiting multiple destinations in a confined area, the study proposes a genetic algorithm (GA) based on biological evolution and natural selection [3].

R.R. Donnelley and Sons introduced MapQuest in 1996, used a proprietary bidirectional version of Dijkstra’s Shortest Path Algorithm to determine the shortest route for early website users [4]. Maposcope is a route planning app that allows a user to choose stops by typing in addresses, and launches the navigation app as the user navigates from stop to stop. Once arriving at a stop, the user will have to switch back to the app and click done before moving on to the next stop [5]. Waze is a navigation app and collects data from users’ devices about traffic conditions to suggest the most optimal routes to other users. However, Waze does not currently support navigating in lanes dedicated to public transportation, bicycles, or trucks. An active internet connection is essential for Waze to function correctly, as it relies on real-time data and map updates [6]. Badger Maps is a route planning and optimization tool designed to streamline and enhance location-based operations for businesses, and allow users to access statistics such as mileage, travel time, and full-day time of their routes [7].

3 Solution Designed

3.1 API Used

The Python client for Google Maps Services [8] empowers developers to perform various tasks, including geocoding, finding directions, obtaining direction matrices, and integrating other features of the Google Maps Platform Web Services into a Python application. To utilise the Python client for Google Maps Services, developers are required to have Python 3.5 or a later version installed on their system, in addition to possessing a valid Google Maps API key. For every Google Maps Web Service request, an API key or client ID is necessary. API keys are generated through the ‘Credentials’ page within the ‘APIs and Services’ section of the Google Cloud console.

The Python client for Google Maps Services can be installed by running the following command:

figure a

This command will ensure that the latest version of the Google Maps package is installed or update it to the latest version if it is already installed. Once the installation is complete, developers can begin integrating and using the Google Maps services within their Python applications.

The Python Client for Google Maps Services allows two primary Google Maps APIs namely Directions API and Places API utilise in the project. The Directions API [9] is a service that processes HTTP requests and provides directions between locations in either JSON or XML format. This API enables users to calculate directions for various modes of transportation. Additionally, it supports multipart directions using a series of waypoints along the route. The Directions API prioritises efficiency when calculating routes, taking into account travel elements like travel time, distance, and the number of turns to provide the most optimal and accurate directions to users. In our project, we leverage the Directions API to create routes from Changi Airport Terminal 3 to different hotels with the use of various algorithms.

The Places API [10] is a versatile service that accepts HTTP requests to retrieve location data through various methods. It provides formatted information and imagery related to establishments, geographic locations, and notable points of interest. It offers location-aware features that grant easy access to detailed location data for users. To interact with the Places API, developers can send requests in standard URL format, specifying the service endpoint, such as /place or /photo. The API accepts requests in either JSON or XML format. Specific parameters relevant to the chosen endpoint can be included in the service request to retrieve refined and relevant data for application use. In BusPathFinder, the Places API is used to extract data on ERPs. These ERPs data are then integrated into the driving routes to consider cost-effectiveness during navigation. By incorporating ERP information, our system can provide users with route options that optimise both travel time and cost, taking into account ERP charges along the way.

3.2 Dijkstra’s Algorithm

Dijkstra’s algorithm is a well-known approach for finding the shortest path between two nodes in a graph. Dijkstra’s algorithm can be utilised to determine the best path between the hotels in our bus travel operation. This can be helpful for a number of reasons such as planning bus routes, optimising travel distance, and minimising Electronic Road Pricing (ERP) gantries. The time complexity of Dijkstra’s algorithm is O(\(V^{2}\)) where V is the number of hotels on the map. Therefore, it is an effective technique to calculate the most cost-effective and quickest routes in general.

3.3 Bellman-Ford’s Algorithm

The Bellman-Ford algorithm is another algorithm for finding the shortest path between a source node and all other nodes. Unlike Dijkstra’s algorithm which is only able to account for positive weights between nodes, the Bellman-Ford algorithm takes into account negative weights, but at the cost of added time complexity of O(V * E), where E is the number of edges in the map that link to the hotels. The Bellman-Ford algorithm also potentially risks a state called Negative Cycle where the cost is forever changing when performing edge relaxation causing a scenario similar to feedback loop, where the algorithm would run forever. Bellman-Ford’s algorithm can be utilised to determine the shortest path between hotels for our scenario of bus travel operation. While slower than Dijkstra’s algorithm in terms of time complexity, the ability to find shorter paths taking into account negative weights would result in a faster travel time for our bus travel operation, in turn leading to lower operating costs.

3.4 Travelling Salesperson Problem (Using the Nearest Neighbour Algorithm as the Solution)

The travelling salesperson problem (TSP) is determining the shortest possible route to visit each city once and returning to the beginning of the tour, given a list of cities and the distances between them. One solution that resolves the travelling salesperson problem is known as the travelling salesperson algorithm.

The Nearest Neighbour Algorithm is an efficient heuristic algorithm that finds the shortest tour in a bus travel operator. It operates by developing a route iteratively, starting with one city and then appending the next city to the tour in order to minimise overall travelling distance. The algorithm terminates after all the cities have been appended to the tour. The Nearest Neighbour algorithm can be utilised to plan the shortest and most precise tour in a graph. The time complexity of the Nearest Neighbour algorithm is O(\(V^{2}\)), where V is the number of routes in the map. The Nearest Neighbour Algorithm excels at efficiently finding a relatively short tour in the Travelling Salesperson Problem, making it our choice for bus travel operators looking for practical and time-efficient route planning solutions that do not require exhaustive calculations or negative weight considerations.

3.5 Algorithm Comparison

Table 1 shows the comparison in time complexity of the 3 different algorithms implemented in the project. Because the number of edge E is bigger than the number of hotels V, the time complexity of Dijkstra’s algorithm and Travelling Salesperson algorithm is the same, while the time complexity of Bellman-Ford’s algorithm is worse. Hence Dijkstra’s algorithm and Travelling Salesperson algorithm are preferred in our project.

Table 1. Comparison table

3.6 System Diagram

Figure 1 compiles the overall flowchart of the program. The system starts with:

  1. 1.

    Loading an Excel sheet and reading the data

  2. 2.

    Creating a map object by adding hotel parkers

  3. 3.

    Calculating the distance between hotels by looping all pairs of hotels

  4. 4.

    Finding the shortest path using an algorithm

  5. 5.

    Detecting and counting ERP gantries passed

  6. 6.

    Generating data output in the following items:

    • Map.html

    • Shortest_path_table.html

    • Total_cost.html.

Fig. 1.
figure 1

Overall system flow

4 Solution Implementation

4.1 Dataset Used

In this project, we will be demonstrating a use case scenario where we have a number of customers using our travel bus operating service. The figure shows an Excel file of hotel names, their coordinates, as well as the number of customers going to those hotels (Fig. 2). Those with 0 as the number of outgoing will be excluded from the calculation.

Fig. 2.
figure 2

Excel sheet for input

5 Results and Insight

5.1 Execution of the Test Case

Once the number of customers has chosen their respective hotels, the sheet will be updated and run by Google API as well as all the 3 algorithms executed in the main.py execution file. Figure 3 shows the output of the basic Google map and Dijkstra’s map which enables the user to see the files being executed properly. It displays the process of map creation, marked location, drawing of driving route, the distance data and the number of ERP gantries passed. It is apparent that the difference between both maps is the number of ERP gantries passed during the trip. Figure 4 shows the output of the Bellman-Ford map, Travelling Salesperson map and all the necessary steps required that allow the user to track the progression of the file execution.

Fig. 3.
figure 3

Output of basic map and Dijkstra’s map

Fig. 4.
figure 4

Output of Bellman-Ford and TSP’s algorithm map

5.2 Results

Figure 5 shows the plotted location of various hotels which are our nodes in the map. The red line represents the shortest path route calculated based on the different algorithms while the blue line represents the actual path that the bus operator should be taking that is based on the algorithm.

Fig. 5.
figure 5

Map for routing path

5.3 Cost Comparison

Table 2 shows the comparison among the 4 algorithms, and it is apparent that both Dijkstra’s and Bellman-Ford’s algorithm has the least number of ERP gantries passed, the least distance travelled and the lowest cost as compared to Basic Google API and TSP. They are equal because there is no negative weightage in the graph. However, it is highlighted before that the Travelling Sales algorithm has a fully planned route back to Changi Terminal 3, whereas both Dijkstra’s and Bellman-Ford’s algorithms only take the shortest possible route to its last hotel destination.

At first glance, both Dijkstra and Bellman-Ford’s algorithms seem to be the most cost-efficient at a low cost of $34.454 but when taking into account of Travelling Salesperson’s return trip and removing its return cost of 19833 m resulting in 32448 m overall which is lower than Dijkstra and Bellman-Ford. It is evident that TSP is efficient in addition to taking into account returning to Changi for another round of ferrying customers which will, in turn, result in higher returns and profit for the bus travelling operation, particularly the real profit increases as TSP is designed to bring the cost to the minimum for a round trip and the Bus Operator would be making multiple round trips in a day.

Table 2. Cost calculation table

6 Conclusion

Given the context of this project, it is overall better to use the travelling salesperson algorithm as its advantages surpass those of Dijkstra’s algorithm and Bellman-Ford’s algorithm. It is a more effective approach to finding the shortest route between various hotel points then back to the Airport. We are able to create our bus routes more efficiently, which can also effectively save our business operating time and money. For example, we can use the Travelling Salesperson algorithm to find the shortest route back and forth from Changi Terminal 3 while evading ERP. This can help to ensure a minimum travelling cost for the bus route.

In conclusion, the Travelling Salesperson algorithm is a more viable algorithm that can be used for our travel bus operating project. We believe that in the future, the potential of this work can not only help in business operations but also provide better services to customers.