-
Notifications
You must be signed in to change notification settings - Fork 877
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
Updates to Epstein example #2429
Conversation
* shift to von neuman grid * update of perceived risk with round operator * introduction of enum for state * cleanup of statistics gathering to use enum * update of visualization code to be consistent with what is currently supported when drawing new_style discrete grids
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Performance benchmarks:
|
for cell in self.grid.all_cells: | ||
if self.random.random() < self.cop_density: | ||
cop = Cop(self, vision=self.cop_vision) | ||
cop.move_to(cell) | ||
klass = self.random.choices( | ||
[Citizen, Cop, None], | ||
cum_weights=[citizen_density, citizen_density + cop_density, 1], |
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.
Seems a bit complicated. Can't we just generate cop_density * cells cops and citizen_density * cells citizens, and place them randomly?
Or aren't they allowed to start at the same cell?
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.
There can be at most one agent per cell.
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.
Few minor comments, generally seems like a nice improvement.
Have you any idea about performance?
I haven't done any testing, this was really focussed on getting the proper behavior back. |
for more information, see https://pre-commit.ci
This is an update to the Epstein model to address #2423. Next to shifting to a von Neumann grid, there are several other changes.
round
. This is based on an extensive literature that shows that without it, the original Epstein results cannot be reproduced.The net result is shown below.