Repository navigation
fix: return False from Grid.valid_position for t outside time window - #1471
Closed
ErroujiOussama wants to merge 1 commit into
Closed
ErroujiOussama wants to merge 1 commit into
ErroujiOussama wants to merge 1 commit into
Conversation
SpaceTimeAStar.plan() still expands nodes at time_limit - 2, and generate_successors() then checks valid_position(..., time + 2), which indexes reservation_matrix at t = time_limit and raises IndexError instead of "No path found" when the goal is unreachable in time. Treat any t outside [0, time_limit) as invalid, and add a regression test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes an IndexError in SpaceTimeAStar when the goal can't be reached within
time_limit.Cause
plan()skips a node only whentime + 1 >= time_limit, so a node attime_limit - 2still gets expanded.generate_successors()then checksvalid_position(pos, time + 2), which ist = time_limit.valid_position()indexesreservation_matrix[x, y, t]→IndexErrorinstead of"No path found".Fix
Grid.valid_position()returnsFalsefortoutside[0, time_limit). This also guards the other planners thatuse it.
Test
Added
test_no_path_within_time_limit: 11x11 grid, no obstacles,time_limit=5, goal at distance 16. Before:IndexError. After: raises"No path found".