Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Code Change #235

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions agent_based_epidemic_sim/applications/home_work/observer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const char* kExpectedHeaders =
"work_16h,contact_1,contact_2,contact_4,contact_8,contact_16,"
"contact_32,contact_64,contact_128,contact_256,contact_512\n";

std::unique_ptr<MockAgent> MakeAgent(int64 uuid, HealthState::State state) {
std::unique_ptr<MockAgent> MakeAgent(int64_t uuid, HealthState::State state) {
auto agent = absl::make_unique<MockAgent>();
EXPECT_CALL(*agent, uuid())
.Times(testing::AnyNumber())
Expand All @@ -65,7 +65,7 @@ std::unique_ptr<MockAgent> MakeAgent(int64 uuid, HealthState::State state) {
return agent;
}

std::unique_ptr<MockLocation> MakeLocation(int64 uuid) {
std::unique_ptr<MockLocation> MakeLocation(int64_t uuid) {
auto location = absl::make_unique<MockLocation>();
EXPECT_CALL(*location, uuid())
.Times(testing::AnyNumber())
Expand All @@ -86,7 +86,7 @@ TEST(HomeWorkSimulationObserverTest, ZerosReturnedForNoObservations) {
{
HomeWorkSimulationObserverFactory observer_factory(
file.get(),
[](int64 uuid) {
[](int64_t uuid) {
return uuid == 0 ? LocationReference::HOUSEHOLD
: LocationReference::BUSINESS;
},
Expand Down Expand Up @@ -118,7 +118,7 @@ TEST(HomeWorkSimulationObserverTest, PassthroughFields) {
{
HomeWorkSimulationObserverFactory observer_factory(
file.get(),
[](int64 uuid) {
[](int64_t uuid) {
return uuid == 0 ? LocationReference::HOUSEHOLD
: LocationReference::BUSINESS;
},
Expand Down Expand Up @@ -148,7 +148,7 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) {
{
HomeWorkSimulationObserverFactory observer_factory(
file.get(),
[](int64 uuid) {
[](int64_t uuid) {
return uuid == 0 ? LocationReference::HOUSEHOLD
: LocationReference::BUSINESS;
},
Expand All @@ -162,8 +162,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) {
auto work = MakeLocation(1);

std::vector<Visit> home_visits, work_visits;
for (int64 i = 0; i < 4; ++i) {
int64 uuid = i;
for (int64_t i = 0; i < 4; ++i) {
int64_t uuid = i;
home_visits.push_back({
.location_uuid = 0,
.agent_uuid = uuid,
Expand All @@ -188,8 +188,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) {
observers[0]->Observe(*MakeAgent(uuid, HealthState::SUSCEPTIBLE),
outcomes);
}
for (int64 i = 0; i < 3; ++i) {
int64 uuid = 4 + i;
for (int64_t i = 0; i < 3; ++i) {
int64_t uuid = 4 + i;
home_visits.push_back({
.location_uuid = 0,
.agent_uuid = uuid,
Expand All @@ -213,8 +213,8 @@ TEST(HomeWorkSimulationObserverTest, CorrectValuesForObservations) {
}
observers[0]->Observe(*MakeAgent(uuid, HealthState::EXPOSED), outcomes);
}
for (int64 i = 0; i < 2; ++i) {
int64 uuid = 7 + i;
for (int64_t i = 0; i < 2; ++i) {
int64_t uuid = 7 + i;
home_visits.push_back({
.location_uuid = 0,
.agent_uuid = uuid,
Expand Down
6 changes: 3 additions & 3 deletions agent_based_epidemic_sim/applications/home_work/risk_score.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class TogglingRiskScore : public RiskScore {
void AddExposureNotification(const Exposure& exposure,
const ContactReport& notification) override {}

VisitAdjustment GetVisitAdjustment(const Timestep& timestep,
const int64 location_uuid) const override {
VisitAdjustment GetVisitAdjustment(
const Timestep& timestep, const int64_t location_uuid) const override {
return {
.frequency_adjustment =
SkipVisit(timestep, location_uuid) ? 0.0f : 1.0f,
Expand Down Expand Up @@ -76,7 +76,7 @@ class TogglingRiskScore : public RiskScore {
void RequestTest(absl::Time time) override {}

private:
bool SkipVisit(const Timestep& timestep, const int64 location_uuid) const {
bool SkipVisit(const Timestep& timestep, const int64_t location_uuid) const {
if (location_type_(location_uuid) != LocationReference::BUSINESS) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ absl::Time TestDay(int day) {
std::vector<float> FrequencyAdjustments(
const ToggleRiskScoreGenerator* const gen, const float essentialness,
const LocationReference::Type type, const std::vector<int>& days) {
int64 location_uuid = type == LocationReference::BUSINESS ? 0 : 1;
int64_t location_uuid = type == LocationReference::BUSINESS ? 0 : 1;
auto risk_score = gen->GetRiskScore(essentialness);

std::vector<float> adjustments;
Expand Down Expand Up @@ -75,7 +75,7 @@ TEST(PublicPolicyTest, AppropriateFrequencyAdjustments) {
DistancingPolicy config =
BuildPolicy({{10, .6}, {3, .2}, {20, 1.0}, {15, .2}});
auto generator_or =
NewRiskScoreGenerator(config, [](const int64 location_uuid) {
NewRiskScoreGenerator(config, [](const int64_t location_uuid) {
return location_uuid == 0 ? LocationReference::BUSINESS
: LocationReference::HOUSEHOLD;
});
Expand Down Expand Up @@ -112,7 +112,7 @@ TEST(PublicPolicyTest, AppropriateFrequencyAdjustments) {
TEST(PublicPolicyTest, ZeroStagePolicy) {
DistancingPolicy config;
auto generator_or =
NewRiskScoreGenerator(config, [](const int64 location_uuid) {
NewRiskScoreGenerator(config, [](const int64_t location_uuid) {
return location_uuid == 0 ? LocationReference::BUSINESS
: LocationReference::HOUSEHOLD;
});
Expand Down
12 changes: 6 additions & 6 deletions agent_based_epidemic_sim/applications/home_work/simulation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ constexpr char kHouseholdSizeProbability[] = "household_size_probability";
constexpr char kDistancingStageStart[] = "distancing_stage_start";
constexpr char kDistancingStageFraction[] =
"distancing_stage_essential_workers";
constexpr int64 kPopulationProfileId = 0;
constexpr int64_t kPopulationProfileId = 0;
constexpr char kTopBusiness[] = "top_business_size";
constexpr int kNumTopBusinesses = 5;
} // namespace

namespace {

int64 GetLocationUuidForTypeOrDie(const AgentProto& agent,
const LocationReference::Type type) {
int64_t GetLocationUuidForTypeOrDie(const AgentProto& agent,
const LocationReference::Type type) {
for (const auto& location : agent.locations()) {
if (location.type() == type) {
return location.uuid();
Expand Down Expand Up @@ -175,7 +175,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) {
LOG(INFO) << "Building agents and locations from config: "
<< config.DebugString();
// Samples the locations and agents.
const int64 kUuidShard = 0LL;
const int64_t kUuidShard = 0LL;
SimulationContext context;
std::vector<LocationProto>& locations = context.locations;
auto uuid_generator =
Expand Down Expand Up @@ -217,7 +217,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) {
for (int i = 0; i < config.population_size(); ++i) {
context.agents.push_back(sampler.Next());
}
absl::flat_hash_set<int64> business_uuids;
absl::flat_hash_set<int64_t> business_uuids;
std::for_each(
context.locations.begin(), context.locations.end(),
[&business_uuids](const auto& location) {
Expand All @@ -226,7 +226,7 @@ SimulationContext GetSimulationContext(const HomeWorkSimulationConfig& config) {
}
});
context.location_type = [business_uuids =
std::move(business_uuids)](int64 uuid) {
std::move(business_uuids)](int64_t uuid) {
return business_uuids.contains(uuid) ? LocationReference::BUSINESS
: LocationReference::HOUSEHOLD;
};
Expand Down
Loading