-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_sims.jl
57 lines (45 loc) · 1.49 KB
/
run_sims.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Distributed
addprocs(3; lazy=false)
include("gabm.jl")
include("sim_logic.jl")
## before first run:
println("precalc sets")
precalc_sets()
GC.gc()
##
unit_ids = workers()
n_units = length(unit_ids)
println("unit_ids = ",unit_ids)
function test(t; kwargs...)
x = run(t, workers(); kwargs...)
return x
end
t = 602
I0 = [2=>100,3=>100,4=>100]
pI = 0.1
t_closed = 50:400
outdir = "sim_close_wp"
nreps = 40
mkpath(outdir)
fname = "sim_p0"*string(round(Int,pI*100))*"_open"
for i in 1:nreps
println("running ",fname," ",i,"/",nreps)
serialize(outdir*"/"*fname*string(i)*".jlse",
test(t; init_inf=I0, p_inf=pI, p_inf_hh=2.0*pI, p_inf_loc=pI,
distr_fn_hh=:all, distr_fn_non_hh=:all, distr_params_hh=(), distr_params_non_hh=(),
distr_fn_loc_res=:exp, distr_params_loc_res=(4,), distr_fn_loc_work=:exp, distr_params_loc_work=(2,)
))
GC.gc()
end
fname = "sim_p0"*string(round(Int,pI*100))*"_wp_sch_closed"
for i in 1:nreps
println("running ",fname," ",i,"/",nreps)
## a random set of essential workers for each run
ser_path("precalc/essential_workers.jlse", generate_ess_workers())
serialize(outdir*"/"*fname*string(i)*".jlse",
test(t; init_inf=I0, p_inf=pI, p_inf_hh=2.0*pI, p_inf_loc=pI, nonessential_wp_closed=t_closed, sch_closed=t_closed,
distr_fn_hh=:all, distr_fn_non_hh=:all, distr_params_hh=(), distr_params_non_hh=(),
distr_fn_loc_res=:exp, distr_params_loc_res=(4,), distr_fn_loc_work=:exp, distr_params_loc_work=(2,)
))
GC.gc()
end