Skip to content

Commit

Permalink
Fix add_cost bug
Browse files Browse the repository at this point in the history
Returned matrix was completely wrong if we ended up fixing costs so they are above 1
  • Loading branch information
spudde123 committed Feb 3, 2021
1 parent 776ca67 commit bc5052e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions MapAnalyzer/Pather.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ def add_cost(position: Tuple[float, float], radius: float, arr: ndarray, weight:
arr[disk] = np.where(arr[disk] == 1, initial_default_weights, arr[disk])

arr[disk] += weight
if safe and np.any(arr < 1):
if safe and np.any(arr[disk] < 1):
logger.warning(
"You are attempting to set weights that are below 1. falling back to the minimum (1)")
arr = np.where(arr[disk] < 1, 1, arr[disk])
arr[disk] = np.where(arr[disk] < 1, 1, arr[disk])

return arr

0 comments on commit bc5052e

Please sign in to comment.