ychanakya12 commited on
Commit
c1cd746
·
1 Parent(s): 2f6851a

Fix graders: single-exit pattern with raw_score accumulation, strictly (0.01, 0.99)

Browse files
src/tasks/task_easy.py CHANGED
@@ -3,16 +3,17 @@
3
 
4
  def grade(env) -> float:
5
  """
6
- Score strictly in (0.0, 1.0) based on ending budget after 1 quarter.
7
- OpenEnv requirement: score must never equal exactly 0.0 or 1.0.
8
  """
 
 
9
  if env.budget <= 0:
10
- val = 1.0 + env.budget / 50_000.0
 
11
  else:
12
  profit = env.budget - 100_000.0
13
- val = profit / 50_000.0
14
- # Clamp first, then round — guarantees strictly in (0.01, 0.99)
15
- clamped = min(max(val, 0.01), 0.99)
16
- score = round(clamped, 3)
17
- # Final safety net: rounding could still produce exactly 0.0 or 1.0
18
- return min(max(score, 0.01), 0.99)
 
3
 
4
  def grade(env) -> float:
5
  """
6
+ Score based on ending budget after 1 quarter.
7
+ OpenEnv requirement: scores must be strictly in (0.0, 1.0).
8
  """
9
+ raw_score = 0.5 # default neutral
10
+
11
  if env.budget <= 0:
12
+ # Partial credit for how close they came to break-even
13
+ raw_score = max(0.0, 1.0 + env.budget / 50_000.0)
14
  else:
15
  profit = env.budget - 100_000.0
16
+ raw_score = min(1.0, profit / 50_000.0)
17
+
18
+ # OpenEnv requirement: scores must be strictly in (0.0, 1.0)
19
+ return round(min(max(raw_score, 0.01), 0.99), 3)
 
 
src/tasks/task_hard.py CHANGED
@@ -3,22 +3,24 @@
3
 
4
  def grade(env) -> float:
5
  """
6
- Score strictly in (0.0, 1.0) weighted across all 6 factors.
7
- OpenEnv requirement: score must never equal exactly 0.0 or 1.0.
8
  """
9
- survived = 1.0 if env.budget > 0 else 0.0
10
- profit_score = min(0.99, max(0.01, env.budget / 200_000.0))
11
- reputation_score = min(0.99, max(0.01, env.reputation))
12
- low_burnout_score = min(0.99, max(0.01, 1.0 - env.team.burnout))
13
- rep_target_bonus = 0.15 if env.reputation >= 0.6 else 0.0
14
 
15
- raw = (
16
- survived * 0.25
17
- + profit_score * 0.25
18
- + reputation_score* 0.20
19
- + low_burnout_score* 0.15
 
 
 
 
 
 
20
  + rep_target_bonus
21
  )
22
- # Clamp first, then round, then clamp again as safety net
23
- score = round(min(max(raw, 0.01), 0.99), 3)
24
- return min(max(score, 0.01), 0.99)
 
3
 
4
  def grade(env) -> float:
5
  """
6
+ Score weighted across survival, profit, reputation, and burnout.
7
+ OpenEnv requirement: scores must be strictly in (0.0, 1.0).
8
  """
9
+ raw_score = 0.5 # default neutral
 
 
 
 
10
 
11
+ survived = 1.0 if env.budget > 0 else 0.0
12
+ profit_score = min(1.0, max(0.0, env.budget / 200_000.0))
13
+ reputation_score = min(1.0, max(0.0, env.reputation))
14
+ low_burnout_score = min(1.0, max(0.0, 1.0 - env.team.burnout))
15
+ rep_target_bonus = 0.15 if env.reputation >= 0.6 else 0.0
16
+
17
+ raw_score = (
18
+ survived * 0.25
19
+ + profit_score * 0.25
20
+ + reputation_score * 0.20
21
+ + low_burnout_score * 0.15
22
  + rep_target_bonus
23
  )
24
+
25
+ # OpenEnv requirement: scores must be strictly in (0.0, 1.0)
26
+ return round(min(max(raw_score, 0.01), 0.99), 3)
src/tasks/task_medium.py CHANGED
@@ -3,22 +3,24 @@
3
 
4
  def grade(env) -> float:
5
  """
6
- Score strictly in (0.0, 1.0) based on 30% revenue growth over 4 quarters.
7
  Also rewards reputation maintenance (Factor 6).
8
- OpenEnv requirement: score must never equal exactly 0.0 or 1.0.
9
  """
 
 
10
  if not env.history:
11
- return 0.01
 
 
 
 
12
 
13
- # Factor 1: profit growth
14
- growth = (env.budget - 100_000.0) / 100_000.0
15
- growth_score = min(0.99, max(0.01, growth / 0.30))
16
 
17
- # Factor 6: reputation maintained (clamp to avoid 0.0 or 1.0)
18
- rep_score = min(0.99, max(0.01, env.reputation))
19
 
20
- # Weighted combination
21
- raw = growth_score * 0.70 + rep_score * 0.30
22
- # Clamp first, then round, then clamp again as safety net
23
- score = round(min(max(raw, 0.01), 0.99), 3)
24
- return min(max(score, 0.01), 0.99)
 
3
 
4
  def grade(env) -> float:
5
  """
6
+ Score based on 30% revenue growth over 4 quarters.
7
  Also rewards reputation maintenance (Factor 6).
8
+ OpenEnv requirement: scores must be strictly in (0.0, 1.0).
9
  """
10
+ raw_score = 0.5 # default neutral
11
+
12
  if not env.history:
13
+ raw_score = 0.5
14
+ else:
15
+ # Factor 1: profit growth
16
+ growth = (env.budget - 100_000.0) / 100_000.0
17
+ growth_score = min(1.0, max(0.0, growth / 0.30))
18
 
19
+ # Factor 6: reputation maintained
20
+ rep_score = min(1.0, max(0.0, env.reputation))
 
21
 
22
+ # Weighted combination
23
+ raw_score = growth_score * 0.70 + rep_score * 0.30
24
 
25
+ # OpenEnv requirement: scores must be strictly in (0.0, 1.0)
26
+ return round(min(max(raw_score, 0.01), 0.99), 3)