Add Task system proof-of-concept: ant colony with interruptible tasks#445
Add Task system proof-of-concept: ant colony with interruptible tasks#445samuelmohel wants to merge 15 commits intomesa:mainfrom
Conversation
This file implements a task system for Mesa agents, including task management, reward functions, and task queue functionality.
Implement Ant Colony model with task system and pheromone signals.
Add metadata for Ant Colony Task System model including description, authors, and features.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Hi @samuelmohel — I've been working on a related prototype (PR #432, needs-based Wolf-Sheep) and your TaskQueue implementation answers a question I had been sitting with. |
|
Thanks @DashamiJituri that's a clean solution. The int | float union with integer mapping to tick counts and float resolving against model time keeps the API simple while covering both schedulers. One thing I'd add: Task would need to store the start_time at activation so float-duration tasks can compute remaining = (start_time + duration) - model.time correctly when resumed after interruption otherwise resumable tasks with float duration lose their progress reference. Would be great to test against your Wolf-Sheep model, especially to see how the interruptible flag behaves when an agent is removed mid-task. I'll open a follow-up branch with the union type implementation. |
What this adds
A proof-of-concept implementation of the Task system proposed in
mesa/mesa#2526 (EwoutH).
Adds a model-agnostic
TaskandTaskQueueclass with:Demonstrated via an ant colony where cave-in pheromone signals
interrupt ongoing dig tasks in real time.
Files
tasks.py- reusable Task/TaskQueue classes, zero dependency on ant logicmodel.py- AntColonyModel + AntAgentapp.py- SolaraViz visualizationmetadata.toml- example metadataRelated
Preview