-
Notifications
You must be signed in to change notification settings - Fork 116
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
Implement multiagent macro #957
Conversation
Now even this more complicated compactification works @compact struct Animal{T,N,J}(GridAgent{2})
@agent struct Wolf{T,N}
energy::T = 0.5
ground_speed::N
const fur_color::Symbol
end
@agent struct Hawk{T,N,J}
energy::T = 0.1
ground_speed::N
flight_speed::J
end
end |
Seems kind of fine to me!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic!!! I assume you have tested it locally and tests passs, and we have the same roblem as with the other PR?
Should we rename the @compact
to @multiagent
? The front-end user doesn't really need to care about what the implementation detail does (compactifies), they only care that they get a multi-agent or mixed-agent model.
Co-authored-by: George Datseris <datseris.george@gmail.com>
Hi George, should be okay now if you want to take a look |
I updated the performance tips, I don't anymore mention the problem with working many types, I think our macro is good enough for many use cases already. However, I don't consider the problem totally solved, and I consider #841 and its variations worth exploring. E.g. our macro falls short when the types have a memory footprint very different from one another, because when we use the memory efficient version we are actually occupying anyway the memory of the agent with highest memory footprint (instead of the sum of their footprints which happens with :opt_speed) which can be sometimes too much anyway |
great, I will review this on the weekend! |
Okay I will review this now and tomorrow. If you are around, any chance I can get a summary of this PR in a comment here? |
all tests fail, I guess this is the "known" problem and everything passes locally? |
In practice I implemented the multiagent macro where I also give to the user the possibility to choose between a more optimized version for speed or for memory by passing
exactly, also strangely when we merge tests pass instead |
@Tortar can you remind me what is the performance comparison of this method and the standard |
Yes, I updated two benchmarks in this PR, I described the results for variable_agent_types_simple_dynamics.jl in the other review comment, for the results of the other, see the bottom of branching_faster_than_dispatch.jl |
right, the first file does not have any comments with the results, but from the second one Agents.jl/test/performance/branching_faster_than_dispatch.jl Lines 190 to 193 in f750aef
|
i'll merge this in when you adress the comments for the performance tips documentation. then i'll work on a re-worked tutorial and docs. |
--------- Co-authored-by: George Datseris <datseris.george@gmail.com>
Docs updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, i am merging this in, the plotting PR whcih is the last blocker left I think
oh, btw, what impliciations does this have for the Event queue abm? does it make it much faster as well? I Guess we should have a specialization there if there are no different agent types? |
Fixes #947
Because I'm a bit crazy I've already implemented it :D
(Notice that the more complicated example in #947 works and also the
rabbit_fox_hawk
example I modified)