Commit cbd4138f authored by Jorge Visca's avatar Jorge Visca

add cooperation rates

parent 9710f3da
......@@ -18,7 +18,9 @@ M.models.forward1 = function ( case )
if math.random()<conf.ca_p then
for i=1, #case.exposed_to do
local contact = case.exposed_to[i]
if (not contact.disease.quarantined) and (math.random()<conf.ca_p) then
if (not contact.disease.quarantined)
and (math.random()<conf.ca_p)
and (math.random()<conf.ca_coop) then
w_log(t, ' app case: ', case.id, ' contact: ', contact.id )
contact.disease.quarantined = true
end
......@@ -37,7 +39,9 @@ M.models.recursive = function ( case )
for i=1, #c.exposed_to do
local contact = c.exposed_to[i]
cases[contact] = true
if (not contact.disease.quarantined) and (math.random()<conf.ca_p) then
if (not contact.disease.quarantined)
and (math.random()<conf.ca_p)
and (math.random()<conf.ca_coop) then
w_log(t, ' app case: ', c.id, ' contact: ', contact.id )
contact.disease.quarantined = true
end
......
......@@ -31,7 +31,7 @@ local function tracer_process ( tracer_id )
t = lib.esim.sleep_to(t+conf.ct_hit_t)
if i<=#case.exposed_to then
local contact = case.exposed_to[i]
if not contact.disease.quarantined then
if (not contact.disease.quarantined) and (math.random()<conf.ct_coop) then
w_log(t, ' traced tid: ', tracer_id, ' case: ', case.id, ' contact: ', contact.id )
contact.disease.quarantined = true
end
......
......@@ -102,7 +102,7 @@ M.process = function ( person )
t = lib.esim.sleep_to( t+ds_model.T_E )
d.state = 'I'
if math.random()<ds_model.qp or d.quarantined then
if d.quarantined or math.random()<ds_model.q_coop then
lib.esim.launch(selfQuarantineProcess, person)
d.selfq = true
end
......
......@@ -134,7 +134,7 @@ M.process = function ( person )
local time_start_I = t+ds_model._gamma
t = M.infector(person, time_start_I)
d.state = 'I'
if math.random()<ds_model.qp or d.quarantined then
if d.quarantined or math.random()<ds_model.q_coop then
lib.esim.launch(selfQuarantineProcess, person)
d.selfq = true
end
......
No preview for this file type
......@@ -47,15 +47,18 @@ disease = {
r = 0.5, -- relative infectiousness of asymptomatic individuals
_q = 2, -- time to self quarantine
qp = 1, -- probability of entering self quarantine
q_coop = 1, -- probability of entering self quarantine
},
-- contact tracers behavior
ct_count = 0, -- number if contact tracers working
ct_hit_t = 1, -- time to hitting an exposed
ct_trace_t = 5, -- time attending a single case
ct_coop = 1, -- cooperation rate
-- contact app behavior
ca_p = 0, -- probability of having the app installed
ca_model = 'forward1',
ca_coop = 1, -- cooperation rate
......@@ -28,10 +28,11 @@ disease = {
r = 0.5,
_q = 3, -- slightly bigger than default 2
qp = 1,
q_coop = 1,
},
ct_count = 0,
ca_p = 0, -- this will be changed by script
ca_model = 'forward1',
ca_coop = 1,
......@@ -28,9 +28,10 @@ disease = {
r = 0.5,
_q = 3, -- slightly bigger than default 2
qp = 1,
q_coop = 1,
},
ct_count = 0, -- this will be changed by script
ct_hit_t = 1,
ct_trace_t = 5,
ct_coop = 1,
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment