Open Datseris opened 1 year ago
Yes, indeed this is what I was referring to when I was saying that there is some other API calls to add there, but we need to add some new methods in Agents.jl before so, will do a pr there in a couple of days when I find the time!
be careful though to only add API methods that are generally useful. We don't want to "cheat" and just add functions to Agents.jl API that would only be used in this comparison repo.
What is the method that is "missing" here?
we already have filtering here: https://juliadynamics.github.io/Agents.jl/stable/api/#Agents.random_nearby_agent
BTW this function seems to allocate the collection anyways: https://github.com/JuliaDynamics/Agents.jl/blob/main/src/core/space_interaction_API.jl#L414C30-L414C30
Which makes me think, how is it more performant than directly collecting the iterator and calling rand
on it...?
It is more performant since it doesn't test the condition
on all the data, just on the part needed to find a value respecting the condition, some benchmarks we did saw some benefit doing that even for simple condition
functions.
Yes, anyway I'm (almost) sure those functions will be beneficial for the users
In Agents.jl we have spent considerable development effort optimizing functions that pick a "random nearby thing" but these aren't used here anywhere even though picking a "random nearby thing" is an extremely common ABM programming pattern.
Maybe we can use the random nearby in the wolf sheep model?
here: https://github.com/JuliaDynamics/ABM_Framework_Comparisons/blob/main/WolfSheep/Agents/WolfSheep.jl#L78