mesa-examples
mesa-examples copied to clipboard
Cholera Voronoi
Implements agents, model and server graph visualization according to #112 issue.
This example uses the VoronoiGrid, which inherits from the DiscreteSpace, as proposed in https://github.com/projectmesa/mesa/pull/2084.
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:
- [ ] For the visualisation, I think it would be nice to use the new Jupyter Visualization. See the Visualization Tutorial.
- [ ] A little description in the readme about the novelties, in this case the use of
VoronoiGrid.
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.
It looks like this using the new visualization: . The simulation values are not good as I wish, but I think it is a good example since its using different modules and components
Looks great! I will review in the morning.
(I think the import should still be .agents)
@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.
Preview:
@vitorfrois could you resolve the comments above if you have already answered them? Then we keep a nice overview what's done and not.
Other than the comments, everything else LGTM. The Voronoi visualization can be deferred to a separate PR, since this PR has been hanging in limbo for a while. @maartenbreddels's demo uses D3, but maybe for now we could use Matplotlib, and still be pure Python? There is https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.voronoi_plot_2d.html. There is also a way to do it for Altair.
I will update this example with the visualization for voronoi space included in https://github.com/projectmesa/mesa/issues/1895.
@EwoutH @rht i did not fully understand the use of the new ABM & DEVSimulator. Should I've been using one of them here?
Awesome, looking forward to it! Note that we just updated the visualisation tutorial to the new API.
i did not fully understand the use of the new ABM & DEVSimulator. Should I've been using one of them here?
No, I don't think it's needed here. It's mostly useful if you want to do things outside discrete timesteps.
90% of models don't need DEVS. For the 10% that do it's a total game changer.