Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
model.agents: Store agents in nested dict keys
This commit introduces dics nested into a single defaultdict for agent storage, using agent instances as inner keys and None as inner values. The decision is based on: 1. Determinism: A dictionary ensures deterministic behavior for reproducible research outcomes. 2. Performance: Benchmarks showed that dictionaries offer a good balance between performance and functionality, especially in models with frequent agent updates. 3. Usability and Explicitness: While the use of None values is unconventional, this approach is practical and avoids the complexity of nested structures or external dependencies. It aligns with clear and explicit coding practices, making the framework more accessible and maintainable. The choice of a defaultdict with None values addresses the need for deterministic behavior, performance efficiency, and clarity in implementation. Additional utility functions like `select_agents()` will be added to enhance usability. Discussion for historical reference: projectmesa#1894 (comment)
- Loading branch information