When is a heuristic admissible but not consistent?

As Russel and Norvig point out in Artificial Intelligence: A Modern Approach (the most commonly used AI textbook) it is challenging to come up with a heuristic that is admissible but not consistent. Obviously, you can select values for nodes in a graph such that the heuristic they represent is admissible but not consistent. This … Read more

AStar – explanation of name

There were algorithms called A1 and A2. Later, it was proved that A2 was optimal and in fact also the best algorithm possible, so he gave it the name A* which symbolically includes all possible version numbers. Source: In 1964 Nils Nilsson invented a heuristic based approach to increase the speed of Dijkstra’s algorithm. This … Read more

How to optimally solve the flood fill puzzle?

As a heuristic, you could construct a graph where each node represents a set of contiguous, same-colour squares, and each node is connected to those it touches. (Each edge weighted as 1). You could then use a path-finding algorithm to calculate the “distance” from the top left to all other nodes. Then, by looking the … Read more

How to implement an A* algorithm? [closed]

This article explains the basic implementation in length: The goal of this blog post is to show the fundamentals of A* through a really simple C# implementation. It also points to better implementations, more suitable for production use: As for ways to find better routes, there are plenty of C# examples around that are far … Read more

A* Admissible Heuristic for die rolling on grid

Well, I’ll add my comment here, since it is more optimal than the current highest-voted answer by @larsmans – but, I am convinced there must be something better (hence the bounty). If I multiply the heuristic with a constant, it’s no longer admissible The best I can come up with is (manhattenDistance/3)*6 + (manhattenDistance%3), where … Read more

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

You should be able to make it much faster by trading off optimality. See Admissibility and optimality on wikipedia. The idea is to use an epsilon value which will lead to a solution no worse than 1 + epsilon times the optimal path, but which will cause fewer nodes to be considered by the algorithm. … Read more