JoeJ said:
If the heuristic is not monotone (probably that's the case for me), the algorithm needs modification so it can visit nodes multiple times to make corrections.
Not sure what monotone means, but you can do a lot by extending the notion of “position”. Traditionally, it's a set of coordinates like (x, y) in 2D, but there is nothing that prevents to add eg “orientation” (looking left, right, up, or down) or “speed” or something else. In other words, (x=1, y=2, orientation=up) is a different position from (x=1, y=2, orientation=left). JPS (jump point search) does this too, adding a direction of movement, so it can store the need to explore the area further in several directions all from the same (x,y) point. Obviously, the downside is that you enlarge the graph that needs to be searched (eg adding orientation means I don't have 1 XY plane to search, but 4 such planes layered on top of each other).
JoeJ said:
I also learned there are two forms of Astar with a faster one that gives not always the shortest path
Not sure it counts as two forms, but it's about the quality of the heuristic.
If you don't give any clue how close a point is to the goal (eg heuristic is always 0), then the algorithm has no way to decide which is the better point to explore, and thus will always expand a position with the shortest traveled path, which leads to equal expansion in all directions until you hit the goal, much like what Dijkstra does.
If the heuristic is always exactly the remaining real distance to the shortest path, then forward movement on that path does not change the cost (the travelled path gets a bit larger, and the heuristic decrease with the same amount, so the sum of both doesn't change). This makes exploration away from the shortest path always increase in cost (travelled path increases, and heuristic decreases less or even increases if the travel in the wrong direction). Such off-path positions will not be explored further as there is always a position exactly at the shortest path that can be explored which has lower costs. (This is the optimal case, except it never happens, since if you can give the exact estimate at every point, you can also use that information to decide where to go, no need to compute a path with Astar then.)
If you do give a non-zero heuristic but it may be underestimated (eg ignoring impassable areas in your heuristic), you get a mix of the above. The heuristic does steer the search towards points that are more near the shortest path, but it also explores points somewhat off-path. It's less efficient than the above optimal case, but you do get the real shortest path eventually.
If your heuristic is an overestimate, then positions further away from the goal (where the heuristic is a larger fraction of the total cost) become less attractive to explore. In other words, a position near the start which is actually on the shortest path may become less attractive than a position more close the the end-goal which is not on the shortest path. Remaining distance becomes the dominant factor in deciding which point to explore further. This reduces the number of positions to explore at the cost of a non-optimal path. The amount of non-optimality is related to the amount of over-estimation, so you can control the trade-off between optimality and speed of search.
If you do want optimality, you can also improve performance of the algorithm by sorting on decreasing travelled path length within the set of positions with equal total cost. In this way, you favour exploring near the goal first for the positions with minimal total cost. This is allowed by Astar, it only says “explore a position with minimal total cost”, but if you have multiple such positions, it doesn't say which one to do first.