Skip to content
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

Reorganize advanced examples: wolf_sheep and sugarscape_g1mt #2410

Merged
merged 7 commits into from
Oct 24, 2024

Conversation

quaquel
Copy link
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
Copy link

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

mesa/examples/advanced/sugarscape_g1mt/Readme.md Outdated Show resolved Hide resolved

# Create sheep:
for i in range(self.initial_sheep):
x = self.random.randrange(self.width)
Copy link
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
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.

mesa/examples/advanced/wolf_sheep/model.py Outdated Show resolved Hide resolved
@quaquel
Copy link
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 projectmesa:main Oct 24, 2024
9 of 12 checks passed
@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