Make random number generator optional in creation of AgentSet, take Rā¦
Merge branch into main
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%] |
Change int cast that Ruff complained about
Looks good to me. A few minor requests
- Can you expand the PR description
- Can you resolve the conflict
Thanks!
Agree with @quaquel. Thank you for the contribution @verisimilidude2! Looking forward to getting this merged in with those updates.
@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
What's the status of this PR? And what's needed to move it forward?
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 I updated the title and description, could you review it?
Code itself is good?
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!