Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CovidAlertABM
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
Peter Jentsch
CovidAlertABM
Commits
ff1d2569
Commit
ff1d2569
authored
3 years ago
by
Peter Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
remove inbounds checks, fix bug in edge sampling
parent
04430323
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
+1
-1
1 addition, 1 deletion
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
CovidAlertVaccinationModel/src/ABM/solve.jl
+4
-4
4 additions, 4 deletions
CovidAlertVaccinationModel/src/ABM/solve.jl
with
5 additions
and
5 deletions
CovidAlertVaccinationModel/src/ABM/mixing_graphs.jl
+
1
−
1
View file @
ff1d2569
...
...
@@ -36,7 +36,7 @@ Resample all the weights in `mixing_graph`
function
sample_mixing_graph!
(
mixing_graph
)
mixing_edges
=
mixing_graph
.
mixing_edges
for
i
in
1
:
size
(
mixing_edges
.
contact_array
)[
1
],
j
in
1
:
i
#diagonal
rand!
(
RNG
,
mixing_edges
.
sampler_matrix
[
demo_i
,
demo_
j
],
mixing_edges
.
sample_cache
[
i
,
j
])
rand!
(
RNG
,
mixing_edges
.
sampler_matrix
[
i
,
j
],
mixing_edges
.
sample_cache
[
i
,
j
])
for
k
in
1
:
length
(
mixing_edges
.
contact_array
[
i
,
j
][
1
])
kth_node_i
=
mixing_edges
.
contact_array
[
i
,
j
][
1
][
k
]
kth_node_j
=
mixing_edges
.
contact_array
[
i
,
j
][
2
][
k
]
...
...
This diff is collapsed.
Click to expand it.
CovidAlertVaccinationModel/src/ABM/solve.jl
+
4
−
4
View file @
ff1d2569
...
...
@@ -2,7 +2,7 @@
function
contact_weight
(
p
,
contact_time
)
return
1
-
(
1
-
p
)
^
contact_time
end
function
update_alert_durations!
(
t
,
modelsol
)
Base
.
@propagate_inbounds
@views
function
update_alert_durations!
(
t
,
modelsol
)
@unpack
notification_parameter
=
modelsol
.
params
@unpack
time_of_last_alert
,
app_user_index
,
inf_network
,
covid_alert_times
,
app_user
=
modelsol
for
(
i
,
node
)
in
enumerate
(
modelsol
.
app_user_index
),
mixing_graph
in
modelsol
.
inf_network
.
graph_list
[
t
]
...
...
@@ -21,7 +21,7 @@ function update_alert_durations!(t,modelsol)
end
end
function
update_infection_state!
(
t
,
modelsol
)
Base
.
@propagate_inbounds
@views
function
update_infection_state!
(
t
,
modelsol
)
@unpack
base_transmission_probability
,
immunization_loss_prob
,
recovery_rate
=
modelsol
.
params
@unpack
u_inf
,
u_vac
,
u_next_inf
,
u_next_vac
,
demographics
,
inf_network
,
status_totals
=
modelsol
...
...
@@ -64,7 +64,7 @@ function update_infection_state!(t,modelsol)
end
# display(u_next_inf)
end
function
update_vaccination_opinion_state!
(
t
,
modelsol
,
total_infections
)
Base
.
@propagate_inbounds
@views
function
update_vaccination_opinion_state!
(
t
,
modelsol
,
total_infections
)
@unpack
π_base
,
η
,
γ
,
κ
,
ω
,
ρ
,
ω_en
,
ρ_en
,
γ
,
β
=
modelsol
.
params
@unpack
demographics
,
time_of_last_alert
,
nodes
,
soc_network
,
u_vac
,
u_next_vac
,
app_user
,
app_user_list
=
modelsol
...
...
@@ -116,7 +116,7 @@ function agents_step!(t,modelsol)
remake!
(
modelsol
.
inf_network
,
modelsol
.
index_vectors
,
modelsol
.
ws_matrix_tuple
.
daily
)
remake!
(
modelsol
.
soc_network
,
modelsol
.
index_vectors
,
modelsol
.
rest_matrix_tuple
.
daily
)
for
network
in
modelsol
.
inf_network
.
graph_list
[
t
]
sample_mixing_graph!
(
network
,
modelsol
.
demographics
)
#get new contact weights
sample_mixing_graph!
(
network
)
#get new contact weights
end
update_alert_durations!
(
t
,
modelsol
)
...
...
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