a-star

How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

人盡茶涼 提交于 2019-12-03 07:11:52
问题 I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle". Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? If I were to treat each node in the graph as a game state then wouldn't that tree become quite large? Or is that just the way to do it? 回答1: A good heuristic for A-Star with the 15

A* admissible heuristics on a grid with teleporters?

旧时模样 提交于 2019-12-03 07:01:11
问题 Suppose that you have a 2D grid of cells, some of which are filled in with walls. Characters can take a step from one square to any square that is one step horizontal or vertical from it, but cannot cross walls. Given a start position and an end position, we can find the shortest path from the start position to the end position by using the A* algorithm with an admissible heuristic. In this current setup, the Manhattan distance would be admissible, since it never overestimates the distance to

questions regarding the use of A* with the 15-square puzzle

泄露秘密 提交于 2019-12-03 05:25:28
I'm trying to build an A* solver for a 15-square puzzle . The goal is to re-arrange the tiles so that they appear in their natural positions. You can only slide one tile at a time. Each possible state of the puzzle is a node in the search graph. For the h(x) function, I am using an aggregate sum, across all tiles, of the tile's dislocation from the goal state. In the above image, the 5 is at location 0,0, and it belongs at location 1,0, therefore it contributes 1 to the h(x) function. The next tile is the 11, located at 0,1, and belongs at 2,2, therefore it contributes 3 to h(x). And so on.

What can be the efficient approach to solve the 8 puzzle problem?

只愿长相守 提交于 2019-12-03 04:43:53
问题 The 8-puzzle is a square board with 9 positions, filled by 8 numbered tiles and one gap. At any point, a tile adjacent to the gap can be moved into the gap, creating a new gap position. In other words the gap can be swapped with an adjacent (horizontally and vertically) tile. The objective in the game is to begin with an arbitrary configuration of tiles, and move them so as to get the numbered tiles arranged in ascending order either running around the perimeter of the board or ordered from

Correct formulation of the A* algorithm

落爺英雄遲暮 提交于 2019-12-03 03:19:46
问题 I'm looking at definitions of the A* path-finding algorithm, and it seems to be defined somewhat differently in different places. The difference is in the action performed when going through the successors of a node, and finding that a successor is on the closed list. One approach (suggested by Wikipedia, and this article) says: if the successor is on the closed list, just ignore it Another approach (suggested here and here, for example) says: if the successor is on the closed list, examine

Is A* the best pathfinding algorithm?

青春壹個敷衍的年華 提交于 2019-12-03 01:48:43
问题 It is generally said that A* is the best algorithm to solve pathfinding problems. Is there any situation when A* is not the best algorithm to find solution? How good is A* compared to BFS, DFS, UCS, etc? 回答1: The short answer is yes, there are situations in which A* is not the best algorithm to solve a problem. However, there are a number of ways to assess what constitutes the best algorithm for finding a solution. If you are considering best in terms of performance of multiple searches from

Pathfinding on large map

为君一笑 提交于 2019-12-03 01:37:38
I'm creating a game with a 10,000 by 10,000 map. I would like for a user to be able to set a location and have the computer instantly find the best path. However, since the map is 10,000 by 10,000, there are 100,000,000 nodes, and to find this path through a conventional method such as A* or Dijkstra's would require a large amount of memory and a long time. So my question is: How can I find the best path? The algorithm I'm considering would divide the world into 100 sections, each with 1,000,000 nodes. Each section would then be divided into 100 subsections. This would be repeated until each

Why is the complexity of A* exponential in memory?

北城余情 提交于 2019-12-03 00:25:37
Wikipedia says on A* complexity the following ( link here ): More problematic than its time complexity is A*’s memory usage. In the worst case, it must also remember an exponential number of nodes. I fail to see this is correct because: Say we explore node A, with successors B, C, and D. Then we add B, C, and D to the list of open nodes, each accompanied by a reference to A, and we move A from the open nodes to the closed nodes. If at some time we find another path to B (say, via Q), that is better than the path through A, then all that is needed is to change B's reference to A to point to Q

How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

筅森魡賤 提交于 2019-12-02 20:44:35
I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle". Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? If I were to treat each node in the graph as a game state then wouldn't that tree become quite large? Or is that just the way to do it? A good heuristic for A-Star with the 15 puzzle is the number of squares that are in the wrong location. Because you need at least 1 move per square that

Fastest cross-platform A* implementation?

旧街凉风 提交于 2019-12-02 17:17:58
With so many implementations available, what is the fastest executing (least CPU intensive, smallest binary), cross-platform (Linux, Mac, Windows, iPhone) A* implementation for C++ using a small grid? Implementations Google returns: http://www.heyes-jones.com/astar.html (Most links on that site are dead.) http://www.grinninglizard.com/MicroPather (Said to be slower than Heyes-Jones'.) http://www.ceng.metu.edu.tr/~cuneyt/codes.html (Generic C++ code.) http://swampthingtom.blogspot.com/2007/07/pathfinding-sample-using.html http://opensteer.sourceforge.net/ (Interesting for games, not A*.) Stack