Repository navigation
Return an empty path from A* when the goal is unreachable (fixes #1509) - #1510
Open
blessedefe4real wants to merge 1 commit into
Open
blessedefe4real wants to merge 1 commit into
blessedefe4real wants to merge 1 commit into
Conversation
When the open set was exhausted, AStarPlanner.planning only broke out of the search loop and then reconstructed a path from the goal node, whose parent was never set. It returned [gx], [gy], a one-point "path" at the goal, so callers could not tell failure from success. Return empty lists instead, as proposed for Dijkstra in AtsushiSakai#1418. Add regression tests for an unreachable goal and for start equal to goal.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
Fixes #1509
What does this implement/fix?
When the open set was exhausted,
AStarPlanner.planningonly broke out of the search loop and then reconstructed a path from the goal node, whose parent was never set. It returned[gx], [gy], a one-point "path" on the goal, so callers could not tell failure from success.[], []as soon as the open set is exhausted (same behavior as the Dijkstra fix proposed in Fix Dijkstra failure when goal is unreachable #1418 and the BFS/DFS/bidirectional A* fixes in Fix BFS crash for unreachable goal and start equal to goal (fixes #1502) #1505, Fix DFS crash for unreachable goal and start equal to goal (fixes #1503) #1506, Fix bidirectional A* crash when the goal is unreachable (fixes #1504) #1507), and document it in theplanningdocstring.Normal planning is unchanged.
Additional information
Added
tests/test_a_star_unreachable_goal.py(a separate file so it does not conflict with the A* test added in #1495):test_unreachable_goal_returns_empty_pathgets[8.0]onmasterand passes with this change.test_start_equal_to_goal_returns_single_point_pathguards the existing start == goal behavior.Full suite (
pytest tests -Werror, as inruntests.sh): 158 passed;ruff checkpasses on the changed files.CheckList