Previous topic

TIME_FIELD_NAME

This Page

Process

class nepidemix.process.Process(runNodeUpdate=True, runEdgeUpdate=True, runNetworkUpdate=True, constantTopology=False)

Base class/interface for a NepidemiX process.

As a general network is just a collection of nodes and edges it is up to the process specification to determine how node and edge states are represented. Each process model could in theory operate on its own interpretation of these entities. This flexibility however means that it must also be up to the process to initialize the network and to deduce unique names for node and edge states for the simulation.

When defining a process inherit from this interface and overload appropriate methods from the list below. You should only ignore overloading methods for which entities your process will leave unchanged. E.g. if your process don’t have any edge states you may safely ignore the ‘Edge’-methods, or if you know that there will be no global network topology changes leave the ‘networkUpdateRule’.

It is seldom necessary to derive directly from Process. Consider nepidemix.ExplicitStateProcess which represents states as a python dictionary and have the initialization and deduce-methods filled in.

Notes

List of methods to overload

nodeUpdateRule(...)
For state changes to individual nodes.
edgeUpdateRule(...)
For state changes to individual edges.
networkUpdateRule(...)
For global network state changes, such as topology changes.
initializeNetworkNodes(...)
Network node initialization to boundary conditions.
initializeNetworkEdges(...)
Network node initialization to boundary conditions.
initializeNetwork(...)
Perform initialization of global network conditions.
deduceNodeState(...)
From whatever representation the process has of a node return its state.
deduceEdgeState(...)
From whatever representation the process has of an edge return its state.

See method documentation for interface specifications.

List of class attributes that affects simulation

runNodeUpdate
If set True the simulation will execute nodeUpdateRule for each node in each iteration. If false the update will be skipped.
runEdgeUpdate
If set True the simulation will execute edgeUpdateRule for each edge in each iteration. If false the update will be skipped.
runNetworkUpdate
If set True the simulation will execute meanFieldUpdateRule for in each iteration. If false the update will be skipped.
constantTopology
If set to True this indicates to the simulation that the network topology remains unchanged between iterations, and indicates to the Simulation that it may optimize by not running some undefined updates. If set to false a full topology copy will be performed and this also overrides any run[Node/Edge/Network]Update flags set to False, forcing the updates.

Methods

deduceEdgeState(edge) Gives the state of an edge.
deduceNodeState(node) Gives the state of a node.
edgeUpdateRule(edge, srcNetwork, dt) Perform local edge change.
initializeNetwork(network, *args, **kwargs) Perform initialization on global network options.
initializeNetworkEdges(network, *args, **kwargs) Set initial edge states and parameters to a network.
initializeNetworkNodes(network, *args, **kwargs) Set initial states and parameters to a network.
networkUpdateRule(network, dt) Perform update to global network structure and attributes.
nodeUpdateRule(node, srcNetwork, dt) Perform local node changes.
__init__(runNodeUpdate=True, runEdgeUpdate=True, runNetworkUpdate=True, constantTopology=False)
Parameters :

runNodeUpdate : bool, optional

If set True the simulation will execute nodeUpdateRule for each node in each iteration. If false the update will be skipped. Default value: True

runEdgeUpdate : bool, optional

If set True the simulation will execute edgeUpdateRule for each edge in each iteration. If false the update will be skipped. Default value: True

runNetworkUpdate : bool, optional

If set True the simulation will execute meanFieldUpdateRule for in each iteration. If false the update will be skipped. Default value: True

constantTopology : bool, optional

If set to True this indicates to the simulation that the network topology remains unchanged between iterations, and indicates to the Simulation that it may optimize by not running some undefined updates. If set to false a full topology copy will be performed and this also overrides any run[Node/Edge/Network]Update flags set to False, forcing the updates. Default value: False

Methods

__init__([runNodeUpdate, runEdgeUpdate, ...])
Parameters:
deduceEdgeState(edge) Gives the state of an edge.
deduceNodeState(node) Gives the state of a node.
edgeUpdateRule(edge, srcNetwork, dt) Perform local edge change.
initializeNetwork(network, *args, **kwargs) Perform initialization on global network options.
initializeNetworkEdges(network, *args, **kwargs) Set initial edge states and parameters to a network.
initializeNetworkNodes(network, *args, **kwargs) Set initial states and parameters to a network.
networkUpdateRule(network, dt) Perform update to global network structure and attributes.
nodeUpdateRule(node, srcNetwork, dt) Perform local node changes.