Mesa-geo agents and geospace remove #265
Unanswered
msalazarcgeo
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Thanks for reporting this. Could you give us a Minimal, Reproducible Example? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I believe I've identified the issue while attempting to recreate the problem. I was removing the agent using the agent, rather than its index position within the GeoSpace. The reference to the agent is actually a weak reference, which prevents its removal. To correctly remove the agent, it's necessary to reference it within Model.Geospace.agents[unique_id]. However, this approach has to be careful since the the indexing in GeoSpace starts from 1, not 0. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying to implement an agent-based model using Mesa-Geo. As a starting point, I've been following the example in the documentation. As I understand it, Mesa agents need to be added to both the Mesa model and the GeoSpace instance within the model (I believe this should be handled automatically somehow). To achieve this, I've created a method to update the GeoSpace agents using the
Geospace.add_agents
method.The model involves removing some agents and creating new ones. The issue is that agents can be removed and added correctly in the Mesa model, but they persist in the GeoSpace instance even after the use of the
Geospace.remove_agent
. Can someone please explain what I might be missing her?Best regards
Beta Was this translation helpful? Give feedback.
All reactions