-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A* fails to find optimal solution with admissible but inconsistent heuristic #378
Comments
lillanes
added a commit
to lillanes/petgraph
that referenced
this issue
Oct 13, 2020
The new test uses an admissible but inconsistent heuristic. The current implementation of A* fails to find the optimal solution (petgraph#378).
lillanes
added a commit
to lillanes/petgraph
that referenced
this issue
Oct 13, 2020
Fix for petgraph#378 Given an admissible but inconsistent heuristic (that is, one that for every node underestimates the distance to the goal, but may overestimate the distance from a neighbour of to the goal plus the cost of reaching that neighbour), A* may need to re-visit some non-goal nodes as it finds shorter paths to reach them. This commit forces A* to do these re-expansions. It also simplifies the implementation a bit, removing the unnecessary use of a visit map to keep track of visited nodes (the tracking is already happening due to having to keep track of the costs).
bluss
pushed a commit
that referenced
this issue
Jan 10, 2021
The new test uses an admissible but inconsistent heuristic. The current implementation of A* fails to find the optimal solution (#378).
bluss
pushed a commit
that referenced
this issue
Jan 10, 2021
Fix for #378 Given an admissible but inconsistent heuristic (that is, one that for every node underestimates the distance to the goal, but may overestimate the distance from a neighbour of to the goal plus the cost of reaching that neighbour), A* may need to re-visit some non-goal nodes as it finds shorter paths to reach them. This commit forces A* to do these re-expansions. It also simplifies the implementation a bit, removing the unnecessary use of a visit map to keep track of visited nodes (the tracking is already happening due to having to keep track of the costs).
Fixed by #379 |
teuron
pushed a commit
to teuron/petgraph
that referenced
this issue
Oct 9, 2022
The new test uses an admissible but inconsistent heuristic. The current implementation of A* fails to find the optimal solution (petgraph#378).
teuron
pushed a commit
to teuron/petgraph
that referenced
this issue
Oct 9, 2022
Fix for petgraph#378 Given an admissible but inconsistent heuristic (that is, one that for every node underestimates the distance to the goal, but may overestimate the distance from a neighbour of to the goal plus the cost of reaching that neighbour), A* may need to re-visit some non-goal nodes as it finds shorter paths to reach them. This commit forces A* to do these re-expansions. It also simplifies the implementation a bit, removing the unnecessary use of a visit map to keep track of visited nodes (the tracking is already happening due to having to keep track of the costs).
teuron
pushed a commit
to teuron/petgraph
that referenced
this issue
Oct 9, 2022
The new test uses an admissible but inconsistent heuristic. The current implementation of A* fails to find the optimal solution (petgraph#378).
teuron
pushed a commit
to teuron/petgraph
that referenced
this issue
Oct 9, 2022
Fix for petgraph#378 Given an admissible but inconsistent heuristic (that is, one that for every node underestimates the distance to the goal, but may overestimate the distance from a neighbour of to the goal plus the cost of reaching that neighbour), A* may need to re-visit some non-goal nodes as it finds shorter paths to reach them. This commit forces A* to do these re-expansions. It also simplifies the implementation a bit, removing the unnecessary use of a visit map to keep track of visited nodes (the tracking is already happening due to having to keep track of the costs).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A* using an admissible but inconsistent heuristic should find optimal paths. The current implementation seems to assume that heuristics will always be consistent, and fails to find optimal paths in some cases.
Test Case
Steps To Reproduce
See above.
Actual Results
astar
finds the pathA->D
with cost 10.Expected Results
The algorithm should find the optimal path
A->B->C->D
with cost 9.The text was updated successfully, but these errors were encountered: