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

Ensure grasspatches info is only collected if gras is true #181

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

quaquel
Copy link
Member

@quaquel quaquel commented Aug 28, 2024

the datacollector allways includes grasspatches even if grass is False. This is breaking (the proposed changes to agent storage in Model)[https://github.com/projectmesa/mesa/pull/2251#issue-2488519860].

The underlying problem is that Model.get_agents_of_type now raises a KeyError if type does not exist. I think this is desirable behavior becuase errrors should not be passed over in silence. But this requires fixing the wolf sheep example as done here.

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think this actually can be a single dict comprehension but let's go for readability here.

@EwoutH EwoutH merged commit 1d67252 into projectmesa:main Aug 28, 2024
3 checks passed
EwoutH pushed a commit to EwoutH/mesa-examples that referenced this pull request Sep 20, 2024
…sa#181)

the datacollector allways includes grasspatches even if grass is False. This is breaking (the proposed changes to agent storage in Model.

The underlying problem is that Model.get_agents_of_type now raises a KeyError if type does not exist. I think this is desirable behavior becuase errrors should not be passed over in silence. But this requires fixing the wolf sheep example as done here.
@quaquel quaquel deleted the wolfsheep branch November 11, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants