23 #include <boost/optional.hpp> 30 #include <boost/property_tree/ptree.hpp> 46 const auto immunityProfile =
m_config.get<std::string>(
"run.immunity_profile");
47 Vaccinate(
"immunity", immunityProfile, pop, Id::Household);
49 const auto vaccinationProfile =
m_config.get<std::string>(
"run.vaccine_profile");
50 Vaccinate(
"vaccine", vaccinationProfile, pop, Id::Household);
55 const auto sAgeMin =
m_config.get<
double>(
"run.seeding_age_min", 1);
56 const auto sAgeMax =
m_config.get<
double>(
"run.seeding_age_max", 99);
57 const auto popSize = pop->size();
58 const auto maxPopIndex =
static_cast<int>(popSize - 1);
60 auto& logger = pop->RefContactLogger();
61 const string log_level =
m_config.get<
string>(
"run.contact_log_level",
"None");
63 unsigned int numInfected = 0;
64 boost::optional<float> sRate =
m_config.get_optional<
float>(
"run.seeding_rate");
66 numInfected =
static_cast<unsigned int>(floor(static_cast<double>(popSize) * (*sRate)));
68 numInfected =
m_config.get<
int>(
"run.num_index_cases");
72 while (numInfected > 0) {
73 Person& p = pop->at(static_cast<size_t>(generator()));
77 if (log_level !=
"None") {
87 std::vector<double> immunityDistribution;
88 double linkProbability = 0;
91 if (immunizationProfile ==
"Random") {
92 const auto immunityLevel =
m_config.get<
double>(
"run." +
ToLower(immunityType) +
"_rate");
93 for (
unsigned int index_age = 0; index_age < 100; index_age++) {
94 immunityDistribution.push_back(immunityLevel);
96 immunizer.
Random(pop->CRefPoolSys().CRefPools(contactPoolType), immunityDistribution, linkProbability);
97 }
else if (immunizationProfile ==
"AgeDependent") {
98 const auto immunityFile =
m_config.get<
string>(
"run." +
ToLower(immunityType) +
"_distribution_file");
101 linkProbability =
m_config.get<
double>(
"run." +
ToLower(immunityType) +
"_link_probability");
102 for (
unsigned int index_age = 0; index_age < 100; index_age++) {
103 auto immunityLevel = immunity_pt.get<
double>(
"immunity.age" + std::to_string(index_age));
104 immunityDistribution.push_back(immunityLevel);
107 immunizer.
Random(pop, immunityDistribution, contactPoolType, linkProbability);
109 }
else if (immunizationProfile ==
"Cocoon") {
110 immunizer.
Cocoon(pop->CRefPoolSys().CRefPools(contactPoolType), immunityDistribution, linkProbability);
Health & GetHealth()
Return person's health status.
Id
Enumerates the ContactPool types.
const boost::property_tree::ptree & m_config
Run config.
util::RnMan & m_rn_man
Random number manager.
unsigned int GetPoolId(const ContactType::Id &poolType) const
Get ID of contactpool_type.
Utilities for the project.
Header for the DiseaseSeeder class.
unsigned int GetId() const
Get the id.
static boost::property_tree::ptree ReadPtreeFile(const filesys::path &f_p)
Read ptree from file at path.
float GetAge() const
Get the age.
void Vaccinate(const std::string &immunityType, const std::string &immunizationProfile, std::shared_ptr< Population > pop, const ContactType::Id contactPoolType)
Seed for vaccination/natural immunity.
std::function< int()> GetUniformIntGenerator(int a, int b, unsigned int i=0U)
Return a generator for uniform ints in [a, b[ (a < b) using i-th random stream.
Logging (spdlog) utilities.
void Cocoon(const util::SegmentedVector< ContactPool > &, std::vector< double > &, double)
Cocoon immunization.
DiseaseSeeder(const boost::property_tree::ptree &config, util::RnMan &rnMan)
Initializing DiseaseSeeder.
Header file for the core Population class.
Deals with immunization strategies.
void Random(const util::SegmentedVector< ContactPool > &pools, std::vector< double > &immunityDistribution, double immunityLinkProbability)
Random immunization.
Miscellaneous string utilities.
Interface for install directory queries.
Store and handle person data.
Namespace for the simulator and related classes.
bool IsSusceptible() const
Is this person susceptible?
void Seed(std::shared_ptr< Population > pop)
Build the simulator.
void StartInfection()
Start the infection.
std::string ToLower(const std::string &source)
Builds a string with lower case characters only.
Namespace to manage types of ContactPool.
Header for the Immunizer class.