Clockwork: A Discrete Event and Agent-Based Social Simulation Framework

Sasha Azad, David Beymer, Anup Pillai, Tom Zimmerman, Ed Seabolt, Hakan Bulu, Colin Potts, Vanessa Burrowes, Vandana Mukherjee, Arnav JhalaResearch Square 2023 · DOI

Abstract

Agent-based social simulation (ABSS) is a powerful tool for creating digital twins of societies, yet it often suffers from computational inefficiency. We introduce Clockwork, a hybrid framework that integrates behavior-level autonomous agent scheduling with a Discrete Event Simulator (DES). This approach enables high-fidelity modeling of individual agent histories and social interactions while maintaining population-level statistical distributions. We demonstrate Clockwork's efficacy through a real-world worksite case study focused on COVID-19 mitigation policies.

Introduction

Social simulations typically force a choice between the rich, autonomous behavior of Agent-Based Social Simulations (ABSS) and the computational speed of Discrete Event Simulations (DES). ABSS models "active" agents with complex motives but is often slowed by continuous-time "ticking." Conversely, DES is fast by skipping empty time but treats agents as "passive" entities. Clockwork bridges this gap, providing a scalable "digital twin" framework that preserves agent autonomy.

Methodology: The Hybrid ABSS-DES Architecture

Clockwork splits the simulation into two specialized engines to optimize both intelligence and logistics:

  • ABSS Engine: Manages agent "intelligence" through motives (e.g., hunger, social needs) and a Reactive Planner. Agents use Basic Reactive Plans (BRP) defined by <priority, precondition, action> triplets, allowing for dynamic responses to environmental triggers.
  • DES Engine: Built on the Python SimPy framework, this engine handles the simulation clock and resource management (e.g., elevator queues). By using event-based ticking, the system only processes time when state-changing events occur, drastically reducing CPU load.
  • Environment Modeling: The physical space is represented as a location graph of nodes (offices, cafes) and edges (corridors), enabling precise movement tracking without the overhead of 3D physics.

Case Study: COVID-19 Mitigation at a Real-World Worksite

To evaluate the framework, we modeled a digital twin of a real-world worksite using a floor plan mapped into over 400 nodes.

Heat map of agent interactions and potential infection hotspots within the simulated worksite floor plan.

The simulation utilized CDC data to define probabilistic distributions for infection and immunity. We simulated a synthetic population of 125 agents over an 868-day period to test various policies, such as masking mandates and office layout changes.

Results and Discussion

Clockwork demonstrated a significant performance leap, completing the case study in 1 minute and 12 seconds—a task that took traditional planning-based simulations over an hour.

Key insights included:

  • Layout Impact: In an open-office plan, 100% masking still resulted in a 75% infection rate during the Omicron peak. However, shifting groups into private rooms increased the uninfected population to 50%.
  • Explainable Emergence: Each agent maintains a "journal" of decisions, allowing researchers to trace macro-level outcomes (like the heat map shown above) back to specific individual interactions. This granularity allows for rapid "what-if" testing of corporate policies.

Conclusion

Clockwork successfully scales social simulations without sacrificing agent autonomy. By treating "empty time" as a single event rather than multiple ticks, the framework unlocks massive performance gains. Future work will expand the framework to broader contexts, including hurricane evacuations and the spread of disinformation, while further integrating with other social simulation engines.

Summary updated

Abstract

<title>Abstract</title> Agent-based social simulation can be useful for creating digital twins of societies of interacting autonomous agents. Such simulations are useful for testing hypotheses about behaviour and belief change in the presence of interventions. In this paper, we introduce Clockwork, an efficient multi-agent simulation framework. The key contribution of this framework is integrating a behaviour-level simulation of autonomous agent schedules with a Discrete Event Simulator (DES) and a rich model of social interaction among agents modelled with Agent-Based Social Simulation (ABSS) methodology. Clockwork's ability to simulate deterministic and stochastic events and changes in individual agent models due to the influence of other agents through event-based emergent interactions is novel. We describe the design, architecture, and development of the Clockwork framework. Combining DES and ABSS in this way enables the modelling of detailed individual agent histories while maintaining population-level statistical distributions. We evaluated Clockwork with a real-life scenario modelling the digital twin of employees at a real-world worksite to test the efficacy of various policies put in place to mitigate the risk of contracting COVID-19 through a hybrid or in-person work model.
BibTeX
@inproceedings{azad2023clockwork,
  author = {Sasha Azad and David Beymer and Anup Pillai and Tom Zimmerman and Ed Seabolt and Hakan Bulu and Colin Potts and Vanessa Burrowes and Vandana Mukherjee and Arnav Jhala},
  title = {{Clockwork: A Discrete Event and Agent-Based Social Simulation Framework}},
  booktitle = {Research Square},
  year = {2023},
  doi = {10.21203/rs.3.rs-3740215/v1},
}
Figure