jaxabm.agentpy.AgentList
- class jaxabm.agentpy.AgentList(model, n, agent_class, **kwargs)[source]
Bases:
objectContainer for managing collections of agents.
This class provides an AgentPy-like interface for managing groups of agents.
Example
```python # In Model.setup(): self.agents = AgentList(self, 10, MyAgent)
# Access agent attributes: x_positions = self.agents.x # Returns array of x values
# Filter agents: active_agents = self.agents.select(lambda agents: agents.active) ```
Methods
__init__(model, n, agent_class, **kwargs)Initialize agent list.
select(condition)Select agents that satisfy a condition.
Attributes
Get all agent states.
- property states: Dict[str, Any]
Get all agent states.
- Returns:
Dictionary of agent state variables.
- __getattr__(name)[source]
Get agent attribute for all agents.
This allows getting arrays of attribute values, e.g., agents.x.
- Parameters:
name (
str) – Attribute name.- Return type:
- Returns:
Array of attribute values.
- Raises:
AttributeError – If attribute not found.