39 const auto communitySize = ggConfig.
people[Id::PrimaryCommunity];
40 const auto communityCount =
static_cast<unsigned int>(ceil(popCount / static_cast<double>(communitySize)));
42 vector<double> weights;
43 for (
const auto& loc : geoGrid) {
44 const auto weight =
static_cast<double>(loc->GetPopCount()) / static_cast<double>(popCount);
45 AssertThrow(weight >= 0 && weight <= 1 && !std::isnan(weight),
46 "CommunityGenerator> Invalid weight: " + to_string(weight), m_logger);
47 weights.push_back(weight);
50 if (weights.empty()) {
55 const auto dist = m_rn_man.GetDiscreteGenerator(weights, 0U);
56 auto pop = geoGrid.GetPopulation();
58 for (
auto i = 0U; i < communityCount; i++) {
59 const auto loc = geoGrid[dist()];
60 AddPools(*loc, pop, ggConfig);
Configuration data mostly for generating a population, but also for computing the required number of ...
#define AssertThrow(CONDITION, MESSAGE, LOGGER)
A Geographic grid of simulation region contains Locations that in turn contain an index to the Contac...
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.
struct geopop::GeoGridConfig::@0 param
void Apply(GeoGrid &, const GeoGridConfig &)
Generate ContactPools for ContactType::Id as sepcified by data in GeoGridConfig.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.