starling_sim.basemodel.population.agent_population
Module Contents
Classes
Describes one or several collections of agents |
- class starling_sim.basemodel.population.agent_population.AgentPopulation
Describes one or several collections of agents
This class must be extended to give a concrete implementation of the storage of the simulation’s population(s), e.g. using a dict {ID : Agent}
- get_total_population()
Give access to the total population of the simulation
- Returns:
list of Agent objects
- get_agent(agent_id, agent_population=None)
Get the agent corresponding to the given id.
The agent population may be provided, or it can be left to None if it is unknown.
- Parameters:
agent_id – id of the agent
agent_population – population of the agent, None if unknown
- Returns:
agent
- new_population(population_name)
Return a population with the given name.
If the population does not exist, it is created.
- Parameters:
population_name – str
- Returns:
population associated to the given name
- new_agent_in(agent, population_names)
Add the agent to the given population(s)
- Parameters:
agent – Agent object
population_names – list or str corresponding to population names