24 #include <boost/property_tree/ptree.hpp> 40 const auto pt = configPt.get_child(
"run.geopop_gen");
41 param.pop_size = pt.get<
unsigned int>(
"population_size");
42 param.participation_college = pt.get<
double>(
"participation_college");
43 param.fraction_workplace_commuters = pt.get<
double>(
"fraction_workplace_commuters");
44 param.fraction_college_commuters = pt.get<
double>(
"fraction_college_commuters");
45 param.particpation_workplace = pt.get<
double>(
"particpation_workplace");
47 people[Id::K12School] = pt.get<
unsigned int>(
"people_per_K12School", 500U);
48 people[Id::College] = pt.get<
unsigned int>(
"people_per_College", 3000U);
49 people[Id::Workplace] = pt.get<
unsigned int>(
"people_per_Workplace", 20U);
50 people[Id::PrimaryCommunity] = pt.get<
unsigned int>(
"people_per_PrimaryCommunity", 2000U);
51 people[Id::SecondaryCommunity] = pt.get<
unsigned int>(
"people_per_SecondaryCommunity", 2000U);
53 pools[Id::K12School] = pt.get<
unsigned int>(
"pools_per_K12School", 25U);
54 pools[Id::College] = pt.get<
unsigned int>(
"pools_per_College", 20U);
60 householdsReader->SetReferenceHouseholds(
refHH.person_count,
refHH.ages);
61 const auto popSize =
param.pop_size;
66 const auto ref_p_count =
refHH.person_count;
67 const auto averageHhSize =
static_cast<double>(ref_p_count) / static_cast<double>(
refHH.ages.size());
69 auto ref_k12school = 0U;
70 auto ref_college = 0U;
71 auto ref_workplace = 0U;
72 for (
const auto& hhAgeProfile :
refHH.ages) {
73 for (
const auto& age : hhAgeProfile) {
88 const auto fraction_k12school_age =
static_cast<double>(ref_k12school) / static_cast<double>(ref_p_count);
89 const auto fraction_college_age =
static_cast<double>(ref_college) / static_cast<double>(ref_p_count);
90 const auto fraction_workplace_age =
static_cast<double>(ref_workplace) / static_cast<double>(ref_p_count);
92 const auto age_count_k12school =
static_cast<unsigned int>(floor(popSize * fraction_k12school_age));
93 const auto age_count_college =
static_cast<unsigned int>(floor(popSize * fraction_college_age));
94 const auto age_count_workplace =
static_cast<unsigned int>(floor(popSize * fraction_workplace_age));
96 info.popcount_k12school = age_count_k12school;
98 info.popcount_college =
static_cast<unsigned int>(floor(
param.participation_college * age_count_college));
100 info.popcount_workplace =
static_cast<unsigned int>(
101 floor(
param.particpation_workplace * (age_count_workplace -
info.popcount_college)));
103 info.count_households =
static_cast<unsigned int>(floor(static_cast<double>(popSize) / averageHhSize));
109 out.setf(std::ios_base::left, std::ios_base::adjustfield);
110 out <<
"Input:" << endl;
struct geopop::GeoGridConfig::@2 info
Configuration data mostly for generating a population, but also for computing the required number of ...
void SetData(const std::string &householdsFileName)
Read the househould data file, parse it and set data.
static bool HasAge(double age)
GeoGridConfig()
Default constructor needed in test code.
struct geopop::GeoGridConfig::@1 refHH
double particpation_workplace
Participation of workplace (fraction of people of work age and not going to college and having employ...
unsigned int popcount_k12school
Numbers of individuals in K12School.
std::string intToDottedString(const T &value)
static bool HasAge(double age)
unsigned int popcount_workplace
Number of individuals in Workplace.
AgeBrackets that determine participation in type of ContactPool.
Definition of ContactPool Id Type.
unsigned int pop_size
Target population size for the generated population.
Namespace for the geographic and demograhic classes.
stride::ContactType::IdSubscriptArray< unsigned int > people
People per unit (= Household, K12School, College, etc.) for each of the ContactTypes.
double fraction_college_commuters
Fraction of college students that commute.
static std::shared_ptr< HouseholdReader > CreateHouseholdReader(const std::string &filename)
Create a HouseholdReader based on the filename relative to the data directory.
struct geopop::GeoGridConfig::@0 param
ostream & operator<<(ostream &out, const GeoGridConfig &config)
unsigned int popcount_college
Number of individuals in College.
double fraction_workplace_commuters
Fraction of people in the workplace that commute.
static bool HasAge(double age)
double participation_college
Participation of college (fraction of people of college age going to college).
Miscellaneous string utilities.
stride::ContactType::IdSubscriptArray< unsigned int > pools
Pools per unit (= Household, K12School, College, etc.) for each of the ContactTypes.
Namespace to manage types of ContactPool.