Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Peter Jentsch
CovidAlertABM
Commits
61883b87
Commit
61883b87
authored
Jun 14, 2021
by
Peter Jentsch
Browse files
degree dependent initial conditions
parent
d692122d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
23 deletions
+27
-23
CovidAlertVaccinationModel/abm_sensitivity_analysis.jl
CovidAlertVaccinationModel/abm_sensitivity_analysis.jl
+0
-8
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
+2
-4
CovidAlertVaccinationModel/src/ABM/model_setup.jl
CovidAlertVaccinationModel/src/ABM/model_setup.jl
+2
-2
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
+0
-0
CovidAlertVaccinationModel/src/ABM/solve.jl
CovidAlertVaccinationModel/src/ABM/solve.jl
+17
-4
CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl
CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl
+2
-1
CovidAlertVaccinationModel/test/ABM/output_test.jl
CovidAlertVaccinationModel/test/ABM/output_test.jl
+4
-4
timeseries.pdf
timeseries.pdf
+0
-0
No files found.
CovidAlertVaccinationModel/abm_sensitivity_analysis.jl
View file @
61883b87
...
...
@@ -8,14 +8,6 @@ const samples = 10
const
len
=
10
#number of points to evaluate
gr
()
#add beta
#run model without vaccination
#use derivative of log of no infections to calibrate p
#seed inital infections according to degree
#total number of notifications
#age structured vaccination
#
const
univarate_test_list
=
(
# (:I_0_fraction, range(0.0, 0.05; length = len)),
# (:base_transmission_probability, range(0.0002, 0.002; length = len)),
...
...
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
View file @
61883b87
...
...
@@ -10,7 +10,7 @@ struct GraphEdge
end
"""
Define a hash on GraphEdge such that
`
`hash(a,b) = hash(b,a)`
`
(hash is commutative).
Define a hash on GraphEdge such that `hash(a,b) = hash(b,a)` (hash is commutative).
This is helpful because then we only need to store (a,b) in the graph edges weights dictionary, rather than both (a,b) and (b,a).
"""
...
...
@@ -238,9 +238,7 @@ function fast_chung_lu(pop_i,mixing_dist)
return
GraphEdge
.
(
stubs_i
,
stubs_j
)
end
neighbors
(
g
::
WeightedGraph
,
i
)
=
neighbors
(
g
.
g
,
i
)
neighbors
(
g
::
WeightedGraph
,
i
)
=
LightGraphs
.
neighbors
(
g
.
g
,
i
)
get_weight
(
g
::
WeightedGraph
,
e
)
=
g
.
weights_dict
[
e
]
function
Base.show
(
io
::
IO
,
g
::
WeightedGraph
)
print
(
io
,
"WG
$
(ne(g.g))"
)
...
...
CovidAlertVaccinationModel/src/ABM/model_setup.jl
View file @
61883b87
...
...
@@ -3,7 +3,7 @@ function get_parameters()#(0.0000,0.00048,0.0005,0.16,-1.30,-1.24,-0.8,0.35,0.35
sim_length
=
500
,
num_households
=
5000
,
I_0_fraction
=
0.003
,
β_y
=
0.001
1
,
β_y
=
0.001
095
,
β_m
=
0.00061
,
β_o
=
0.04
,
α_y
=
0.4
,
...
...
@@ -15,7 +15,7 @@ function get_parameters()#(0.0000,0.00048,0.0005,0.16,-1.30,-1.24,-0.8,0.35,0.35
π_base_o
=
-
0.95
,
η
=
0.0
,
κ
=
0.0
,
ω
=
0.005
6
,
ω
=
0.005
5
,
ω_en
=
0.00
,
Γ
=
1
/
7
,
ξ
=
5.0
,
...
...
CovidAlertVaccinationModel/src/ABM/parameter_planes.jl
0 → 100644
View file @
61883b87
CovidAlertVaccinationModel/src/ABM/solve.jl
View file @
61883b87
...
...
@@ -142,12 +142,25 @@ function weighted_degree(node,network::TimeDepMixingGraph)
return
weighted_degree
end
function
sample_initial_nodes
(
nodes
,
graphs
,
I_0_fraction
)
weighted_degrees
=
zeros
(
nodes
)
for
v
in
1
:
nodes
for
g
in
graphs
for
w
in
neighbors
(
g
,
v
)
weighted_degrees
[
v
]
+=
get_weight
(
g
,
GraphEdge
(
v
,
w
))
end
end
end
wv
=
Weights
(
weighted_degrees
./
sum
(
weighted_degrees
))
num
=
round
(
Int
,
nodes
*
I_0_fraction
)
init_indices
=
sample
(
Random
.
default_rng
(
Threads
.
threadid
()),
1
:
nodes
,
wv
,
num
;
replace
=
false
)
return
init_indices
end
function
solve!
(
modelsol
,
recordings
...
)
init_indices
=
rand
(
Random
.
default_rng
(
Threads
.
threadid
()),
1
:
modelsol
.
nodes
,
round
(
Int
,
modelsol
.
nodes
*
modelsol
.
params
.
I_0_fraction
))
for
t
in
1
:
modelsol
.
sim_length
function
solve!
(
modelsol
,
recordings
...
)
init_indices
=
sample_initial_nodes
(
modelsol
.
nodes
,
modelsol
.
inf_network
.
graph_list
[
begin
],
modelsol
.
params
.
I_0_fraction
)
for
t
in
1
:
modelsol
.
sim_length
#this also resamples the soc network weights since they point to the same objects, but those are never used
if
t
>
1
remake!
(
t
,
modelsol
.
inf_network
,
modelsol
.
index_vectors
,
modelsol
.
demographics
)
...
...
CovidAlertVaccinationModel/src/CovidAlertVaccinationModel.jl
View file @
61883b87
...
...
@@ -53,7 +53,8 @@ include("ABM/model_setup.jl")
include
(
"ABM/parameter_optimization.jl"
)
include
(
"ABM/output.jl"
)
include
(
"ABM/solve.jl"
)
include
(
"ABM/abm.jl"
)
include
(
"ABM/abm.jl"
)
include
(
"ABM/parameter_planes.jl"
)
include
(
"IntervalsModel/intervals_model.jl"
)
include
(
"IntervalsModel/interval_overlap_sampling.jl"
)
...
...
CovidAlertVaccinationModel/test/ABM/output_test.jl
View file @
61883b87
...
...
@@ -25,15 +25,15 @@ using Random
println
(
"obs postinf vac:
$
total_postinf_vaccination,target:
$
target_postinf_vac"
)
@test
all
(
abs
.
(
final_size
.-
target_final_size
)
.<
[
75
,
100
,
25
])
@test
all
(
abs
.
(
total_preinf_vaccination
.-
target_preinf_vac
)
.<
[
50
,
100
,
25
])
@test
all
(
abs
.
(
total_postinf_vaccination
.-
target_postinf_vac
)
.<
[
120
,
1
0
0
,
25
])
@test
all
(
abs
.
(
total_postinf_vaccination
.-
target_postinf_vac
)
.<
[
120
,
1
2
0
,
40
])
end
@testset
"perf"
begin
b
=
@belapsed
CovidAlertVaccinationModel
.
bench
()
@test
4.
2
<
b
<
4.
8
5
if
Threads
.
nthreads
()
==
2
0
@test
4.
0
<
b
<
4.5
if
Threads
.
nthreads
()
==
2
5
b
=
@belapsed
CovidAlertVaccinationModel
.
threaded_bench
()
@test
1
0.65
<
b
<
1
5
.00
@test
1
2.0
<
b
<
1
6
.00
else
display
(
"incorrect number of threads, skipping threaded perf test"
)
end
...
...
timeseries.pdf
View file @
61883b87
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment