# Modeling and Analyzing Transmission of Infectious Diseases Using Generalized Stochastic Petri Nets
## 3 Modeling the Transmission of Infectious Diseases Using GSPN
### The GSPN-Based General Transmission Model of Infectious Diseases  
Based on infectious diseases evolution and transmission process which are shown in Figure 2, we propose the GSPN framework to build the model of the transmission of infectious diseases from the system-level understanding as follows. * Step 1: Build GSPN model. Define the places, the timed transitions, and the immediate transitions. Estimate the cycle time and obtain the virus spread states. * Step 2: Generate the reachability graph; it allows us to compute all possible future markings starting from the initial one. Assign each arc with corresponding firing rates, and then generate the homogeneous state-transition Markov chain. All markings are denoted as \(M_{0},M_{1},\ldots,M_{n-1}\), where \(n\) is the total number of states. Markings in which at least one immediate transition are enabled are called vanishing markings. On the other hand, markings in which only exponential transitions are enabled are called tangible markings. * Step 3: Analyze Markov Chain. The obtained reachability graph can be transformed into a Markov model to calculate limiting state probabilities. Next, the steady state probability of tangible markings \(P[M_{i}]\) can be calculated by solving the equation group as follows: \[P=(P[M_{0}],P[M_{1}],...,P[M_{n-1}])\] (1) \[\left\{ \begin{array}{l}PQ=0\\ \sum_{i=0}^{n-1}P[M_{i}]=1\end{array} \right.\] (2) where \(n\) is number of states in the model, \(i=\{0,1,\ldots,n-1\}\). \(P\) is the state probability vector, and \(Q\) is the infinitesimal generator (transition probability matrix). \(Q=[q_{ij}]\), \(i=\{0,1,\ldots,n-1\}\) and \(j=\{0,1,\ldots,n-1\}\). For the elements \(q_{ij}\) outside the main diagonal, if there is an arc from state \(M_{i}\) to state \(M_{j}\), then the value is the firing rate \(\lambda_{k}\) of the exponential distribution associated with the transition \(T_{k}\) from \(M_{i}\) to \(M_{j}\); if there is no arc connected, then this element is 0. The element \(q_{ii}\) on the main diagonal follows \(-\left(\sum_{i\
eq j}q_{ij}\right)\) that consequently makes the sum of each row equal to zero. * Step 4: Analyze and evaluate system performance. After calculating the probability of tangible markings, the token probability density function (PDF) can be calculated which represents the steady state the probability of the number of tokens contained in a place. For a \(p_{i}\in P\), let \(P[M_{p_{i}}=l]\) denote the probability of \(l\) tokens contained in place \(p_{i}\), then the token probability density function can be obtained as  
\[P[M_{p_{i}}=l]=\sum_{i=0}^{n-1}P[M_{i}=l] \tag{3}\]  
The average number of tokens (\(U_{l}\)) can be calculated by  
\[U_{i}=\sum_{i=0}^{n-1}l\times P[M_{p_{i}}=l] \tag{4}\]  
where in the proposed model, \(l=0\) or \(l=1\) means that all places can only contain 0 or 1 token. The performance of the infectious disease epidemic propagation and evolution system described by GSPN is analyzed and evaluated. The proposed GSPN model shown in Figure 3 is realized with PIPE tool [51]. In Figure 3, the places, i.e., P1-P19 are drawn as circles, the immediate transitions i.e., T4, T11, T13, T14, T16 are represented by filled rectangles, the timed transitions i.e., T1-T3, T5-T10, T12, T15 are represented by hollow rectangles, and the circle-headed arcs from P18 to T3 and from P17 to T14 are inhibitor arcs. Table 1 shows the meanings of places. The meanings and category of transitions are shown in Table 2. The overall model depicts the infection process in details, consisting of three phases as follows. (1) The beginning of the infection and immunization phase. This phase is the process of infection and immunity. P1 is the beginning of the virus spread. T1 represents that the virus starts to infect intermediate hosts. P19 represents the susceptible population. T12 is a timed and key transition that represents whether the vaccine is successfully developed and vaccinated. If all of susceptible people have been vaccinated, the virus will not be able to spread.