Commit a9a7a453 authored by Bentriou Mahmoud's avatar Bentriou Mahmoud
Browse files

macro network_model is a bit more tested

parent e1f79988
using MarkovProcesses
test_all = true
model_SIR = @network_model begin
R1: (S+I => 2I, ki*S*I)
R2: (I => R, kr*I)
......@@ -9,6 +11,10 @@ set_x0!(model_SIR, [95,5,0])
set_param!(model_SIR, [0.012, 0.05])
simulate(model_SIR)
test_all = test_all && keys(model_SIR.map_var_idx) == Set([:S, :I, :R]) &&
keys(model_SIR.map_param_idx) == Set([:ki, :kr])
model_unnamed_SIR = @network_model begin
R1: (S+I => 2I, ki*S*I)
R2: (I => R, kr*I)
......@@ -17,6 +23,9 @@ set_x0!(model_unnamed_SIR, [95,5,0])
set_param!(model_unnamed_SIR, [0.012, 0.05])
simulate(model_unnamed_SIR)
test_all = test_all && keys(model_unnamed_SIR.map_var_idx) == Set([:S, :I, :R]) &&
keys(model_unnamed_SIR.map_param_idx) == Set([:ki, :kr])
model_ER = @network_model begin
R1: (E+S => ES, k1*E*S)
R2: (ES => E+S, k2*ES)
......@@ -26,18 +35,26 @@ set_x0!(model_ER, [100,100,0,0])
set_param!(model_ER, [1.0,1.0,1.0])
simulate(model_ER)
test_all = test_all && keys(model_ER.map_var_idx) == Set([:E, :S, :ES, :P]) &&
keys(model_ER.map_param_idx) == Set([:k1, :k2, :k3])
model_birth_death = @network_model begin
Birth: (X => 2X, λ*X)
Death: (X => , μ*X)
end "Birth-death process"
test_all = test_all && keys(model_birth_death.map_var_idx) == Set([:X]) &&
keys(model_birth_death.map_param_idx) == Set([:λ, :μ])
model_birth_death_2 = @network_model begin
Birth: (X => 2X, λ*X)
Death: (X => 0, μ*X)
end "Birth-death process"
test_all = test_all && keys(model_birth_death_2.map_var_idx) == Set([:X]) &&
keys(model_birth_death_2.map_param_idx) == Set([:λ, :μ])
return true
return test_all
#=
@network_model "test1" begin
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment