Skip to content

Commit 00087bf

Browse files
committed
store deployment probability per host and per intervention with copula and CV=0
1 parent 336e31b commit 00087bf

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

model/interventions/Deployments.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,22 @@ class TimedHumanDeployment : public TimedDeployment, protected HumanDeploymentBa
297297
probability = gsl_cdf_beta_Pinv(uy, alpha, beta);
298298
}
299299
else // Gamma with CV=0
300-
probability = human.rng.beta(alpha, beta);
300+
{
301+
/* Ensure consitency over time by drawing the probability of receiving the intervention
302+
only once per host and per intervention. If a host’s probability of receiving the intervention
303+
is high for an initial deployment, it will remain consistently high for subsequent deployments
304+
of the same intervention. */
305+
const ComponentId cid = subPop;
306+
double probability = -1.0;
307+
const auto it = human.perHostTransmission.copulaGaussianSamples.find(cid);
308+
if (it != human.perHostTransmission.copulaGaussianSamples.end())
309+
probability = it->second;
310+
else
311+
{
312+
probability = human.rng.beta(alpha, beta);
313+
human.perHostTransmission.copulaGaussianSamples[cid] = probability;
314+
}
315+
}
301316
}
302317
catch (const std::exception& e) {
303318
std::ostringstream oss;

0 commit comments

Comments
 (0)