-
Notifications
You must be signed in to change notification settings - Fork 131
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
Cholera Voronoi #118
base: main
Are you sure you want to change the base?
Cholera Voronoi #118
Conversation
Thanks for the PR! I will try to review it later this week. |
Hi Vítor! I'm really sorry, we really dropped the ball here. The example looks great, and is really useful. I would like to have it in, there are two points that would be nice to have:
Are you interested in picking one or both up? Otherwise I could do it. Sorry again, it's really appreciated! |
Hello Ewout. This semester was crazy and I got very busy. I'm finally at vacation and expect to implement both tasks. |
No worries, I know how it goes 😅. Thanks, looking forward to it! If I can help let me know. |
Looks great! I will review in the morning. (I think the import should still be |
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.
Okay, a few small comments already. In the morning I will fire it up for a more thorough review.
@quaquel you might also be interested in reviewing this, since it’s one of the first external implementations of the experimental cell space.
|
||
The model has two agents: people and pumps. Pumps can infect people and neighbor pumps. People start as susceptible, can be infected by pumps and recover or die, according to a simple SIR model. Each cell has only one pump and is connected to neighbor cells according to Voronoi's diagram. The model aims to investigate how fast actions oriented by Voronoi diagrams can prevent disease spread. | ||
|
||
## How to Run |
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.
Thanks for writing a Readme! Don’t forget to update this section
examples/cholera_voronoi/agents.py
Outdated
self.recovery_chance = recovery_chance | ||
|
||
def step(self): | ||
if self.state == REMOVED: |
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 have a hunch this whole section could be simpler. Let me check tomorrow.
examples/cholera_voronoi/agents.py
Outdated
people = [ | ||
obj | ||
for obj in self.cell.agents | ||
if isinstance(obj, Person) and obj.state is not REMOVED |
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.
Shouldn’t agents be just removed from cell.agents instead of having a state “removed”?
examples/cholera_voronoi/agents.py
Outdated
for obj in self.cell.agents | ||
if isinstance(obj, Person) and obj.state is not REMOVED | ||
] | ||
for person in people: |
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.
If Python reads like English it’s awesome! 👌🏽
examples/cholera_voronoi/agents.py
Outdated
self.model.infected_pumps += 1 | ||
|
||
# If cases in total is too high, fix pump | ||
cases = sum(1 for a in people if a.state is INFECTIOUS) |
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.
Can you do len() instead of sum()?
@rht @Corvince (and maybe even @maartenbreddels) do you think we can display the cell space easily in Solara? And in this case the actual Vonoroi space? With some color scale depending on the number of infected agents per cell? |
Short answer, yes: https://py.cafe/maartenbreddels/solara-ipyreact-voronoi :) I guess you want to customize it a bit, but that's just some fiddling with js examples. |
Implements agents, model and server graph visualization according to #112 issue.
This example uses the
VoronoiGrid
, which inherits from theDiscreteSpace
, as proposed in projectmesa/mesa#2084.