| | |
| Parameters settings: |
| q1 ⟵ 0.9; q2 ⟵ 0.99; |
| | normalContactTimes ⟵ 6; |
| | gatheringContactTimes ⟵ 80; |
| initialInfectNum ⟵ 100; |
| medicalLevel ⟵ 0.0413; |
| |
| //Initialize the adjacency matrix according to the value of normalContactTimes and gatheringContactTimes |
| //Initialize the number of cell with states E and I according to the value of initialInfectNum |
| for t ⟵ 1 to simulatedTimeStep |
| do for i ⟵ 1 to populationNum |
| if state(t, i) = S && anyNeighborOfCell(i) = E or I && infectRate ≥ rand |
| | then state(t + 1, i) ⟵ E; |
| if state(t, i) = E && probTurnToInfected ≥ rand && q2 ≥ rand then state(t + 1, i) ⟵ H; |
| if state(t, i) = E && probTurnToInfected ≥ rand %% q2 < r and then state(t + 1, i) ⟵ I; |
| if state(t, i) = S or E && anyNeighborOfCell(i) = I or H && daysAfterContact(i, indexOfThisNeighbor) < 14 && q1 > rand then state(t + 1, i) ⟵ Eq; |
| if state(t, i) = I && anyNeighborOfCell(i) = H then state(t + 1, i)⟵H; |
| if state(t, i) = I && 1/(1 + exp((10 − timeLongInfected(i))/2)) < rand && q2 > rand |
| | then state(t + 1, i) ⟵ H; |
| if state(t, i) = E && probTurnToInfected < rand && probESelfHealing ≥ rand |
| then state(t + 1, i) ⟵ R; |
| | if state(t, i) = I && 1/(1 + exp((10 − timeLongInfected(i))/2))> = rand |
| && 1 − medicalLevel < rand then state(t + 1, i) ⟵ R; |
| | if state(t, i) = I && 1/(1 + exp((10 − timeLongInfected(i))/2)) ≥ rand |
| && 1 − medicalLevel ≥ rand then state(t+1, i) ⟵ D; |
| | if state(t, i) = Eq && probTurnToInfected ≥ rand then state(t + 1, i) ⟵ H; |
| | if state(t, i) = Eq && probTurnToInfected < rand && probEqSelfHealing ≥ rand |
| | then state(t + 1, i) ⟵ R; |
| | if state(t, i) = H && 1/(1 + exp((10 − timeLongInfected(i))/2)) ≥ rand. |
| && 1 − medicalLevel < rand then state(t + 1, i) ⟵ R. |
| if state(t, i) = H && 1/(1 + exp((10 − timeLongInfected(i))/2)) ≥ rand |
| && 1 − medicalLevel ≥ rand then state(t + 1, i) ⟵ D |
| //update daysAfterContact matrix and adjacency matrix |