Skip to content

Update mesa.examples models to use scenario#3363

Merged
quaquel merged 12 commits intomesa:mainfrom
quaquel:scenario_examples
Mar 8, 2026
Merged

Update mesa.examples models to use scenario#3363
quaquel merged 12 commits intomesa:mainfrom
quaquel:scenario_examples

Conversation

@quaquel
Copy link
Copy Markdown
Member

@quaquel quaquel commented Feb 23, 2026

This PR updates the examples to use a custom scenario class. It also updates app.py and the tests.

I left out Sugarscape since there is a PR open already that makes the change.

@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +0.1% [-0.3%, +0.5%] 🔵 -1.8% [-2.0%, -1.6%]
BoltzmannWealth large 🔵 -0.6% [-1.1%, -0.1%] 🔵 -2.5% [-3.2%, -1.7%]
Schelling small 🔵 -1.5% [-1.7%, -1.2%] 🔵 -1.5% [-1.7%, -1.4%]
Schelling large 🔵 -1.3% [-1.7%, -0.9%] 🔵 -3.6% [-4.5%, -2.7%]
WolfSheep small 🔵 +0.2% [-0.0%, +0.4%] 🔵 -0.3% [-0.4%, -0.1%]
WolfSheep large 🔵 +1.4% [+0.5%, +2.4%] 🔵 -0.4% [-1.1%, +0.4%]
BoidFlockers small 🔵 +0.8% [+0.5%, +1.1%] 🔵 -0.6% [-0.7%, -0.5%]
BoidFlockers large 🔵 +0.5% [+0.3%, +0.6%] 🔵 -0.3% [-0.4%, -0.1%]

@quaquel quaquel marked this pull request as ready for review March 4, 2026 15:47
@quaquel quaquel added the enhancement Release notes label label Mar 7, 2026
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.

Two checks, otherwise looks good so pre-approving!


n: int = 50
mean: float = 0.5
std_dev: float = 0.2
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.

You changed std_dev from 0.1 to 0.2, was that a conscious change?

width: int = 50
height: int = 50
activation_order: Literal["Sequential", "Random", "Simultaneous"] = "Random"
payoff: None | dict[tuple[str, str], float] = None
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.

You changed payoffs to payoff, was this on purpose?

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.

It was not deliberate. The object in question is known as the payoff matrix in most literature so I just went with that without checking the original code

@quaquel quaquel merged commit 983cbb8 into mesa:main Mar 8, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants