Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 720390230
  • Loading branch information
Pandemic-Sim Team authored and copybara-github committed Jan 29, 2025
1 parent f62389c commit 067d567
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ absl::Status ToProto(T src, P* result) {
}

absl::StatusOr<ExposuresPerTestResult::Exposure> 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()));
Expand Down Expand Up @@ -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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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<int64> days_since_symptom_onset) const;
absl::optional<int64_t> days_since_symptom_onset) const;

// Buckets representing threshold and corresponding weight of ble attenuation
// signals.
Expand Down Expand Up @@ -622,7 +622,7 @@ class TimeVaryingRiskScoreModel : public RiskScoreModel {
float LearningRiskScoreModel::ComputeRiskScore(
const Exposure& exposure,
absl::optional<absl::Time> initial_symptom_onset_time) const {
absl::optional<int64> days_since_symptom_onset;
absl::optional<int64_t> days_since_symptom_onset;
if (initial_symptom_onset_time.has_value()) {
days_since_symptom_onset = ConvertDurationToDiscreteDays(
exposure.start_time - initial_symptom_onset_time.value());
Expand Down Expand Up @@ -657,7 +657,7 @@ float LearningRiskScoreModel::ComputeDurationRiskScore(
}

float LearningRiskScoreModel::ComputeInfectionRiskScore(
absl::optional<int64> days_since_symptom_onset) const {
absl::optional<int64_t> days_since_symptom_onset) const {
for (const InfectiousnessBucket& bucket : infectiousness_buckets_) {
if (!days_since_symptom_onset.has_value()) {
if (bucket.level() == InfectiousnessLevel::UNKNOWN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ absl::Time TimeFromDay(const int day) { return TimeFromDayAndHour(day, 0); }
std::vector<float> FrequencyAdjustments(RiskScore& risk_score,
absl::Span<const Exposure> 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<float> adjustments;
Expand Down Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -357,7 +357,7 @@ class RiskLearningSimulation : public Simulation {
}
switch (proto.location_case()) {
case LocationProto::kGraph: {
std::vector<std::pair<int64, int64>> edges;
std::vector<std::pair<int64_t, int64_t>> edges;
edges.reserve(proto.graph().edges_size());
for (const GraphLocation::Edge& edge : proto.graph().edges()) {
edges.push_back({edge.uuid_a(), edge.uuid_b()});
Expand All @@ -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),
Expand All @@ -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,
Expand Down Expand Up @@ -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<SummaryObserverFactory>(
config.summary_filename())) {
current_lockdown_multipliers_.fill(1.0f);
Expand Down Expand Up @@ -670,7 +670,7 @@ class RiskLearningSimulation : public Simulation {
std::vector<std::pair<absl::Time, std::unique_ptr<RiskScoreModel>>>
risk_score_models_;
LearningRiskScorePolicy risk_score_policy_;
absl::flat_hash_map<int64, LocationReference::Type> location_types_;
absl::flat_hash_map<int64_t, LocationReference::Type> location_types_;
const LocationTypeFn get_location_type_;
// location_types is filled during location loading in the constructor and is
// const after that.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<LocationProto>& locations) {
agent.set_uuid(uuid);
agent.set_population_profile_id(1);
Expand Down

0 comments on commit 067d567

Please sign in to comment.