Repository navigation
fix(examples): use citizen_vision for Citizen agents in Epstein Civil… - #4141
Merged
Merged
Conversation
|
Performance benchmarks:
|
quaquel
approved these changes
Nov 20, 2026
EwoutH
added a commit
to EwoutH/mesa
that referenced
this pull request
Nov 22, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-PR Checklist
Summary
In the Epstein Civil Violence example (
mesa/examples/advanced/epstein_civil_violence),Citizenagents ignore thecitizen_visionparameter and the Citizen Vision slider in the UI, and always usecop_visioninstead.Bug / Issue
In
mesa/examples/advanced/epstein_civil_violence/agents.py,EpsteinAgent.update_neighbors()hardcodedradius=self.scenario.cop_vision(introduced in #3167). BecauseCitizeninheritsupdate_neighbors()directly fromEpsteinAgent,self.scenario.citizen_visionwas never read anywhere in the model.Implementation
Added a
visionproperty toEpsteinAgent(implemented onCitizento returnself.scenario.citizen_visionand onCopto returnself.scenario.cop_vision), and updatedEpsteinAgent.update_neighbors()to passradius=self.vision.Testing
pytest tests/examples/test_examples.py -k epsteinandruff check/ruff format --checkall passed.citizen_vision=1vs.citizen_vision=10(withcop_vision=7,rng=42, 20 steps):citizen_vision=1resulted in 580 arrested vs. 27 arrested forcitizen_vision=10.