From 1f4189583f8b496eec7963f300b7f66c78776d12 Mon Sep 17 00:00:00 2001 From: Pandemic-Sim Team Date: Fri, 3 Jan 2025 19:16:44 -0800 Subject: [PATCH] Automated Code Change PiperOrigin-RevId: 711920975 --- .../applications/risk_learning/observers.cc | 6 +++--- .../applications/risk_learning/risk_score.cc | 18 +++++++++--------- .../risk_learning/risk_score_test.cc | 4 ++-- .../applications/risk_learning/simulation.cc | 14 +++++++------- .../risk_learning/simulation_test.cc | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/agent_based_epidemic_sim/applications/risk_learning/observers.cc b/agent_based_epidemic_sim/applications/risk_learning/observers.cc index 02b7a12c..30999ed4 100644 --- a/agent_based_epidemic_sim/applications/risk_learning/observers.cc +++ b/agent_based_epidemic_sim/applications/risk_learning/observers.cc @@ -114,7 +114,7 @@ absl::Status ToProto(T src, P* result) { } absl::StatusOr LearningObserver::AddExposure( - int64 uuid, const Exposure& exposure, const ContactReport* report) const { + int64_t uuid, const Exposure& exposure, const ContactReport* report) const { ExposuresPerTestResult::Exposure e; PANDEMIC_RETURN_IF_ERROR( ToProto(exposure.start_time, e.mutable_exposure_time())); @@ -160,8 +160,8 @@ LearningObserver::AgentToExposureResult(const Agent& agent, bool encoded_exposures = true; exposures->PerExposure( absl::InfinitePast(), - [&result, &encoded_exposures, this](int64 uuid, const Exposure& exposure, - const ContactReport* report) { + [&result, &encoded_exposures, this]( + int64_t uuid, const Exposure& exposure, const ContactReport* report) { auto exposure_or = AddExposure(uuid, exposure, report); if (!exposure_or.ok()) { if (IsNotFound(exposure_or.status())) { diff --git a/agent_based_epidemic_sim/applications/risk_learning/risk_score.cc b/agent_based_epidemic_sim/applications/risk_learning/risk_score.cc index e9d81a17..4cb6119b 100644 --- a/agent_based_epidemic_sim/applications/risk_learning/risk_score.cc +++ b/agent_based_epidemic_sim/applications/risk_learning/risk_score.cc @@ -208,8 +208,8 @@ class LearningRiskScore : public RiskScore { } } - VisitAdjustment GetVisitAdjustment(const Timestep& timestep, - const int64 location_uuid) const override { + VisitAdjustment GetVisitAdjustment( + const Timestep& timestep, const int64_t location_uuid) const override { const bool skip_visit = location_type_(location_uuid) != LocationReference::HOUSEHOLD && (ShouldQuarantineFromContacts(timestep) || @@ -405,8 +405,8 @@ class AppEnabledRiskScore : public RiskScore { risk_score_->AddExposureNotification(exposure, notification); } } - VisitAdjustment GetVisitAdjustment(const Timestep& timestep, - const int64 location_uuid) const override { + VisitAdjustment GetVisitAdjustment( + const Timestep& timestep, const int64_t location_uuid) const override { return risk_score_->GetVisitAdjustment(timestep, location_uuid); } TestResult GetTestResult(const Timestep& timestep) const override { @@ -448,8 +448,8 @@ class HazardQueryingRiskScore : public RiskScore { const ContactReport& notification) override { risk_score_->AddExposureNotification(exposure, notification); } - VisitAdjustment GetVisitAdjustment(const Timestep& timestep, - const int64 location_uuid) const override { + VisitAdjustment GetVisitAdjustment( + const Timestep& timestep, const int64_t location_uuid) const override { return risk_score_->GetVisitAdjustment(timestep, location_uuid); } TestResult GetTestResult(const Timestep& timestep) const override { @@ -590,7 +590,7 @@ class LearningRiskScoreModel : public RiskScoreModel { // Note: This method assumes infectiousness_buckets_ has a particular // ordering. Specifically the ordering is asc on days_since_symptom_onset_max. float ComputeInfectionRiskScore( - absl::optional days_since_symptom_onset) const; + absl::optional days_since_symptom_onset) const; // Buckets representing threshold and corresponding weight of ble attenuation // signals. @@ -622,7 +622,7 @@ class TimeVaryingRiskScoreModel : public RiskScoreModel { float LearningRiskScoreModel::ComputeRiskScore( const Exposure& exposure, absl::optional initial_symptom_onset_time) const { - absl::optional days_since_symptom_onset; + absl::optional days_since_symptom_onset; if (initial_symptom_onset_time.has_value()) { days_since_symptom_onset = ConvertDurationToDiscreteDays( exposure.start_time - initial_symptom_onset_time.value()); @@ -657,7 +657,7 @@ float LearningRiskScoreModel::ComputeDurationRiskScore( } float LearningRiskScoreModel::ComputeInfectionRiskScore( - absl::optional days_since_symptom_onset) const { + absl::optional days_since_symptom_onset) const { for (const InfectiousnessBucket& bucket : infectiousness_buckets_) { if (!days_since_symptom_onset.has_value()) { if (bucket.level() == InfectiousnessLevel::UNKNOWN) { diff --git a/agent_based_epidemic_sim/applications/risk_learning/risk_score_test.cc b/agent_based_epidemic_sim/applications/risk_learning/risk_score_test.cc index a259665e..bcf9bdb0 100644 --- a/agent_based_epidemic_sim/applications/risk_learning/risk_score_test.cc +++ b/agent_based_epidemic_sim/applications/risk_learning/risk_score_test.cc @@ -57,7 +57,7 @@ absl::Time TimeFromDay(const int day) { return TimeFromDayAndHour(day, 0); } std::vector FrequencyAdjustments(RiskScore& risk_score, absl::Span exposures, const LocationReference::Type type) { - int64 location_uuid = type == LocationReference::BUSINESS ? 0 : 1; + int64_t location_uuid = type == LocationReference::BUSINESS ? 0 : 1; auto exposure = exposures.begin(); std::vector adjustments; @@ -86,7 +86,7 @@ class RiskScoreTest : public testing::Test { policy_ = *risk_score_policy_or; auto risk_score_or = CreateLearningRiskScore( tracing_policy_proto, policy_, risk_score_model, - [](const int64 location_uuid) { + [](const int64_t location_uuid) { return location_uuid == 0 ? LocationReference::BUSINESS : LocationReference::HOUSEHOLD; }); diff --git a/agent_based_epidemic_sim/applications/risk_learning/simulation.cc b/agent_based_epidemic_sim/applications/risk_learning/simulation.cc index 687747f2..e49587e4 100644 --- a/agent_based_epidemic_sim/applications/risk_learning/simulation.cc +++ b/agent_based_epidemic_sim/applications/risk_learning/simulation.cc @@ -118,8 +118,8 @@ class RiskLearningVisitGenerator : public VisitGenerator { return durations; } - static int64 GetLocationUuidForTypeOrDie(const AgentProto& agent, - const LocationReference::Type type) { + static int64_t GetLocationUuidForTypeOrDie( + const AgentProto& agent, const LocationReference::Type type) { for (const auto& location : agent.locations()) { if (location.type() == type) { return location.uuid(); @@ -357,7 +357,7 @@ class RiskLearningSimulation : public Simulation { } switch (proto.location_case()) { case LocationProto::kGraph: { - std::vector> edges; + std::vector> edges; edges.reserve(proto.graph().edges_size()); for (const GraphLocation::Edge& edge : proto.graph().edges()) { edges.push_back({edge.uuid_a(), edge.uuid_b()}); @@ -368,7 +368,7 @@ class RiskLearningSimulation : public Simulation { proto.graph().type()) : non_work_drop_prob; { - const int64 uuid = proto.reference().uuid(); + const int64_t uuid = proto.reference().uuid(); absl::MutexLock l(&location_mu); locations.push_back(NewGraphLocation( uuid, transmissibility, drop_prob, std::move(edges), @@ -378,7 +378,7 @@ class RiskLearningSimulation : public Simulation { break; } case LocationProto::kRandom: { - const int64 uuid = proto.reference().uuid(); + const int64_t uuid = proto.reference().uuid(); absl::MutexLock l(&location_mu); locations.push_back(NewRandomGraphLocation( uuid, transmissibility, random_interaction_multiplier, @@ -617,7 +617,7 @@ class RiskLearningSimulation : public Simulation { : config_(config), stepwise_params_(stepwise_params), get_location_type_( - [this](int64 uuid) { return location_types_[uuid]; }), + [this](int64_t uuid) { return location_types_[uuid]; }), summary_observer_(absl::make_unique( config.summary_filename())) { current_lockdown_multipliers_.fill(1.0f); @@ -670,7 +670,7 @@ class RiskLearningSimulation : public Simulation { std::vector>> risk_score_models_; LearningRiskScorePolicy risk_score_policy_; - absl::flat_hash_map location_types_; + absl::flat_hash_map location_types_; const LocationTypeFn get_location_type_; // location_types is filled during location loading in the constructor and is // const after that. diff --git a/agent_based_epidemic_sim/applications/risk_learning/simulation_test.cc b/agent_based_epidemic_sim/applications/risk_learning/simulation_test.cc index 86dfed61..ac51bccd 100644 --- a/agent_based_epidemic_sim/applications/risk_learning/simulation_test.cc +++ b/agent_based_epidemic_sim/applications/risk_learning/simulation_test.cc @@ -37,7 +37,7 @@ constexpr char kConfigPath[] = "agent_based_epidemic_sim/applications/risk_learning/" "testdata/config.pbtxt"; -void FillLocation(LocationProto& location, int64 uuid, +void FillLocation(LocationProto& location, int64_t uuid, LocationReference::Type type) { LocationReference* ref = location.mutable_reference(); ref->set_uuid(uuid); @@ -46,14 +46,14 @@ void FillLocation(LocationProto& location, int64 uuid, // Agent uuids are 1-100. for (int i = 0; i < 100; ++i) { for (int j = -2; j < 3; ++j) { - int64 uuid = (i + j + 100) % 100; + int64_t uuid = (i + j + 100) % 100; GraphLocation::Edge* edge = graph->add_edges(); edge->set_uuid_a(i + 1); edge->set_uuid_b(uuid + 1); } } } -void FillAgent(AgentProto& agent, int64 uuid, HealthState::State initial, +void FillAgent(AgentProto& agent, int64_t uuid, HealthState::State initial, const std::vector& locations) { agent.set_uuid(uuid); agent.set_population_profile_id(1);