Is SimPy appropriate for the "Listener Event Graph Objects" Framework?

141 views
Skip to first unread message

Geoff Nordling

unread,
Oct 11, 2023, 2:44:08 PM10/11/23
to python-simpy
Hello!

I have joined a new work team that plans to do a lot of Discrete Event Simulation (DES) in Python.

I am new to DES (not new to Python), so I have no opinion on which libraries or frameworks are best. But, our work team leader loves the "Listener Event Graph Objects (LEGO)" paradigm

It seems clear we need to find a Python library that supports listener event graphs.

The boss proposed we use DESpy (https://pypi.org/project/DESpy). I think he likes it because it explicitly supports event graphs and is in fact maintained by the author of the above papers. Unfortunately, I find it confusing to learn, with almost no documentation and the last commit was over one year ago.

So, I might try to convince the boss we should use SimPy instead. But, I don't know yet if SimPy is appropriate, given our team's desire to use listener event graphs. Can someone please confirm if SimPy would be appropriate?

Peter Stahlecker

unread,
Oct 12, 2023, 2:10:29 PM10/12/23
to python-simpy
There is simpy, a python library, which is very good for simulations.
I have no idea, whether it is any good for DES.

is...@oakland.edu

unread,
Oct 12, 2023, 7:41:47 PM10/12/23
to python-simpy
A bunch of years ago I built some large simulation models using SimKit, an event-graph based Java library that was also developed by Arnie Buss. I really like the event-graph framework but I'm not a huge fan of Java. With Python being my tool of choice, I've been hoping for event-graph based library and finally stumbled onto DESpy last year. In the mean time I had started using SimPy and wrote a few blog posts that you might find useful (I also teach a short simulation with SimPy module within on of the Python analytics courses I teach). While I like SimPy, I was still a little iffy on going all in on it.  The alternative to DESpy for me would seem to be SimPy perhaps with desmod (which uses SimPy under the hood). So, I reached out to Arnie Buss for his thoughts on DESpy and it's future direction. . I don't think he'd mind if I shared what he wrote to me. Hopefully some of this info is helpful to you.

---------- START ----------

The documentation for DESpy is rather minimal – partly due to my limited capacity (and the fact that I use Simkit for all my projects). However, it is does have all the essential features of Simkit in terms of modeling, with some exceptions due to limitations of Python itself. None of these are showstoppers, however. (For example, Python doesn’t support method overloading, which is a bit of a pain for directly porting Event Graph models that have overloaded event names.)

 

Specifically, it has the same event listener paradigm and the state notification features of Simkit, albeit with slightly different names. I try to code in the idioms of the language (although I’m sure that I code Python with a Java accent). I also uses the opportunity to correct some unfortunate names I used in Simkit. For example, the call to schedule an event is waitDelay() in Simkit, but schedule() in DESpy. Rather than firePropertyChange() in Simkit (which use Java’s PropertyChangeEvent objects), in DESpy the call is notify_state_change(). Also, I ditched the old value in these calls, since in Simkit that was something that came along with their PropertyChange approach.

 

So far, the material to get started is what I have presented in one or two lectures to the OA3302 class. I didn’t have time to go into the sim event listener approach, since only basic Event Graphs are taught, and I didn’t have time. I have put the materials on Gitlab here: https://github.com/ahbuss/Intro2DESpy.git

 

It has some slides, some documentation, and (probably most helpful) sample code in the oa3302 directory. Again, these are very basic examples.

 

The best way to install DESpy is from PyPi using pip (one of the best things about Python, in my opinion). In the DESpy Gihub repo, there are a number of examples that illustrate sim event listening and such (https://github.com/ahbuss/DESpy.git)

---------- END -------------

cesar amable

unread,
Oct 12, 2023, 11:30:11 PM10/12/23
to Peter Stahlecker, python-simpy



Trying to answer your inquiry I am referring to the Simpy documentation with an explanation of the general capabilities, which I like to use for discrete event simulation (DES) of logistic  systems.  Simpy does not have event graph capabilities though.  I am pretty sure you can add code or add another package to cover that requirement but to find out will require of additional research. So,, as is, is not appropriate for LEGO.

"SimPy is a process-based discrete-event simulation framework based on standard Python. Its event dispatcher is based on Python’s generators and can also be used for asynchronous networking or to implement multi-agent systems (with both, simulated and real communication)."

"Processes in SimPy are simple Python generator functions and are used to model active components like customers, vehicles or agents. SimPy also provides various types of shared resources to model limited capacity congestion points (like servers, checkout counters and tunnels). From version 3.1, it will also provide monitoring capabilities to aid in gathering statistics about resources and processes."

Good luck,




------ Original Message ------
From "Peter Stahlecker" <peter.st...@gmail.com>
To "python-simpy" <python...@googlegroups.com>
Date 10/12/2023 1:10:29 PM
Subject [SimPy] Re: Is SimPy appropriate for the "Listener Event Graph Objects" Framework?

--
You received this message because you are subscribed to the Google Groups "python-simpy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-simpy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/766bc8bb-2ddd-4514-9baa-5da1b14a47d5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages