PunitRaveendran commited on
Commit
51ec761
·
verified ·
1 Parent(s): a2098ed

Update graders/grader2.py

Browse files
Files changed (1) hide show
  1. graders/grader2.py +9 -3
graders/grader2.py CHANGED
@@ -12,13 +12,17 @@ def grade(episode_log: Dict[str, Any]) -> float:
12
  naturally depleted fuel over a long episode — massively inflating the denominator
13
  and making fuel_score collapse to near-zero even with perfect play.
14
  """
 
 
 
 
15
  if not episode_log:
16
- return 0.0
17
 
18
  aircraft = episode_log.get("aircraft", [])
19
  total_aircraft = len(aircraft)
20
  if total_aircraft == 0:
21
- return 0.0
22
 
23
  # 40%: Landings completed
24
  landed = sum(1 for ac in aircraft if ac.get("status") == "LANDED")
@@ -53,4 +57,6 @@ def grade(episode_log: Dict[str, Any]) -> float:
53
  separation_score = max(0.0, 1.0 - separation_violations / max_violations)
54
 
55
  final_score = 0.4 * delay_score + 0.4 * fuel_score + 0.2 * separation_score
56
- return max(0.001, min(0.999, final_score))
 
 
 
12
  naturally depleted fuel over a long episode — massively inflating the denominator
13
  and making fuel_score collapse to near-zero even with perfect play.
14
  """
15
+ # Updated bounds to guarantee scores are strictly between (0, 1) at 4 decimal places
16
+ MIN_SCORE = 0.001
17
+ MAX_SCORE = 0.999
18
+
19
  if not episode_log:
20
+ return MIN_SCORE
21
 
22
  aircraft = episode_log.get("aircraft", [])
23
  total_aircraft = len(aircraft)
24
  if total_aircraft == 0:
25
+ return MIN_SCORE
26
 
27
  # 40%: Landings completed
28
  landed = sum(1 for ac in aircraft if ac.get("status") == "LANDED")
 
57
  separation_score = max(0.0, 1.0 - separation_violations / max_violations)
58
 
59
  final_score = 0.4 * delay_score + 0.4 * fuel_score + 0.2 * separation_score
60
+
61
+ # Enforce safe boundaries on the final returned score
62
+ return max(MIN_SCORE, min(MAX_SCORE, final_score))