Skip to content

Latest commit

 

History

History
81 lines (51 loc) · 2.42 KB

processsequence.rst

File metadata and controls

81 lines (51 loc) · 2.42 KB

ProcessSequence: A process built from other processes

epydemic

ProcessSequence

Building the process

The process sequence essentially just composes the methods of the individual component processes at each phase of the process' lifecycle.

ProcessSequence.reset

ProcessSequence.build

ProcessSequence.setUp

ProcessSequence.tearDown

ProcessSequence.results

Equilibrium and termination

The default implementations work on timeouts respected across all the component processes. They can be re-defined to provide different equilibrium detection overall.

ProcessSequence.atEquilibrium

ProcessSequence.setMaximumTime

ProcessSequence.maximumTime

Anonymous and non-anonymous sequences

Process sequences are built from smaller component processes passed in the constructor. In most cases these processes are anonymous and constructed from a list, and there's no way to refer to each component process individually. This is the best way as it maximises the independence of process code.

Note

Versions of epydemic prior to version 1.9.1 had only anonymous process sequences.

There are however some complicated cases where one component needs access to another. A good example of this is combining addition-deletion and disease processes, where the addition operation needs to affect the compartment of new nodes. In that case, one process needs to be able to access the methods on another.

A non-anonymous process sequence is created using a dict from component process names (strings) to component processes. There are no default names, for maximum flexibility. One component process can then refer to another by using its name, by first using Process.container to acquire its container and then looking-up the required component process.

ProcessSequence.processes

ProcessSequence.processNames

ProcessSequence.get

ProcessSequence.__getitem__

ProcessSequence.allProcesses

Note

See the cookbook recipe dynamic-population for an extended example of using process sequences in different ways.