Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 720390458
  • Loading branch information
Pandemic-Sim Team authored and copybara-github committed Jan 29, 2025
1 parent f62389c commit 63e8891
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion agent_based_epidemic_sim/agent_synthesis/agent_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace abesim {
namespace {
constexpr int64 kPopulationProfileId = 0;
constexpr int64_t kPopulationProfileId = 0;
} // namespace

AgentProto ShuffledLocationAgentSampler::Next() {
Expand Down
18 changes: 9 additions & 9 deletions agent_based_epidemic_sim/agent_synthesis/shuffled_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace abesim {

ShuffledSampler::ShuffledSampler(
const absl::flat_hash_map<int64, int>& uuids_to_sizes) {
const absl::flat_hash_map<int64_t, int>& uuids_to_sizes) {
for (auto key_val : uuids_to_sizes) {
for (int i = 0; i < key_val.second; ++i) {
slots_.push_back(key_val.first);
Expand All @@ -30,25 +30,25 @@ ShuffledSampler::ShuffledSampler(
std::shuffle(slots_.begin(), slots_.end(), GetBitGen());
}

int64 ShuffledSampler::Next() {
int64_t ShuffledSampler::Next() {
DCHECK(i_ < slots_.size());
return slots_[i_++];
}

std::unique_ptr<ShuffledSampler> MakeBusinessSampler(
const GammaDistribution& business_distribution, const int64 population_size,
const UuidGenerator& uuid_generator,
const GammaDistribution& business_distribution,
const int64_t population_size, const UuidGenerator& uuid_generator,
std::vector<LocationProto>* locations) {
auto business_size_distribution = std::gamma_distribution<float>(
business_distribution.alpha(), business_distribution.beta());
std::mt19937 rng;
absl::flat_hash_map<int64, int> uuid_to_sizes;
absl::flat_hash_map<int64_t, int> uuid_to_sizes;
for (int population = 0; population < population_size;) {
LocationProto location;
location.mutable_reference()->set_uuid(uuid_generator.GenerateUuid());
location.mutable_reference()->set_type(LocationReference::BUSINESS);
const int size =
std::min(static_cast<int64>(business_size_distribution(rng)),
std::min(static_cast<int64_t>(business_size_distribution(rng)),
population_size - population);
location.mutable_dense()->set_size(size);
locations->push_back(location);
Expand All @@ -61,11 +61,11 @@ std::unique_ptr<ShuffledSampler> MakeBusinessSampler(

std::unique_ptr<ShuffledSampler> MakeHouseholdSampler(
const DiscreteDistribution& household_distribution,
const int64 population_size, const UuidGenerator& uuid_generator,
const int64_t population_size, const UuidGenerator& uuid_generator,
std::vector<LocationProto>* locations) {
auto household_size_sampler =
DiscreteDistributionSampler<int64>::FromProto(household_distribution);
absl::flat_hash_map<int64, int> uuid_to_sizes;
DiscreteDistributionSampler<int64_t>::FromProto(household_distribution);
absl::flat_hash_map<int64_t, int> uuid_to_sizes;
for (int population = 0; population < population_size;) {
LocationProto location;
location.mutable_reference()->set_uuid(uuid_generator.GenerateUuid());
Expand Down

0 comments on commit 63e8891

Please sign in to comment.