Skip to content

Commit b7b35e0

Browse files
committed
version simulating. Not tested
1 parent 61ac216 commit b7b35e0

File tree

2 files changed

+39
-70
lines changed

2 files changed

+39
-70
lines changed

epidemic_hoya_et_al/SIR_Hoya.ma

Lines changed: 33 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,33 @@
1-
#include(SIR_Hoya_macros.inc)
2-
[top]
3-
components : population
4-
5-
[population]
6-
type : cell
7-
dim : (100,100)
8-
delay : transport
9-
defaultDelayTime : 1
10-
border : nowrapped
11-
neighbors : population(0,-1) population(0,0) population(0,1)
12-
neighbors : population(-1,0)
13-
neighbors : population(1,0)
14-
15-
initialvalue : 0
16-
%InitialCellsValue : SIR_Hoya.val
17-
18-
statevariables: people %population in the cell
19-
statevariables: c %connectivy between cells
20-
% 1 - 3 ways of transportation
21-
% 0.6 - 2 ways of transportation
22-
% 0.3 - 1 way of transportation
23-
% 0 - no transportation
24-
% We are assuming same connectivity for all cell, but in the original model, we should have a c for each neighbour cell
25-
26-
statevariables: m
27-
%movement factor [0, 1] probability of an infected individual from a neighbour cell moved to here. We are assuming same for all cells, but we may have a different one for each cell.
28-
29-
statevariables: i_sus i_inf i_rec
30-
statevalues: 10 1 0.5 0.9 0.1 0
31-
32-
NeighborPorts : sus inf rec pop
33-
34-
localtransition : infections
35-
36-
37-
[infections]
38-
39-
%IT DOES NOT WORK
40-
%rule : {~pop := $people;} { $i_rec := (#macro(e)+(0,1)~inf);} 1000 { t }
41-
42-
%IT DOES WORK
43-
%rule : {~pop := $people;} { $i_rec := #macro(e);} 1000 { t }
44-
45-
%IT DOES WORK
46-
rule : {~pop := $i_rec;} { $i_rec := #macro(e);} 1000 { t }
47-
48-
%IT DOES NOT WORK
49-
%rule : {~pop := $i_rec+(0,1)~inf;} { $i_rec := #macro(e);} 1000 { t }
50-
51-
%IT DOES WORK
52-
rule : {~pop := $i_rec;} { $i_rec := #macro(e);} 1000 { (0,0)~pop = 10 }
53-
54-
%
55-
%~inf:= (1-#macro(e)) * (0,0)~inf + #macro(v)*(0,0)~sus*(0,0)~inf+(0,0)~sus* #macro(effect_neighbours);
56-
%~sus := (0,0)~sus - #macro(v)*(0,0)~sus*(0,0)~inf - (0,0)~sus* #macro(effect_neighbours);
57-
58-
% neighbors : population(-1,-1) population(-1,0) population(-1,1)
59-
% neighbors : population(1,-1) population(1,0) population(1,1)
1+
#include(SIR_Hoya_macros.inc)
2+
[top]
3+
components : area
4+
5+
[area]
6+
type : cell
7+
width : 21
8+
height : 21
9+
delay : transport
10+
defaultDelayTime : 100
11+
border : wrapped
12+
neighbors : area(-1,0)
13+
neighbors : area(0,-1) area(0,0) area(0,1)
14+
neighbors : area(1,0)
15+
initialvalue : 0
16+
17+
18+
localtransition : sir-hoya-rule
19+
20+
statevariables: population v c m
21+
statevalues: 10 0.5 1 0.7
22+
23+
24+
neighborports : value infec rec pop sus
25+
26+
[sir-hoya-rule]
27+
rule : { ~pop := $population;
28+
~infec:= (1 - #macro(e)) * (0,0)~infec + $v*(0,0)~sus*(0,0)~infec + (0,0)~sus*#macro(effect_neighbours);
29+
~sus := (0,0)~sus - $v*(0,0)~sus*(0,0)~infec - (0,0)~sus*#macro(effect_neighbours);
30+
~rec := (0,0)~rec + #macro(e)*(0,0)~infec;
31+
} 100 { t }
32+
33+
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
#BeginMacro(e) %recovery rate [0,1]
1+
#BeginMacro(e)
22
0.5
33
#EndMacro
44

5-
#BeginMacro(v) %virulence of the epidemic [0,1]
6-
0.5
7-
#EndMacro
85

9-
#BeginMacro(effect_neighbours)
10-
0.45
6+
#BeginMacro(effect_neighbours)
7+
( ((1,0)~pop / $population) * (1,0)~infec * $v * $c * $m +
8+
((0,-1)~pop / $population) * (0,-1)~infec * $v * $c * $m +
9+
((0,1)~pop / $population) * (0,1)~infec * $v * $c * $m +
10+
((-1,0)~pop / $population) * (-1,0)~infec * $v * $c * $m )
1111
#EndMacro
1212

13-
%( (((0,-1)~pop/$people)*$c*$m*#macro(v)*(0,-1)~inf) +
14-
%(0,1)~pop/$people)*$c*$m*#macro(v)*(0,1)~inf) +
15-
% ((-1,0)~pop/$people)*$c*$m*#macro(v)*(-1,0)~inf) +
16-
% ((1,0)~pop/$people)*$c*$m*#macro(v)*(1,0)~inf)
17-
% )

0 commit comments

Comments
 (0)