Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MarkovProcesses.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bentriou Mahmoud
MarkovProcesses.jl
Commits
bae6e938
Commit
bae6e938
authored
4 years ago
by
Bentriou Mahmoud
Browse files
Options
Downloads
Patches
Plain Diff
change of model names
parent
300e9ec8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bench/pkg/catalyst.jl
+73
-6
73 additions, 6 deletions
bench/pkg/catalyst.jl
models/ER.jl
+1
-1
1 addition, 1 deletion
models/ER.jl
models/SIR.jl
+1
-1
1 addition, 1 deletion
models/SIR.jl
with
75 additions
and
8 deletions
bench/pkg/catalyst.jl
+
73
−
6
View file @
bae6e938
...
...
@@ -4,14 +4,17 @@ using MarkovProcesses
using
Catalyst
using
DiffEqJump
path_latex
=
"./"
# Bench 1: A long simulation of ER
load_model
(
"ER"
)
set_param!
(
ER
,
:
k1
,
0.2
)
set_param!
(
ER
,
:
k2
,
40.0
)
ER
.
buffer_size
=
100
ER
.
estim_min_states
=
8000
b_pkg
=
@benchmark
simulate
(
ER
)
@show
minimum
(
b_pkg
),
mean
(
b_pkg
),
maximum
(
b_pkg
)
bench1_pkg
=
@benchmark
simulate
(
ER
)
rs
=
@reaction_network
begin
c1
,
S
+
E
-->
SE
...
...
@@ -21,14 +24,78 @@ end c1 c2 c3
p
=
(
0.2
,
40.0
,
1.0
)
# [c1,c2,c3]
tspan
=
(
0.
,
100.
)
u0
=
[
100.
,
100.
,
0.
,
0.
]
# [S,E,SE,P]
# solve JumpProblem
dprob
=
DiscreteProblem
(
rs
,
u0
,
tspan
,
p
)
jprob
=
JumpProblem
(
rs
,
dprob
,
Direct
())
jsol
=
solve
(
jprob
,
SSAStepper
())
b_catalyst
=
@benchmark
solve
(
jprob
,
SSAStepper
())
@show
minimum
(
b_catalyst
),
mean
(
b_catalyst
),
maximum
(
b_catalyst
)
bench1_catalyst
=
@benchmark
solve
(
jprob
,
SSAStepper
())
str_latex_bench1
=
"
\\
begin{tabular}{|c|c|c|c|c|}
\\
hline
Bench 1 & Mean time (ms) & Max. time (ms) &
Min. time (ms) &
\\
begin{tabular}[c]{@{}c@{}}Mean
\\\\
Memory (KB)
\\
end{tabular}
\\\\
\\
hline
Package &
$
(round(time(mean(bench1_pkg))/1E6, digits=2)) &
$
(round(time(maximum(bench1_pkg))/1E6, digits=2)) &
$
(round(time(minimum(bench1_pkg))/1E6, digits=2)) &
$
(round(memory(mean(bench1_pkg))/1024, digits=2))
\\\\
\\
hline
Catalyst.jl &
$
(round(time(mean(bench1_catalyst))/1E6, digits=2)) &
$
(round(time(maximum(bench1_catalyst))/1E6, digits=2)) &
$
(round(time(minimum(bench1_catalyst))/1E6, digits=2)) &
$
(round(memory(mean(bench1_catalyst))/1024, digits=2))
\\\\
\\
hline
\\
end{tabular}"
# Bench 2: Creation of model + a long simulation of ER
bench2_pkg
=
@benchmark
begin
ER
=
@network_model
begin
R1
:
(
E
+
S
=>
ES
,
k1
*
E
*
S
)
R2
:
(
ES
=>
E
+
S
,
k2
*
ES
)
R3
:
(
ES
=>
E
+
P
,
k3
*
ES
)
end
"ER"
set_param!
(
ER
,
:
k1
,
0.2
)
set_param!
(
ER
,
:
k2
,
40.0
)
ER
.
buffer_size
=
100
ER
.
estim_min_states
=
8000
simulate
(
ER
)
end
bench2_catalyst
=
@benchmark
begin
rs
=
@reaction_network
begin
c1
,
S
+
E
-->
SE
c2
,
SE
-->
S
+
E
c3
,
SE
-->
P
+
E
end
c1
c2
c3
p
=
(
0.2
,
40.0
,
1.0
)
# [c1,c2,c3]
tspan
=
(
0.
,
100.
)
u0
=
[
100.
,
100.
,
0.
,
0.
]
# [S,E,SE,P]
# solve JumpProblem
dprob
=
DiscreteProblem
(
rs
,
u0
,
tspan
,
p
)
jprob
=
JumpProblem
(
rs
,
dprob
,
Direct
())
jsol
=
solve
(
jprob
,
SSAStepper
())
end
str_latex_bench2
=
"
\\
begin{tabular}{|c|c|c|c|c|}
\\
hline
Bench 1 & Mean time (ms) & Max. time (ms) &
Min. time (ms) &
\\
begin{tabular}[c]{@{}c@{}}Mean
\\\\
Memory (KB)
\\
end{tabular}
\\\\
\\
hline
Package &
$
(round(time(mean(bench2_pkg))/1E6, digits=2)) &
$
(round(time(maximum(bench2_pkg))/1E6, digits=2)) &
$
(round(time(minimum(bench2_pkg))/1E6, digits=2)) &
$
(round(memory(mean(bench2_pkg))/1024, digits=2))
\\\\
\\
hline
Catalyst.jl &
$
(round(time(mean(bench2_catalyst))/1E6, digits=2)) &
$
(round(time(maximum(bench2_catalyst))/1E6, digits=2)) &
$
(round(time(minimum(bench2_catalyst))/1E6, digits=2)) &
$
(round(memory(mean(bench2_catalyst))/1024, digits=2))
\\\\
\\
hline
\\
end{tabular}"
@show
minimum
(
bench1_pkg
),
mean
(
bench1_pkg
),
maximum
(
bench1_pkg
)
@show
minimum
(
bench1_catalyst
),
mean
(
bench1_catalyst
),
maximum
(
bench1_catalyst
)
#plot(jsol,lw=2,title="Gillespie: Michaelis-Menten Enzyme Kinetics")
open
(
path_latex
*
"bench1.tex"
,
"w+"
)
do
io
write
(
io
,
str_latex_bench1
)
end
;
open
(
path_latex
*
"bench2.tex"
,
"w+"
)
do
io
write
(
io
,
str_latex_bench2
)
end
;
This diff is collapsed.
Click to expand it.
models/ER.jl
+
1
−
1
View file @
bae6e938
...
...
@@ -52,7 +52,7 @@ isabsorbing_ER(p::Vector{Float64},xn::Vector{Int}) =
@inbounds
(
p
[
1
]
*
xn
[
1
]
*
xn
[
2
]
+
(
p
[
2
]
+
p
[
3
])
*
xn
[
3
]
===
0.0
)
g_ER
=
[
:
P
]
ER
=
ContinuousTimeModel
(
d
,
k
,
dict_var_ER
,
dict_p_ER
,
l_tr_ER
,
p_ER
,
x0_ER
,
t0_ER
,
ER_f!
,
isabsorbing_ER
;
g
=
g_ER
,
name
=
"ER pkg"
)
ER
=
ContinuousTimeModel
(
d
,
k
,
dict_var_ER
,
dict_p_ER
,
l_tr_ER
,
p_ER
,
x0_ER
,
t0_ER
,
ER_f!
,
isabsorbing_ER
;
g
=
g_ER
,
name
=
"ER
SSA
pkg"
)
function
create_ER
(
new_p
::
Vector
{
Float64
})
ER_new
=
deepcopy
(
ER
)
...
...
This diff is collapsed.
Click to expand it.
models/SIR.jl
+
1
−
1
View file @
bae6e938
...
...
@@ -50,7 +50,7 @@ end
isabsorbing_SIR
(
p
::
Vector
{
Float64
},
xn
::
Vector
{
Int
})
=
(
p
[
1
]
*
xn
[
1
]
*
xn
[
2
]
+
p
[
2
]
*
xn
[
2
])
===
0.0
g_SIR
=
[
:
I
]
SIR
=
ContinuousTimeModel
(
d
,
k
,
dict_var
,
dict_p
,
l_tr_SIR
,
p_SIR
,
x0_SIR
,
t0_SIR
,
SIR_f!
,
isabsorbing_SIR
;
g
=
g_SIR
,
name
=
"SIR pkg"
)
SIR
=
ContinuousTimeModel
(
d
,
k
,
dict_var
,
dict_p
,
l_tr_SIR
,
p_SIR
,
x0_SIR
,
t0_SIR
,
SIR_f!
,
isabsorbing_SIR
;
g
=
g_SIR
,
name
=
"SIR
SSA
pkg"
)
function
create_SIR
(
new_p
::
Vector
{
Float64
})
SIR_new
=
deepcopy
(
SIR
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment