a-star

A* Algorithm for very large graphs, any thoughts on caching shortcuts?

天涯浪子 提交于 2019-12-02 17:14:11
I'm writing a courier/logistics simulation on OpenStreetMap maps and have realised that the basic A* algorithm as pictured below is not going to be fast enough for large maps (like Greater London). The green nodes correspond to ones that were put in the open set/priority queue and due to the huge number (the whole map is something like 1-2 million), it takes 5 seconds or so to find the route pictured. Unfortunately 100ms per route is about my absolute limit. Currently, the nodes are stored in both an adjacency list and also a spatial 100x100 2D array. I'm looking for methods where I can trade

Correct formulation of the A* algorithm

寵の児 提交于 2019-12-02 16:50:18
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 its cost. If it's higher than the currently computed score, remove the item from the closed list for

boost implicit graph and astar_search_no_init

五迷三道 提交于 2019-12-01 00:43:03
I want to implement robot's path planning subsystem. I'm going to use A* from boost library. I need implicit graph. I have to use astar_search_no_init function (It is written in documentation). Unfortunately, I can't find an example of using astar_search_no_init and implicit graph. I found "A* Graph Search Within the BGL Framework". The author uses astar_search for implicit graph. He tries to add vertex inside examine_vertex method of visitor. But it is impossible in boost 1.49 because graph is passed as constant reference in this method. Can anyone help me? Snargleplax I have just come up

What are some good methods to finding a heuristic for the A* algorithm?

可紊 提交于 2019-11-30 21:49:54
You have a map of square tiles where you can move in any of the 8 directions. Given that you have function called cost(tile1, tile2) which tells you the cost of moving from one adjacent tile to another, how do you find a heuristic function h(y, goal) that is both admissible and consistent? Can a method for finding the heuristic be generalized given this setting, or would it be vary differently depending on the cost function? Amit's tutorial is one of the best I've seen on A* (Amit's page) . You should find some very useful hint about heuristics on this page . Here is the quote about your

Manhattan distance in A*

…衆ロ難τιáo~ 提交于 2019-11-30 20:10:06
I am implementing a NxN puzzle solver using A* search algorithm and using Manhattan distance as a heuristic and I've run into a curious bug (?) which I can't wrap my head around. Consider these puzzles (0 element being blank space): (initial) 1 0 2 7 5 4 8 6 3 (goal) 1 2 3 4 5 6 7 8 0 The minumum number of moves to reach solution from initial state is 11. However, my solver, reaches goal in 17 moves. And therein lies the problem - my puzzle solver mostly solves the solvable puzzles in a correct (minimum) number of moves but for this particular puzzle, my solver overshoots the minimum number of

boost implicit graph and astar_search_no_init

徘徊边缘 提交于 2019-11-30 19:04:24
问题 I want to implement robot's path planning subsystem. I'm going to use A* from boost library. I need implicit graph. I have to use astar_search_no_init function (It is written in documentation). Unfortunately, I can't find an example of using astar_search_no_init and implicit graph. I found "A* Graph Search Within the BGL Framework". The author uses astar_search for implicit graph. He tries to add vertex inside examine_vertex method of visitor. But it is impossible in boost 1.49 because graph

Can Astar visit nodes more than once?

我的梦境 提交于 2019-11-30 15:53:11
问题 I've been reading wikipedia's Astar article. In their implementaion, they check each node if it's in the closed set, and if so they skip it. Isn't it possible, that if the heuristic is admissible but NOT consistent, that we might need to revisit a node twice (or more) in order to improve it's f value? This is the relevant code for each neighbor in neighbor_nodes(current) if neighbor in closedset //This if condition bothers me continue tentative_g_score := g_score[current] + dist_between

Can Astar visit nodes more than once?

别等时光非礼了梦想. 提交于 2019-11-30 15:22:05
I've been reading wikipedia's Astar article . In their implementaion, they check each node if it's in the closed set, and if so they skip it. Isn't it possible, that if the heuristic is admissible but NOT consistent, that we might need to revisit a node twice (or more) in order to improve it's f value? This is the relevant code for each neighbor in neighbor_nodes(current) if neighbor in closedset //This if condition bothers me continue tentative_g_score := g_score[current] + dist_between(current,neighbor) if neighbor not in openset or tentative_g_score < g_score[neighbor] came_from[neighbor] :

Unable to implement A Star in java

一笑奈何 提交于 2019-11-30 14:49:52
I've been trying all day to get this algorithm up and running, but I cant for the life of me. I've read many tutorials on the net, and source code in AS3, javascript, and C++; but I cannot adapt what I am seeing to my own code. I have created an AStar class that has a nested class named Node. The map is a 2D array named MAP. The biggest problem that I am having is pulling the F value in the pathfind function. I have implemented the F = G + H, my problem is the actual AStar algorithm. Can someone please help, this is how far I've got as of yet: import java.util.ArrayList; public class AStar {

A* search algorithm in PHP [closed]

此生再无相见时 提交于 2019-11-30 13:30:01
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Does anyone have an implementation of the A* algorithm in PHP? I know that wikipedia has a pseudocode and a link to a C++ one, but I can't seem to find one already written in PHP. I am also looking for an efficient written A* algorithm 来源: https://stackoverflow.com/questions/5112111/a-search-algorithm-in-php