Skip to content

Commit

Permalink
Performance improvement (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
AryazE authored Dec 20, 2024
1 parent 4bc7048 commit 1f42140
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PathPlanning/WavefrontCPP/wavefront_coverage_path_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def transform(
is_visited = np.zeros_like(transform_matrix, dtype=bool)
is_visited[src[0], src[1]] = True
traversal_queue = [src]
calculated = [(src[0] - 1) * n_cols + src[1]]
calculated = set([(src[0] - 1) * n_cols + src[1]])

def is_valid_neighbor(g_i, g_j):
return 0 <= g_i < n_rows and 0 <= g_j < n_cols \
Expand All @@ -86,7 +86,7 @@ def is_valid_neighbor(g_i, g_j):
if not is_visited[ni][nj] \
and ((ni - 1) * n_cols + nj) not in calculated:
traversal_queue.append((ni, nj))
calculated.append((ni - 1) * n_cols + nj)
calculated.add((ni - 1) * n_cols + nj)

return transform_matrix

Expand Down

0 comments on commit 1f42140

Please sign in to comment.