-
Notifications
You must be signed in to change notification settings - Fork 874
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
_PropertyGrid: Add optional neighborhood filtering to spatial methods
- Updated `select_cells_multi_properties`, `move_agent_to_random_cell`, and `move_agent_to_extreme_value_cell` methods in the `_PropertyGrid` class to include an optional neighborhood filtering feature. - Added `only_neighborhood` parameter to these methods to allow for conditional operations within a specified neighborhood around an agent's position. - Introduced `get_neighborhood_mask` as a helper function to create a boolean mask for neighborhood-based selections, enhancing performance and readability. - Modified methods to utilize NumPy for efficient array operations, improving the overall performance of grid-based spatial calculations. - Ensured backward compatibility by setting `only_neighborhood` to `False` by default, allowing existing code to function without modification.
- Loading branch information
Showing
1 changed file
with
108 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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