mesa-examples icon indicating copy to clipboard operation
mesa-examples copied to clipboard

Cholera Voronoi

Open vitorfrois opened this issue 1 year ago • 13 comments

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.

vitorfrois avatar Apr 07 '24 16:04 vitorfrois

Thanks for the PR! I will try to review it later this week.

EwoutH avatar Apr 08 '24 08:04 EwoutH

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!

EwoutH avatar Jul 04 '24 14:07 EwoutH

Hello Ewout. This semester was crazy and I got very busy. I'm finally at vacation and expect to implement both tasks.

vitorfrois avatar Jul 04 '24 14:07 vitorfrois

No worries, I know how it goes 😅.

Thanks, looking forward to it! If I can help let me know.

EwoutH avatar Jul 04 '24 15:07 EwoutH

It looks like this using the new visualization: image. The simulation values are not good as I wish, but I think it is a good example since its using different modules and components

vitorfrois avatar Jul 10 '24 21:07 vitorfrois

Looks great! I will review in the morning.

(I think the import should still be .agents)

EwoutH avatar Jul 10 '24 21:07 EwoutH

@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?

EwoutH avatar Jul 10 '24 21:07 EwoutH

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: preview

maartenbreddels avatar Jul 11 '24 13:07 maartenbreddels

@vitorfrois could you resolve the comments above if you have already answered them? Then we keep a nice overview what's done and not.

EwoutH avatar Sep 01 '24 07:09 EwoutH

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.

rht avatar Sep 08 '24 10:09 rht

I will update this example with the visualization for voronoi space included in https://github.com/projectmesa/mesa/issues/1895.

vitorfrois avatar Sep 10 '24 10:09 vitorfrois

@EwoutH @rht i did not fully understand the use of the new ABM & DEVSimulator. Should I've been using one of them here?

vitorfrois avatar Sep 10 '24 10:09 vitorfrois

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.

EwoutH avatar Sep 10 '24 10:09 EwoutH