Skip to content

Commit 34e991a

Browse files
committed
memory version 2
1 parent 06cbb63 commit 34e991a

File tree

3 files changed

+316
-107
lines changed

3 files changed

+316
-107
lines changed

mesa/experimental/devs/memory.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

mesa/experimental/memory/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""Core event management functionality for Mesa's memory system.
2+
3+
This module provides the foundational data structures and classes needed for memory
4+
entries recording in mesa. The Memory class is a manager between the ShortTermMemory
5+
(dque data structure) and LongTermMemory (hash map).
6+
7+
Key features:
8+
9+
- Priority-based event ordering
10+
- Weak references to prevent memory leaks from canceled events
11+
- Efficient event insertion and removal using a heap queue
12+
- Support for event cancellation without breaking the heap structure
13+
14+
The module contains three main components:
15+
- Priority: An enumeration defining event priority levels (HIGH, DEFAULT, LOW)
16+
- SimulationEvent: A class representing individual events with timing and execution details
17+
- EventList: A heap-based priority queue managing the chronological ordering of events
18+
19+
The implementation supports both pure discrete event simulation and hybrid approaches
20+
combining agent-based modeling with event scheduling.
21+
"""
22+
23+
from .memory import LongTermMemory, Memory, MemoryEntry, ShortTermMemory
24+
25+
__all__ = [
26+
"LongTermMemory",
27+
"Memory",
28+
"MemoryEntry",
29+
"ShortTermMemory",
30+
]

0 commit comments

Comments
 (0)