Skip to content

Commit 61ac216

Browse files
committed
facing parsing issues when using ports and state variables. Some examples of rules that compile and other examples that does not compile
1 parent 23c90ef commit 61ac216

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

epidemic_hoya_et_al/SIR_Hoya.ma

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include(SIR_Hoya_macros.inc)
12
[top]
23
components : population
34

@@ -12,13 +13,47 @@ neighbors : population(-1,0)
1213
neighbors : population(1,0)
1314

1415
initialvalue : 0
15-
InitialCellsValue : SIR_Hoya.val
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
1633

1734
localtransition : infections
1835

36+
1937
[infections]
2038

21-
rule : {(0,0)} 1000 { t }
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);
2257

2358
% neighbors : population(-1,-1) population(-1,0) population(-1,1)
2459
% neighbors : population(1,-1) population(1,0) population(1,1)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#BeginMacro(e) %recovery rate [0,1]
2+
0.5
3+
#EndMacro
4+
5+
#BeginMacro(v) %virulence of the epidemic [0,1]
6+
0.5
7+
#EndMacro
8+
9+
#BeginMacro(effect_neighbours)
10+
0.45
11+
#EndMacro
12+
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)