UC-Davis-molecular-computing / ppsim

Python package for simulating population protocols
MIT License
9 stars 4 forks source link

add configurable timeout when enumerating states #39

Open dave-doty opened 2 years ago

dave-doty commented 2 years ago

I often accidentally make the set of producible states infinite. Since I know how it works, when I see that the code is taking a long time to run but there is no feedback from the simulation progress bar in a jupyter notebook, I am able to tell what's going wrong. However, I can imagine someone just thinking it's taking a long time to simulate and not realizing they accidentally make an infinite number of producible states.

A good alternative would be to have a configurable timeout (e.g., 10 seconds) as a parameter in the Simulation constructor, or a perhaps maximum number of states to produce (e.g., 105), and raising an exception if the limit is exceeded that tells the user "We've found XXX producible states so far, are you sure the set of states is finite? ppsim can only handle finite state sets". Then someone can just give a huge number if they really are willing to wait a long time, but otherwise the exception will tell them about a probable mistake in their transition function.