mesa icon indicating copy to clipboard operation
mesa copied to clipboard

Make random number generator optional in creation of AgentSet, take R…

Open verisimilidude2 opened this issue 8 months ago • 4 comments

Merge branch into main

verisimilidude2 avatar May 19 '25 20:05 verisimilidude2

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small šŸ”µ -0.7% [-1.4%, -0.1%] šŸ”µ -0.6% [-0.9%, -0.4%]
BoltzmannWealth large šŸ”µ -0.6% [-1.5%, +0.3%] šŸ”µ -1.6% [-3.9%, +0.5%]
Schelling small šŸ”µ +0.1% [-0.1%, +0.3%] šŸ”µ -0.4% [-0.7%, -0.1%]
Schelling large šŸ”µ -0.3% [-0.9%, +0.2%] šŸ”µ -0.5% [-2.1%, +0.8%]
WolfSheep small šŸ”µ -0.1% [-0.4%, +0.2%] šŸ”µ +0.3% [+0.1%, +0.5%]
WolfSheep large šŸ”µ -0.4% [-1.4%, +0.7%] šŸ”µ -0.0% [-0.4%, +0.5%]
BoidFlockers small šŸ”µ -0.8% [-1.3%, -0.2%] šŸ”µ -0.5% [-0.7%, -0.2%]
BoidFlockers large šŸ”µ +0.4% [-0.5%, +1.1%] šŸ”µ -0.0% [-0.4%, +0.3%]

github-actions[bot] avatar May 19 '25 20:05 github-actions[bot]

Change int cast that Ruff complained about

verisimilidude2 avatar May 19 '25 20:05 verisimilidude2

Looks good to me. A few minor requests

  1. Can you expand the PR description
  2. Can you resolve the conflict

Thanks!

quaquel avatar May 20 '25 18:05 quaquel

Agree with @quaquel. Thank you for the contribution @verisimilidude2! Looking forward to getting this merged in with those updates.

jackiekazil avatar May 21 '25 05:05 jackiekazil

@quaquel I'm not sure how one changes the PR description. The diff on the note on the AgentSet class pretty much describes what I did: Was: A UserWarning is issued if random=None. You can resolve this warning by explicitly passing a random number generator. In most cases, this will be the seeded random number generator in the model. So, you would do random=self.random in a Model or Agent instance. Now: If random is None then the random number generator in the model of the first agent is used. If the agents list is empty a user warning is issued and the agent set is an empty list with no random number generator

verisimilidude2 avatar Jul 22 '25 02:07 verisimilidude2

What's the status of this PR? And what's needed to move it forward?

EwoutH avatar Nov 07 '25 09:11 EwoutH

I guess it's stale. I requested 2 small things, neither of which has been done.

Fixing the PR descritption can be done by us. I just merged in the main branch to check if there are any new conflicts or failing tests.

quaquel avatar Nov 07 '25 09:11 quaquel

@quaquel I updated the title and description, could you review it?

Code itself is good?

EwoutH avatar Nov 07 '25 10:11 EwoutH

We released Mesa 3.3.1 with this bugfix, so you should now be able to update Mesa (pip install -U mesa) and have this bug resolved!

EwoutH avatar Nov 07 '25 10:11 EwoutH