From 2732b52061181300faf05958e59467bc0fc32094 Mon Sep 17 00:00:00 2001
From: Mahmoud Bentriou <mahmoud.bentriou@centralesupelec.fr>
Date: Sun, 15 Nov 2020 15:05:05 +0100
Subject: [PATCH] Add bench SIR sim pygmalion

---
 bench/pygmalion/sim_sir.jl | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 bench/pygmalion/sim_sir.jl

diff --git a/bench/pygmalion/sim_sir.jl b/bench/pygmalion/sim_sir.jl
new file mode 100644
index 0000000..f14a474
--- /dev/null
+++ b/bench/pygmalion/sim_sir.jl
@@ -0,0 +1,35 @@
+
+using BenchmarkTools
+using pygmalion
+using MarkovProcesses
+
+println("Pygmalion:")
+
+str_m = "sir_ctmc"
+str_d = "abc_sir_ctmc"
+pygmalion.load_model(str_m)
+str_oml = "X_I,R,time"
+ll_om = split(str_oml, ",")
+x0 = State(95.0, 5.0, 0.0, 0.0, 0.0)
+p_true = Parameters(0.0012, 0.05)
+u = Control(100.0)
+tml = 1:400
+g_all = create_observation_function([ObserverModel(str_oml, tml)]) 
+b1_pyg = @benchmark pygmalion.simulate($f, $g_all, $x0, $u, $p_true; on = nothing, full_timeline = true)
+b2_pyg = @benchmark pygmalion.simulate(f, g_all, x0, u, p_true; on = nothing, full_timeline = true)
+
+@timev pygmalion.simulate(f, g_all, x0, u, p_true; on = nothing, full_timeline = true)
+@show minimum(b1_pyg), mean(b1_pyg), maximum(b1_pyg)
+@show minimum(b2_pyg), mean(b2_pyg), maximum(b2_pyg)
+
+println("MarkovProcesses:")
+
+MarkovProcesses.load_model("SIR")
+SIR.time_bound = 100.0
+b1 = @benchmark MarkovProcesses.simulate($SIR)
+b2 = @benchmark MarkovProcesses.simulate(SIR)
+
+@timev MarkovProcesses.simulate(SIR)
+@show minimum(b1), mean(b1), maximum(b1)
+@show minimum(b2), mean(b2), maximum(b2)
+
-- 
GitLab