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
0254b735
Commit
0254b735
authored
Jun 18, 2021
by
Peter Jentsch
Browse files
parallel mean solve
parent
c7d64811
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
10 deletions
+19
-10
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
+0
-0
CovidAlertVaccinationModel/abm_timeseries.jl
CovidAlertVaccinationModel/abm_timeseries.jl
+2
-2
CovidAlertVaccinationModel/plots/app_heatmaps/final_size_change.pdf
...VaccinationModel/plots/app_heatmaps/final_size_change.pdf
+0
-0
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
+0
-0
CovidAlertVaccinationModel/src/ABM/model_setup.jl
CovidAlertVaccinationModel/src/ABM/model_setup.jl
+1
-1
CovidAlertVaccinationModel/src/ABM/output.jl
CovidAlertVaccinationModel/src/ABM/output.jl
+11
-5
CovidAlertVaccinationModel/src/ABM/solve.jl
CovidAlertVaccinationModel/src/ABM/solve.jl
+5
-2
timeseries.pdf
timeseries.pdf
+0
-0
No files found.
CovidAlertVaccinationModel/abm_output/η_ω_en.dat
View file @
0254b735
No preview for this file type
CovidAlertVaccinationModel/abm_timeseries.jl
View file @
0254b735
...
...
@@ -3,10 +3,10 @@ using OnlineStats
using
Plots
using
CovidAlertVaccinationModel
:
vaccination_data
,
ymo_vac
,
ymo_attack_rate
const
samples
=
10
const
samples
=
25
function
solve_and_plot_parameters
()
p
=
CovidAlertVaccinationModel
.
get_
app_
parameters
()
p
=
CovidAlertVaccinationModel
.
get_parameters
()
display
(
p
)
out
,
avg_populations
=
mean_solve
(
samples
,
p
,
DebugRecorder
)
p
=
plot_model
(
nothing
,[
nothing
],[
out
],
p
.
infection_introduction_day
,
p
.
immunization_begin_day
)
...
...
CovidAlertVaccinationModel/plots/app_heatmaps/final_size_change.pdf
View file @
0254b735
No preview for this file type
CovidAlertVaccinationModel/plots/app_heatmaps/wdg_change.pdf
View file @
0254b735
No preview for this file type
CovidAlertVaccinationModel/src/ABM/model_setup.jl
View file @
0254b735
...
...
@@ -13,7 +13,7 @@ function get_parameters()#(0.0000,0.00048,0.0005,0.16,-1.30,-1.24,-0.8,0.35,0.35
π_base_y
=
-
1.37
,
π_base_m
=
-
1.46
,
π_base_o
=
-
0.95
,
η
=
0.0
1
,
η
=
0.0
,
κ
=
0.0
,
ω
=
0.0055
,
ω_en
=
0.0
,
...
...
CovidAlertVaccinationModel/src/ABM/output.jl
View file @
0254b735
...
...
@@ -125,12 +125,15 @@ end
function
mean_solve
(
samples
,
parameter_tuple
,
recorder
;
progmeter
=
nothing
)
stat_recorder
=
recorder
(
Variance
(),
parameter_tuple
.
sim_length
)
output_recorder
=
recorder
(
0.0
,
parameter_tuple
.
sim_length
)
avg_populations
=
[
0.0
,
0.0
,
0.0
]
for
_
in
1
:
samples
sol_list
=
ThreadsX
.
map
(
1
:
samples
)
do
_
output_recorder
=
recorder
(
0.0
,
parameter_tuple
.
sim_length
)
sol
=
abm
(
parameter_tuple
,
output_recorder
)
isnothing
(
progmeter
)
||
next!
(
progmeter
)
avg_populations
.+=
length
.
(
sol
.
index_vectors
)
return
output_recorder
,
length
.
(
sol
.
index_vectors
)
end
for
(
output_recorder
,
pop
)
in
sol_list
avg_populations
.+=
pop
fit!
(
stat_recorder
,
output_recorder
)
end
avg_populations
./=
samples
...
...
@@ -140,11 +143,14 @@ end
function
mean_solve
(
samples
,
parameter_tuple
,
recorder
::
Type
{
HeatmapRecorder
};
progmeter
=
nothing
)
stat_recorder
=
recorder
(
parameter_tuple
.
sim_length
)
avg_populations
=
[
0.0
,
0.0
,
0.0
]
for
_
in
1
:
samples
sol_list
=
ThreadsX
.
map
(
1
:
samples
)
do
_
output_recorder
=
recorder
(
parameter_tuple
.
sim_length
)
sol
=
abm
(
parameter_tuple
,
output_recorder
)
isnothing
(
progmeter
)
||
next!
(
progmeter
)
avg_populations
.+=
length
.
(
sol
.
index_vectors
)
return
output_recorder
,
length
.
(
sol
.
index_vectors
)
end
for
(
output_recorder
,
pop
)
in
sol_list
avg_populations
.+=
pop
fit!
(
stat_recorder
,
output_recorder
)
end
avg_populations
./=
samples
...
...
CovidAlertVaccinationModel/src/ABM/solve.jl
View file @
0254b735
...
...
@@ -113,10 +113,13 @@ Base.@propagate_inbounds @views function update_vaccination_opinion_state!(t,mod
if
!
isempty
(
neighbors
(
random_soc_network
,
i
))
random_neighbour
=
sample
(
Random
.
default_rng
(
Threads
.
threadid
()),
neighbors
(
random_soc_network
.
g
,
i
))
if
u_vac
[
random_neighbour
]
==
u_vac
[
i
]
vac_payoff
=
π_base
[
Int
(
demographics
[
i
])]
+
total_infections
*
ω
app_vac_payoff
=
0.0
if
app_user
[
i
]
&&
time_of_last_alert
[
app_user_list
[
i
]]
>=
0
vac_payoff
+
=
Γ
^
(
-
1
*
(
t
-
time_of_last_alert
[
app_user_list
[
i
]]))
*
(
η
+
total_infections
*
ω_en
)
app_
vac_payoff
=
Γ
^
(
-
1
*
(
t
-
time_of_last_alert
[
app_user_list
[
i
]]))
*
(
η
+
total_infections
*
ω_en
)
end
vac_payoff
=
π_base
[
Int
(
demographics
[
i
])]
+
total_infections
*
ω
+
app_vac_payoff
if
u_vac
[
i
]
# display(1 - Φ(vac_payoff,ξ))
if
rand
(
Random
.
default_rng
(
Threads
.
threadid
()))
<
1
-
Φ
(
vac_payoff
,
ξ
)
...
...
timeseries.pdf
View file @
0254b735
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