Epidemic Simulation Problem

Generally speaking, when modelling dynamic systems you need at least:

A) Some persistent variable mechanism (i.e. to manage the state of your system/agents)
B) Some update mechanism (i.e. to step the system into the next iteration)

In GHPython, problem A can be solved using at least two methods: Notably the component local if "foo" not in globals() method, and the Rhino global sticky method. Both are covered in this old thread, and I’d recommend using the former, unless you need to read the system from outside the component where you iterate it. Problem B can of course be solved using a timer/trigger, or by scripting the component to update itself (recent example here).

I wrote some more notes in this topic here:

And I’d highly recommend going through @diff-arch’s excellent learning example provided here:

4 Likes