-
Notifications
You must be signed in to change notification settings - Fork 928
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
fixes weakref bug in shuffe_do #2399
Conversation
if one agent removes another agent, it could still be activated by shuffle_do. This adds a unit test to spot the bug and contains the fix.
for more information, see https://pre-commit.ci
This comment was marked as outdated.
This comment was marked as outdated.
Performance benchmarks:
|
Right, this happens because an Agent can get removed within a step. Have you done any benchmarks by any chance? Edit: I still have some benchmark code here. |
Yes exactly. I ran into it with a wolf sheep version where I simply used
Not beyond the default mesa benchmarks. Feel free to rerun your original tests. My hunch is that the performance after the fix will be marginally slower, but not by much than before the bugfix. The delta with chaining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m going to approve, slow is better than buggy. Performance can be checked and optimized later.
Thanks!
if one agent removes another agent, it could still be activated by shuffle_do. This adds a unit test to spot the bug and contains the fix.
longer explanation
shuffle_do used
agents = list(self._agents.keys())
. This returns a list of hardrefs to all agents. So ifagents[0]
removesagents[1]
, it will be removed from the model, but it is still activated inshuffle_do
. we had the same bug before in shuffle in january.