30 const auto collegeCount =
31 static_cast<unsigned int>(ceil(studentCount / static_cast<double>(ggConfig.
people[Id::College])));
32 const auto cities = geoGrid.
TopK(10);
41 for (
const auto& c : cities) {
42 totalPop += c->GetPopCount();
46 vector<double> weights;
47 for (
const auto& c : cities) {
48 const auto weight =
static_cast<double>(c->GetPopCount()) / static_cast<double>(totalPop);
49 AssertThrow(weight >= 0 && weight <= 1 && !std::isnan(weight),
50 "CollegeGenerator> Invalid weight: " + to_string(weight), m_logger);
51 weights.push_back(weight);
54 const auto dist = m_rn_man.GetDiscreteGenerator(weights, 0U);
57 for (
auto i = 0U; i < collegeCount; i++) {
58 auto loc = cities[dist()];
59 AddPools(*loc, pop, ggConfig);
stride::Population * GetPopulation() const
Get the Population associated with this GeoGrid.
struct geopop::GeoGridConfig::@2 info
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...
std::vector< Location * > TopK(size_t k) const
Gets the K biggest (in population count) locations of this GeoGrid.
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.
void Apply(GeoGrid &, const GeoGridConfig &)
Generate ContactPools for ContactType::Id as sepcified by data in GeoGridConfig.
unsigned int popcount_college
Number of individuals in College.
Namespace for the simulator and related classes.
Namespace to manage types of ContactPool.