Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable DiscreteEventScheduler to handle system-level events and task interruptions #1893

Open
EwoutH opened this issue Nov 28, 2023 · 0 comments

Comments

@EwoutH
Copy link
Contributor

EwoutH commented Nov 28, 2023

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:

  1. Enhanced Event Scheduling:

    • Modify schedule_event to check an agent's current task status before scheduling new tasks.
    • Implement logic to handle scenarios where an agent is already engaged in a task (e.g., delay or reschedule the new task).
  2. Basic Interruption Handling:

    • Introduce a method in DiscreteEventScheduler to interrupt an agent's current task.
    • Update the agent's status to reflect the interruption and, optionally, reschedule the interrupted task for a later time.
  3. System-Level Event Integration:

    • Implement a feature to schedule system-wide events that can affect multiple or all agents.
    • These events could trigger task interruptions or other significant changes in agent behavior.
  4. Resumption Logic:

    • Develop a mechanism within agents to resume interrupted tasks.
    • This would involve checking their status at the beginning of their 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.

@EwoutH EwoutH changed the title Enhancement the DiscreteEventScheduler to handle system-level events and task interruptions Enable DiscreteEventScheduler to handle system-level events and task interruptions Nov 28, 2023
@EwoutH EwoutH mentioned this issue Nov 28, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant