Bulletin of the National Research Centre (Nov 2024)
Comparative analysis of AI-based search algorithms in solving 8 puzzle problems
Abstract
Abstract Background The 8-puzzle problem is a well-known combinatorial search problem, often used to test the effectiveness of various artificial intelligence (AI) algorithms. This study aims to evaluate the performance of three AI-based search algorithms—Breadth-First Search (BFS), Depth-First Search (DFS), and A* Search—in solving the 8-puzzle problem. The algorithms were implemented in Java, and their performance was measured in terms of solution length, the number of expanded nodes, and execution time. Results Experiments were conducted on eight randomly generated instances of the 8-puzzle problem. The findings reveal that both BFS and A* Search consistently identify optimal solutions in all cases. However, BFS was found to use more memory and operate slower than A* Search. Conversely, DFS demonstrated faster execution times and lower memory usage compared to BFS but was less reliable in finding optimal or feasible solutions. The study also explored the impact of different heuristic functions on the performance of A* Search. Among the heuristics tested, the Manhattan distance heuristic was determined to be the most effective, offering the best balance between accuracy and efficiency. Conclusions In conclusion, both BFS and A* Search are effective in finding optimal solutions, with A* Search being more efficient in terms of speed and memory usage. DFS, while faster and more memory-efficient, is less consistent in producing optimal solutions. The Manhattan distance heuristic significantly enhances the performance of A* Search, making it the preferred heuristic for the 8-puzzle problem. These results suggest that A* Search, particularly with the Manhattan distance heuristic, is a highly efficient choice for solving the 8-puzzle problem, especially in contexts where computational resources are limited.
Keywords