Open EwoutH opened 10 months ago
I wrote this issue before the whole new DEVS scheduler was in. Now that it is, I would like to revisit it.
I want to introduce especially the concept of a Task
. A Task takes a non-fixed time, which can be determined stochastically. It might also be able to be interrupted by an other agent or a system level event, and if so, there are multiple options to handle that.
Expect some work on this the next few days/weeks.
CC @quaquel and @Corvince
The current implementation of the
DiscreteEventScheduler
(as of #1890) could be improved by allowing task interruptions and resumptions, and integrating system-level event handling.Motivation
System-level events, such as policy changes or environmental shifts, can be crucial for simulating real-world scenarios. By enabling agents to interrupt and resume tasks and react to system-wide changes, we allows new systems to be modelled.
Description
The current implementation of the
DiscreteEventScheduler
in Mesa works great for simulations where agents operate based on discrete events. However, for more complex scenarios, especially those requiring dynamic interruption and resumption of tasks, as well as system-level event responses, the scheduler could benefit from additional functionalities.Proposed Enhancements:
Enhanced Event Scheduling:
schedule_event
to check an agent's current task status before scheduling new tasks.Basic Interruption Handling:
DiscreteEventScheduler
to interrupt an agent's current task.System-Level Event Integration:
Resumption Logic:
step
method and deciding whether to continue a previous task or start a new one.There is probably more that could fit in there. I think the most important is to think about the concepts of tasks in Mesa, a thing that an agent is currently working on, has some future benefit and can be interrupted by different things.