Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Applying Dynamic Weight on Theta Star Path-finding Algorithm in 2D Grid Map Le Tran Huu Phuc and Lee Ki Dong Department of Computer Engineering, Yeungnam University, Gyeongsan, South Korea (phucleth)@ ynu.ac.kr Abstract Trading off between path length and time costing in the process of path-finding is an interesting research field. Theta* is a path smoothing algorithm which finds a path with natural look – any-angle path. But this algorithm cost a quite amount of time in comparison to the original A*. In this article, we introduce an implementation way to reduce the computation time. Moreover, we also discuss about the trade-off between path-length and run-time when we apply the weight value on the Theta* formula. We also apply dynamic weight and hierarchical method to Theta* algorithm. The map is divided into two smaller clusters, and each cluster is applied different weight values (weight value is smaller than one when we are closed to the goal, and is greater than one when we are far from the goal). And from our experiment, we collected some positive data. KeyWords: path-finding Dynamic weight. I. algorithm, Theta*, Introduction Path-finding algorithm is a process of finding a path between two given points in a graph environment. This research topic is used in many fields such as: robotic, game design and network. In the past, path-finding algorithm had to deal with two problems: find a path between two cells in a graph and find the optimal shortest path. In the modern day, there is one more adding problem: find a path within the shortest time. There are several path-finding algorithms have been introduced recently [1, 6, 7, 8, 9]. For example, D eepFirst search, Breadth-First search, Best-First search, Dijkstra, A Star and the most recent path-finding algorithm - Theta Star.[9,10,11,12] All these pathfinding algorithms have their own disadvantages and advantages. While some of the algorithms focus on finding the optimal path, others focus on finding a path in the fastest way. There are many ways to reducing the computation times such as applying some different database structures: Stack, Queue, List and etc [6, 7, 8, 9]. In this paper, we apply a dynamic weight method combining with hierarchical model on the most recent path-finding algorithm – Theta* [3]. And by applying a dynamic weight method on Theta*, we decrease the computation time of the process but keep the increasing of pathlength to be small. II. Previous Work Dijkstra (DS) was introduced to the public in 1959 by Dutch researcher named Edsger Dijkstra. The algorithm focuses on finding a path of single source. By giving a start (source) cell, DS is able to find a shortest path to every cell in the map [1]. However, the high cost of computation time is a big problem of Dijkstra. A* is a generic search algorithm which is expanded from Dijkstra by applying a heuristic value. A* will explore and exam the cell with the best optimal value and add it on the list. So the computer only needs to keep space for cells with a high probability for the best value. This algorithm requires less memory with less computation time than Dijkstra. But the path found by this search process looks unnatural. The found way seems to be made from the drunken people [4]. The formula of A* is formula (1) F=G+H (1) , where G is the distance from the start cell to the current cell; and H is the distance from the current cell to the goal cell. Theta* is developed by Alex Nash in 2007. This algorithm is a postsmoothing process of the A* algorithm [5]. With the shorter path length, theta* performed even faster on the process of finding path comparing to other variants of A* such as: AP Theta*, A* PS and FD* [4]. On the other case, there are some points that we can improve in Theta*. In this paper, we will add one more comparing condition and a weight value into the algorithm in order to improve the performance of Theta*. In this case, this is an increasing on speed and options for expanding cells. Dynamic weight A* is a variant of A* algorithm [5]. In this algorithm, a new value called weight will be added to A*’s F formula (2) F=G+H (2) , where G is the distance from the start cell to the current cell; H is the distance from the current cell to the goal cell; and W is a weight value (0<W<+∞). The weight value will determine the performance of the algorithm. When the applied weight is less than 1, then algorithm concentrates on finding a best optimal path (w =0, A* will perform like Dijkstra). Decreasing the computation time of the path-finding algorithm is applying the weight value is greater than 1.[4] In our case, a main purpose is not only to focus on reducing the time computation of the process, but also to keep the increasing on pathlength as short as possible. HPA* stands for hierarchical path-finding algorithm [15][16]. This method reduces the complexity of the map by dividing the map into the smaller abstract map. These abstract maps are link together into local clusters. At each abstract map, the path-finding algorithm processes to find the optimal path. Then small clusters are grouped together to become some big clusters until the whole map is formed back. Mr. Botea proved that HPA* showed to be up to 10 times faster but the increasing in path-length is within 1%. [15] III. Main Idea In the update vertex algorithm from basic Theta*, Mr. Nash only considers about the neighbor cell with the shorter path from the current cell. [4]. But in reality, this comparing condition will eliminate some possible solutions. In the 4 directions expansion case, we call A is a current cell. Cell B and C are the north and south cells of A. D is the destination cell. If we only consider about the shorter path, we will eliminate either cell B or C, and only consider the other. [Figure 1]. In the 8 directions expansion case, we call A is a current cell. Cell B and C are the north-right and south-right cells of A. D is the destination cell. If we only consider about the shorter path, we will eliminate either cell B or C, and only consider the other. [Figure 2]. Unlike A*, in Theta*, for each loop, the computer have to check the light of sight [4] between the expanding cell with the parent of the current cell. This step will add more time to the process causing the increasing time in computation time. [Table 1]. All these previous Weighted A*, these authors applied a simple weight value from the beginning of the search to the end of the search. The weight is not dynamic when the process faces a problem in different map environments. If we apply a high value of weight on the complexity area, the process might fail dues to some hypothesis introduced by Mr. Wilt. [18] Algorithm 1 – update vertex algorithm from Nash Fig. 1 - Expansion in four directions Fig. 2 - Expansion in eight directions IV. Suggestion solution In order to solve these mentioned problems, we add an equal condition into the comparing condition. We called this algorithm compared Theta*. Moreover, we applied a dynamic weight value on Theta* with a purpose to decrease a computation time cost and also keep a small amount of increasing on path-length. In order to applying a dynamic weight value, we used HPA* method to divide the map into smaller areas, and each area is applied a specific weight value. The formula of our dynamic weight is described in the formula (3) F = G + W*H (3) , where G is the distance from the start cell to the current cell; H is the distance from the current cell to the goal cell; and W is a weight value (When the cell is closed to the start, weight value is greater than 1. And the weight value is smaller than 1 when the search is closed to the goal). In this paper, we create an application that user can pick a map containing obstacle cells, a start cell and goal cell. The app is written in Java and tested on Intel Core 2 with 2GB Ram. In the app, we create a class in Java called Node, which have some basic properties: x, y represents the longitude and latitude position of the cell in the map, color to present the status of the map such as: wall, goal, start, and path. All of the cell will be combined into a big 2D map size n times n (n is the number of cell on one row or one column). The red cells are in the map represent the impassable cells - obstacles. The blue cell is the goal while green one is the start. [Figure 3] Table 1 - The computation time between A* and Theta* Figure 3 - Example of Map V. Experiment In our experiment, we perform 3 different algorithms: Author Theta*, Compared Theta* and Dynamic Weight Theta* in different sizes of map: 20x20, 30x30, 40x40 and 50x50. Author Theta* is an algorithm that we demonstrate base on Mr. Nash’s Theta*’s pseudo code [4]. Compared Theta* is an algorithm that we add the equal condition in the comparing cell. Dynamic Weight Theta* is an algorithm that we add the weight value either 0.5 or 2.0 into the heuristic value (H value), and it also has an equal condition. All these sizes of map will have 20% of blocks, which means 20% of the cells in the 2d Map are not passable. From each case will compare the path length value, runtime value and total cell which the process went through. We tested our experiment in 5 different cases: case 1 is the 20x20 cells map with 20% obstacles/blocks, case 2 is the 30x30 cells map with 20% obstacles/blocks, case 3 is the 40x40 cells map with 20% obstacles/blocks, case 4 is the 50x50 cells map with 20% obstacles/blocks. At each case, we collect three pieces of information: the processed nodes – the number of nodes that the path-finding processes calculated, the computation time of the process from the beginning of the process to the end of the process, and the path-length of the solution path , which is count by the sum of each cells’ Euclidean distance to their parents. Figure 4 – Case 1 map size 20x20 with 20% blocks Figure 5 - Case 2 map size 30x30 with 20% blocks Figure 6 - Case 3 map size 40x40 with 20% blocks Figure 7 - Case 4 map size 50x50 with 20% blocks VI. Experiment Results & Discussion If we add a weight value which is greater than one into the calculation of F value the runtime will perform faster but the path is not optimal because of the increasing in its path-length. And if we add a weight value which is smaller than one into the calculation of F value the runtime will perform slower but the path is closer-to-optimal because of the increasing in accuracy. We found that when we apply the equal condition and the dynamic weight value is either two or zero point five, the trade off is positive. [Table 1, Table 2, Table 3, Table 4]. The path-length does not increase a lot while the run-time is considered shorter. [Figure 8. Figure 9] Although the increasing trend of trade-off rate is unstable, but there is a positive point that applying dynamic weight value still reduces the run-time of the algorithm and makes it run faster. [Table 5] The reason when a dynamic weight Theta* fails is because the relationship between h(n) – the estimate cost of getting from cell n to goal and d*(n) – the number of cells between goal and cell n is weak. [18] And by applying an equal condition on expanding neighbor cell make the slightly decreasing on path-length. Before this article, there is no research on that applying dynamic weight on Theta*. The explanation for the fact that there is a trade-off between the path-length and the computation time is stated in previous researches. [4][9][18]. In this article, we apply the dynamic weights values on different cluster-map with HPA* technique to test the affection of dynamic weighted values on Theta*. Table 2 - Result from the case 1 Table 3 - Result from the case 2 Table 4 - Result from the case 3 Table 5 - Result from the case 4 Path-length Comparision 500 400 300 200 100 0 20x20 30x30 40x40 50x50 Figure 8 - Path-length comparison between 3 algorithms Run-time Comparision 25 20 15 10 5 0 20x20 30x30 40x40 50x50 Figure 9 - Run-time comparison between 3 algorithms Processed Node Comparision 1500 1000 500 0 20x20 30x30 40x40 50x50 Figure 10 – Processed cells comparison between 3 algorithms VII. Conclusion and Future Works In future work, we will apply dynamic weight on different map areas based on the percentage of blocks based on the idea of Mr. Wilt in his article [18]. Nowadays, there are many developed path-finding algorithms. The A* is one of the most used one in many fields. Since now, there are many version of A* such as IDA*, D*, LPA* and Theta*. In the Theta* algorithm, we found a way to increase the performance by applying the weight and equal condition. As the result of our experiment, we find that our modification make the find process run faster with a less trade-off in path-length. And adding the equal condition on the exploring step makes the path to be more optimal. References 1. Cormen, Thomas H., Leiserson, Charles E., and Rivest, Ronald L. Introduction to Algorithm. Cambridge, Massachussets, USA: McGraw-Hill Companies, Inc. (2009) 2. Putri, S.E., Tulus, and Napitupulu N. Implemantation and Analysis of Depth-First Search (DFS) Algorithm for Finding the Longest Path. International Seminar on Operational Research (InteriOR) 3. Nash, A., Koenig, S. and Felner, A. Theta*: Any-Angle Path Planning on Grids. In Proceeding of the AAAI Conference on Artificial Intelligent. (2007) 4. Daniel, K. , Nash, A., Koenig, S. and Felner, A. Theta*: Any-Angle Path Planning on Grids. Journal of Artificial Intelligence Research 39 (2010) 5. SanGreozan, L., Kiss-Iakab K., Sirbu M. Comparison of 3 implementations of the A* algorithm. Creative Math. &INF. (2007) 6. Xi, C., Qi, F., Wei, L. A New Shortest Path Algorithm based on Heuristic Strategy. Proceeding of the 6th World Congress on Intelligent Control and Automation (2006) 7. Magzhan, K., Jani H.M. A Review and Evaluation of Shortest Path Algorithms. International journal of scientific & technology research volume 2 (2013) 8. Freeman, J. Parallel Algorithm for Depth-First Search. Technical Reports (CIS). University of Pennsylvania. (1991) 9. Patel, A. Variants of A*. Available online at: http://theory.stanford.edu/~amitp/GameProgramming/Variations.html (April 11th, 2015 11:00am) 10. Stein, E. ICS 161: Design and Analysis of Algorithms Lecture notes for February 15, 1996. Available online at http://www.ics.uci.edu/~eppstein/161/960215.html (April 12th, 2015 13:00pm) 11. Robin. Depth First Search. Available online at: http://intelligence.worldofcomputing.net/ai-search/depth-firstsearch.html#.VTeBh9KqpBd (April 13th, 2015 15:00pm) 12. Robin. Breadth First Search. Available online at: http://intelligence.worldofcomputing.net/ai-search/breadth-firstsearch.html#.VTeFJtKqpBc (April 13th, 2015 15:00pm) 13. Chamero, J. Dijkstra’s Algorithm As a Dynamic Programming Strategy. Available online at www.intag.org/downloads/ds_006.pdf (April 13th, 2015 15:00pm) 14. Cui, X., Shi, H. A*-based Pathfinding in Modern Computer Games. International Journal of Computer Science and Network Security, Vol. 11, No. 1. (2011) 15. Botea, A., Muller M. Near Optimal Hierarchical Path-Finding. Journal of Game Development, Volume 1. (2004) 16. Jansen, R. M., Buro M. HPA* Enhancements. AAAI Conference on Artificial Intelligence and Interactive Digital Entertainment. (2007) 17. Hansen, A. E., Zhou R. Anytime Heuristic Search. Journal of Artificial Intelligent Research 28. (2007) 18. Wilt, C., Ruml, W. When does Weighted A* Fail?. Proceeding of the Symposium on Combinatorial Search (SoCS-12). (2012)