Skip to content

DataCollector requires all agents to have the same Attributes #976

@JonasJosef123

Description

@JonasJosef123

What's the problem this feature will solve?
Hello @ALL
I am not sure if I am actually doing something wrong but in my code I have two different agents types that get different attributes when created. (however they are from the same agent class)
When I want to collect their specific attribute data with the data collector i get an "AttributeError" that my agents object has no such attribute. While this is true for agents 1-4 i created, agents 5-20 have that specific attribute. The only solution I found was to create the same attribute for the first 4 agents aswell and initialize it with None. For me this makes the code unnecessary flatulent. Is there a smart way around? For me it would be intuitive to check if the agent has this attribute and if not to automatically put "None" as a placeholder for the datacollector.

I am not really experience with python and mesa so I dont know if there exist some best practice solution to create different agents only through different classes or something like this.

Thanks for your help!

best regards,

Jonas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions