RohitChandramouli6618 commited on
Commit
c5694dd
Β·
1 Parent(s): 48a1c95

Calibrate grader: soften hospital breach penalty, grace period for containment, fix speed score

Browse files
Files changed (1) hide show
  1. server/grader.py +5 -3
server/grader.py CHANGED
@@ -94,11 +94,13 @@ def grade_trajectory(
94
  total_district_days = total_steps * num_districts
95
  safe_district_days = 0
96
 
97
- for step in trajectory:
98
  for district in step.city_state.districts:
99
  if district.true_infection_rate <= INFECTION_THRESHOLD:
100
  safe_district_days += 1
101
 
 
 
102
  containment_score = safe_district_days / total_district_days
103
 
104
  # ── Component 2: Hospital Score ───────────────────────────────────────────
@@ -115,7 +117,7 @@ def grade_trajectory(
115
  total_capacity_preserved += district.hospital_capacity_remaining
116
 
117
  avg_capacity = total_capacity_preserved / total_district_days
118
- hospital_score = avg_capacity * (0.3 if hospital_breached else 1.0)
119
  hospital_score = round(min(1.0, max(0.0, hospital_score)), 4)
120
 
121
  # ── Component 3: Efficiency Score ────────────────────────────────────────
@@ -143,7 +145,7 @@ def grade_trajectory(
143
  # If contained in half the steps, speed_score = 0.5. Etc.
144
 
145
  last_step = trajectory[-1]
146
- if last_step.done and not hospital_breached:
147
  speed_score = round(1.0 - (total_steps / max_steps), 4)
148
  speed_score = max(0.0, speed_score)
149
  else:
 
94
  total_district_days = total_steps * num_districts
95
  safe_district_days = 0
96
 
97
+ for step in trajectory[2:]: # skip first 2 steps
98
  for district in step.city_state.districts:
99
  if district.true_infection_rate <= INFECTION_THRESHOLD:
100
  safe_district_days += 1
101
 
102
+ total_district_days = max(len(trajectory) - 2, 1) * num_districts
103
+
104
  containment_score = safe_district_days / total_district_days
105
 
106
  # ── Component 2: Hospital Score ───────────────────────────────────────────
 
117
  total_capacity_preserved += district.hospital_capacity_remaining
118
 
119
  avg_capacity = total_capacity_preserved / total_district_days
120
+ hospital_score = avg_capacity * (0.6 if hospital_breached else 1.0)
121
  hospital_score = round(min(1.0, max(0.0, hospital_score)), 4)
122
 
123
  # ── Component 3: Efficiency Score ────────────────────────────────────────
 
145
  # If contained in half the steps, speed_score = 0.5. Etc.
146
 
147
  last_step = trajectory[-1]
148
+ if last_step.done and total_steps < max_steps:
149
  speed_score = round(1.0 - (total_steps / max_steps), 4)
150
  speed_score = max(0.0, speed_score)
151
  else: