-
Notifications
You must be signed in to change notification settings - Fork 940
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
Add RandomActivationByBreed
from Sugarscape example to available schedulers in time.py
#900
Comments
Agents.jl has a very concise implementation of something equivalent to RandomActivationByBreed: https://github.com/JuliaDynamics/Agents.jl/blob/48f71a3b438e8cdcbb562067f5877e52cf0a6e5d/src/core/schedule.jl#L85. I wonder if we can replicate the design in Python. |
From the discussion in JuliaDynamics/ABMFrameworksComparison#2, it turns out that Agents.jl's I think the solution is going to look similar to the Sugarscape example's Note that not including |
I agree I think a bybreed option should be default in Mesa. |
|
This is the benchmark: https://juliadynamics.github.io/Agents.jl/stable/comparison/. |
@tpike3 @jackiekazil @rht I think having proper multi-type agent support would increase the value of Mesa quite a bit. Implementing a NetLogo also supports different types of agents (called breeds), so it can be essential to porting some models. |
@EwoutH I absolutely agree if you are interested in working on it, that would be a great contribution :) |
I might do some work on it next week. One thing I already noticed it that it will require some work on the DataCollector code, since that assumes "The schedule has an agent list called agents". |
@EwoutH My dissertation worked with sugarscape (sugar and spice trading model) and I don't remember adjusting the datacollector being that laborious. May not be helpful, but here is the code repo schedule and the whole repo with a data analysis notebook. I adjusted from the activiationbybreed example (although it should be by |
TIL! @tpike3 what do you think of adding various models of Sugarscape to the examples? E.g. |
@tpike3 Thanks for the links! I see you implemented |
I think I wrote a working DataCollector implementation with multiple agent-types. The next problem I just encountered is that the |
I misdirected some energy to a proof of concept: #1142 Please feel free to comment on both the architecture and specific implementation. I will try to spin up some production ready code over the next week. |
@rht absolutely, once we get activation by type I think I can spin up some of the other variations pretty quick. This only tangentially related (more a point of interest) when I did the sugar and spice variation, I could replicate all the results but the signature of trading volume. My best guess is still the way the underlying code is handled between python and basic. But never had a chance to really unpack it. |
This will be closed by #1162. |
#1162 has been merged a while ago; I forgot to close this issue. |
What's the problem this feature will solve?
Sometimes you need to
step()
each breed of agent separately. TheSugarscape
example already has a scheduler that takes care of that use case:RandomActivationByBreed
. It makes sense for it to be merged into the schedulers available by default intime.py
.Describe the solution you'd like
Copy
RandomActivationByBreed
intotime.py
. The class might require some adjustment to work with theDataCollector
class, since theagent_reporters
loop over all agents in the schedule, regardless ofbreed
, which will inevitably raise a bunch ofAttributeError
exceptions.Alternatively we could subclass the
DataCollector
class to make it collect bybreed
.Additional context
It might be interesting to also have a
StagedActivationByBreed
scheduler.The text was updated successfully, but these errors were encountered: