Add support for drawing discrete grids
Addresses #2377. This code needs refinement (e.g., duplication of agent potrayal code from voroinoi grid).
@Corvince, @EwoutH any pointers on how to develop and test this type of thing?
I am pretty sure the code is correct, but if I try to run one of the examples with it from the command line, it errors (because it uses the wrong mesa version).
Performance benchmarks:
| Model | Size | Init time [95% CI] | Run time [95% CI] |
|---|---|---|---|
| BoltzmannWealth | small | 🔵 -0.8% [-2.2%, +0.7%] | 🔵 +0.5% [+0.3%, +0.7%] |
| BoltzmannWealth | large | 🔵 -1.4% [-1.8%, -1.0%] | 🔵 -2.5% [-3.0%, -1.9%] |
| Schelling | small | 🔵 -1.6% [-1.9%, -1.4%] | 🔵 -1.4% [-1.6%, -1.1%] |
| Schelling | large | 🔵 -0.9% [-1.9%, -0.0%] | 🟢 -5.2% [-6.3%, -3.9%] |
| WolfSheep | small | 🔵 -1.0% [-1.3%, -0.8%] | 🔵 -0.9% [-1.1%, -0.7%] |
| WolfSheep | large | 🔵 +0.8% [-0.0%, +1.8%] | 🔵 +0.3% [-1.7%, +2.7%] |
| BoidFlockers | small | 🔵 -1.0% [-1.7%, -0.2%] | 🔵 -0.9% [-1.8%, +0.1%] |
| BoidFlockers | large | 🔵 -1.1% [-1.8%, -0.4%] | 🔵 -1.2% [-1.8%, -0.7%] |
Uninstall your current mesa, pip install . -e and then solara run app.py is what I found out working.
Uninstall your current mesa, pip install . -e and then solara run app.py is what I found out working.
Thanks! This gave me the idea for a slightly different approach: insert the correct version of mesa into sys.path at the top. Based on this, I can confirm that this code works as intended.
Let me know what else would be needed to complete this PR since its my first contribution to the visualization side of things.
insert the correct version of mesa into sys.path at the top. Based on this, I can confirm that this code works as intended.
That's the other obvious way to go, both have their advantages based on what your working on.
@Corvince I'm also quite new to this stack, could you please review this one?
One improvement for this function would be to use the _get_agent_data when drawing the new grids. I got a weird error, and using _get_agent_data would have prevented and handled that. I wrote it up here:
- #2407
One improvement for this function would be to use the _get_agent_data when drawing the new grids. I got a weird error, and using _get_agent_data would have prevented and handled that
I looked at that and I could not use it because that method is hard coded to only work with _Grid: for agents, pos in space.coord_iter().