Hybrid ABM DEVS with MESA #2032
Replies: 7 comments 15 replies
-
Existing discussions:
Will add more to the list when a new relevant / related discussion appears. |
Beta Was this translation helpful? Give feedback.
-
Replying to #1997 (reply in thread)
Does DSOL/pydsol use the concept of EventTree? The term EventTree needs an elaboration itself, and I'm not sure if it is discussed in Zeigler 2018 either. |
Beta Was this translation helpful? Give feedback.
-
Thank you @quaquel for putting this together!! Lots of interesting things in there and I am looking forward to diving into it |
Beta Was this translation helpful? Give feedback.
-
Some previous discussion, for reference:
It would be interesting how many goals from #1893 we can integrate. |
Beta Was this translation helpful? Give feedback.
-
I briefly discussed with my PhD advisor Andrew, and he likes the idea of making Mesa a hybrid simulation framework. Recently MASON (a JAVA ABM framework) has a discrete event simulation extension named MASON DES, aiming to provide such hybrid simulation modes (link to paper). There is a repository containing three example DES models (link to repo) but I couldn't find the source code for the DES extension. Perhaps it's not yet released. For Mesa, I'm wondering if we'd like the DES part to be a separate extension (like MASON DES to MASON), or have it integrated within Mesa. I just realized that there might be a slight difference between the goals. Do we want (1) just a discrete event scheduler, or (2) the capabilities to develop discrete event models in Mesa? For (1), we are still doing ABMs, but we can develop in DES-style; whereas (2) refers to a full-blown framework to do DES models (e.g., a queuing system). |
Beta Was this translation helpful? Give feedback.
-
Regarding with performance, I know it's less efficient with stepping all the GrassPatch's at each step, but I reformulated the step method as def step(self):
self.height = min(self.height + 1, self.model.grass_regrowth_time)
self.fully_grown = self.height >= self.max_height This version is about as concise as the DEVS version, while at the same time it can be vectorized, and hence can be a property layer bulk operation, instead of agent steps, which is fast as well. It makes me wonder if the framework language is not Python, but instead is in Rust, which one would be faster. But this is a very specific example where the grass FSM dynamics is independent of its surroundings. If the grass patch growth rate depends on whether the surrounding is arid/fertile, then a property layer solution might be faster, because dependence on the nearest neighbor can be viewed as a geographical property instead of time-based property. |
Beta Was this translation helpful? Give feedback.
-
The EventList's concrete implementation is based on EventListHeap in pydsol. a DEVS is more efficient than a simulation in ABM format if the number of events << number of ticks in ABM. If they are of the same order of magnitude, then the push operations on the heap tree become expensive. For a hybrid framework, shouldn't the model step be separated from the EventList, because it happens at every tick anyway? The EventList may be reserved for rare events, and the current pop() of the heap shouldn't be cleared unless it is at the right tick. |
Beta Was this translation helpful? Give feedback.
-
I have mentioned in various discussions the potential for hybrid ABM-Discrete Event scheduling. After finishing the new cell grid stuff and being a bit stuck on data collection, I decided to give it a go. The code uses ideas from the current devs scheduler and pydsol, which is a python port of the DSOL java library developed over the past 20 years by colleagues.
My draft code is here. The key classes are a new Simulator class (akin to a numerical integrator for ODEs, theoretically rooted in the work of Zeigler), the EventList, and SimEvent.
I also added so far 1 example: wolfsheep. The key thing is that I use ABM-style scheduling on the wolf and sheep.
While the regrowth of the grass patches is handled through event scheduling. So, the grass patches are no longer activated each step to reduce a counter. Rather, I schedule events for when they are fully regrown.
It is just a first rough example. I want to do Epstein's civil violence next, with jail time being handled through event scheduling. A key thing, however, is that wolf sheep on 100 ticks already has about half the runtime of the pure ABM implementation.
added 1: Currently, the core design uses next event time progression. To get AMB style behavior (i.e., incremental time progression),
model.step
schedules itself with a time increment of 1. A slightly more elaborate implementation might make this the default behavior for theABMSimulator
, while still allowing event scheduling. So, ABMSimulator schedules/always contains amodel.step
for each discrete time tick. From a user point of view, this might be more convenient.added 2: I am slowly continuing to update the code. Incremental time progression has now been integrated, so in
model.step
it is no longer needed to schedule the next call tomodel.step
. Moreover, I have givenmodel.step
events a higher priority so they always go first in a tick.added 3: PR:
Beta Was this translation helpful? Give feedback.
All reactions