-
Notifications
You must be signed in to change notification settings - Fork 14
[Enhancement]: Consider using a key-based structure for agentsets
instead of list in AgentsDf
#146
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
Comments
That's a wonderful idea—it makes A couple of things we might want to think about:
|
so I was thinking a bit more about this and came up with the below approaches Approach 1it would be be better if we could use
maybe this can be the default way and let users change the name if they pass a specific argument . cons :
pros :
personally I like this approach the best since I think its very intuitive. Approach 2make the default key the same as index if no name is passed, this will give users the ability to name if they want to ( and we can even add the ability to change the name later as well.
I love this |
🤔 Problem Description
Currently,
agentsets
are stored in a list (e.g.,self.agentsets[0]
for sheep,self.agentsets[1]
for wolves in wolf-sheep model ), which relies on indexing. While functional, this can be slightly confusing, especially in models with multiple agent types.Accessing
agentsets
by name (e.g., "sheep" or "wolves") instead of an index would make the code more readable, less error-prone, and easier to maintain💡 Proposed Solution
One possibility is to use a key-value structure for storing
agentsets
—such as a dictionary— open to other approaches as well. The key idea is to allow referencingagentsets
with descriptive identifiers rather than implicit positions.maybe we can pass in the name when
agentsets
are addedThis could make code that works with specific agent types more intuitive, while still allowing for easy iteration using .values().
Curious if there was a specific reason behind the current list-based design—happy to hear thoughts or alternative ideas!
🔄 Alternatives Considered
No response
➕ Additional Context
No response
The text was updated successfully, but these errors were encountered: