Skip to content

Reorganize advanced examples: wolf_sheep and sugarscape_g1mt#2410

Merged
quaquel merged 7 commits intomesa:mainfrom
quaquel:reorganize_advanced
Oct 24, 2024
Merged

Reorganize advanced examples: wolf_sheep and sugarscape_g1mt#2410
quaquel merged 7 commits intomesa:mainfrom
quaquel:reorganize_advanced

Conversation

@quaquel
Copy link
Copy Markdown
Member

@quaquel quaquel commented Oct 24, 2024

This PR reorganizes wolf_sheep and sugarscae_g1mt using agents.py, model.py, and app.py. It cleanup redundant files and updates the readme. For wolf_sheep, it adds a Solara front end because it did not exist yet.

Below is a screenshot. Grass visualization is not great yet. The matplotlib drawing of agents passes s (the size of the marker) but not marker (the shape of the marker). So various updates in the solara side are needed first before we can return to make this solara front end nicer.

Note how I reused #2408 for the dropdown chooser for grass regrowth.

Screenshot 2024-10-24 at 15 41 27

@quaquel quaquel requested a review from EwoutH October 24, 2024 13:49
@quaquel quaquel added docs Release notes label example Changes the examples or adds to them. labels Oct 24, 2024
@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -0.8% [-1.7%, +0.1%] 🔵 -1.0% [-1.1%, -0.8%]
BoltzmannWealth large 🔵 -1.2% [-1.7%, -0.8%] 🔵 -1.9% [-2.5%, -1.3%]
Schelling small 🔵 +0.4% [-0.0%, +0.8%] 🔵 +1.1% [+0.9%, +1.3%]
Schelling large 🔵 +2.2% [+1.5%, +2.8%] 🔵 +2.4% [+1.5%, +3.3%]
WolfSheep small 🔵 +0.2% [+0.1%, +0.4%] 🔵 +1.0% [+0.8%, +1.2%]
WolfSheep large 🔵 -0.0% [-0.2%, +0.2%] 🔵 +0.7% [+0.2%, +1.2%]
BoidFlockers small 🔵 +2.4% [+1.7%, +3.0%] 🔵 +1.9% [+1.2%, +2.6%]
BoidFlockers large 🔵 +2.5% [+1.9%, +3.1%] 🔵 +2.6% [+2.1%, +3.3%]

Copy link
Copy Markdown
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you properly move / remove the old files? It seems like there are now too many files, especially in WolfSheep

IMG_0061


# Create sheep:
for i in range(self.initial_sheep):
x = self.random.randrange(self.width)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t we have a nice random cell function for this?

(can also be done in another PR, but now that we’re looking at it)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you can do self.grid.all_cells.select_random_empty_cell() or something close to that.

I'll leave that for a seperate PR that goes into the code itself and cleans it up. Let's keep this focussed on the reorganization.

@quaquel
Copy link
Copy Markdown
Member Author

quaquel commented Oct 24, 2024

Did you properly move / remove the old files? It seems like there are now too many files, especially in WolfSheep

I forgot that folder. The rest is clean

@quaquel quaquel merged commit efb7d45 into mesa:main Oct 24, 2024
@quaquel quaquel deleted the reorganize_advanced branch October 25, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label example Changes the examples or adds to them.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants