you should explicitly tell python that it is a class method, not an object method.
Currently it is:
def reset(cls):
CountryAgent.instances = []
But I think it should be:
@clasmethod
def reset(cls):
cls.instances = []
The beaviour is the same for both functions, but for the first one you need an agent object to access it (e.g. agent.reset()) whereas with the other you can call it without access to a particular agent object (e.g. CountryAgent.reset()).
In the agent_class.reset() function:
https://github.com/eeyouol/Covid_policy_response_abm/blob/da92205d3542eac18b6a499d9cc7bfb1aadcf04f/code/agent_class.py#L269
you should explicitly tell python that it is a class method, not an object method.
Currently it is:
But I think it should be:
The beaviour is the same for both functions, but for the first one you need an agent object to access it (e.g.
agent.reset()
) whereas with the other you can call it without access to a particular agent object (e.g.CountryAgent.reset()
).