Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deterministic behavior in move_agent_to_one_of with selection="closest" #2118

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add small TODO
  • Loading branch information
EwoutH committed Sep 6, 2024
commit 1be462e6ca36d029b764ae5349d4e2f4ece40925
1 change: 1 addition & 0 deletions mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ def move_agent_to_one_of(
elif selection == "closest":
current_pos = agent.pos
# Find the closest position without sorting all positions
# TODO: See if this method can be optimized further
closest_pos = []
min_distance = float("inf")
agent.random.shuffle(pos)
Expand Down
Loading