Spaces:
Sleeping
Sleeping
Pranav Dhiran commited on
Commit ·
2378dfe
1
Parent(s): d6ada92
Fix breakdown dict values to strictly be in (0, 1) range to prevent validation errors
Browse files- app/tasks/task1.py +1 -3
- app/tasks/task2.py +2 -2
- app/tasks/task3.py +1 -1
app/tasks/task1.py
CHANGED
|
@@ -346,14 +346,12 @@ class CPUSpikeTask(BaseTask):
|
|
| 346 |
elif steps <= 10:
|
| 347 |
breakdown["efficiency_bonus"] = 0.05
|
| 348 |
score += 0.05
|
| 349 |
-
else:
|
| 350 |
-
breakdown["efficiency_bonus"] = 0.0
|
| 351 |
|
| 352 |
# Penalty for wrong actions
|
| 353 |
wrong = state.get("wrong_actions", 0)
|
| 354 |
if wrong > 0:
|
| 355 |
penalty = min(wrong * 0.08, 0.20)
|
| 356 |
-
breakdown["wrong_action_penalty"] =
|
| 357 |
score -= penalty
|
| 358 |
|
| 359 |
score = round(min(max(score, 0.0), 1.0), 4)
|
|
|
|
| 346 |
elif steps <= 10:
|
| 347 |
breakdown["efficiency_bonus"] = 0.05
|
| 348 |
score += 0.05
|
|
|
|
|
|
|
| 349 |
|
| 350 |
# Penalty for wrong actions
|
| 351 |
wrong = state.get("wrong_actions", 0)
|
| 352 |
if wrong > 0:
|
| 353 |
penalty = min(wrong * 0.08, 0.20)
|
| 354 |
+
breakdown["wrong_action_penalty"] = penalty
|
| 355 |
score -= penalty
|
| 356 |
|
| 357 |
score = round(min(max(score, 0.0), 1.0), 4)
|
app/tasks/task2.py
CHANGED
|
@@ -432,14 +432,14 @@ class DBConnectionPoolTask(BaseTask):
|
|
| 432 |
|
| 433 |
# Penalty: restarted DB (bad practice)
|
| 434 |
if state.get("db_restarted", False):
|
| 435 |
-
breakdown["db_restart_penalty"] =
|
| 436 |
score -= 0.15
|
| 437 |
|
| 438 |
# Penalty: other wrong actions
|
| 439 |
wrong = state.get("wrong_actions", 0) - (1 if state.get("db_restarted", False) else 0)
|
| 440 |
if wrong > 0:
|
| 441 |
p = min(wrong * 0.07, 0.15)
|
| 442 |
-
breakdown["wrong_action_penalty"] =
|
| 443 |
score -= p
|
| 444 |
|
| 445 |
score = round(min(max(score, 0.0), 1.0), 4)
|
|
|
|
| 432 |
|
| 433 |
# Penalty: restarted DB (bad practice)
|
| 434 |
if state.get("db_restarted", False):
|
| 435 |
+
breakdown["db_restart_penalty"] = 0.15
|
| 436 |
score -= 0.15
|
| 437 |
|
| 438 |
# Penalty: other wrong actions
|
| 439 |
wrong = state.get("wrong_actions", 0) - (1 if state.get("db_restarted", False) else 0)
|
| 440 |
if wrong > 0:
|
| 441 |
p = min(wrong * 0.07, 0.15)
|
| 442 |
+
breakdown["wrong_action_penalty"] = p
|
| 443 |
score -= p
|
| 444 |
|
| 445 |
score = round(min(max(score, 0.0), 1.0), 4)
|
app/tasks/task3.py
CHANGED
|
@@ -481,7 +481,7 @@ class CascadingFailureTask(BaseTask):
|
|
| 481 |
wrong_rollbacks = state.get("wrong_rollbacks", 0)
|
| 482 |
if wrong_rollbacks > 0:
|
| 483 |
p = min(wrong_rollbacks * 0.08, 0.20)
|
| 484 |
-
breakdown["wrong_rollback_penalty"] =
|
| 485 |
score -= p
|
| 486 |
|
| 487 |
score = round(min(max(score, 0.0), 1.0), 4)
|
|
|
|
| 481 |
wrong_rollbacks = state.get("wrong_rollbacks", 0)
|
| 482 |
if wrong_rollbacks > 0:
|
| 483 |
p = min(wrong_rollbacks * 0.08, 0.20)
|
| 484 |
+
breakdown["wrong_rollback_penalty"] = p
|
| 485 |
score -= p
|
| 486 |
|
| 487 |
score = round(min(max(score, 0.0), 1.0), 4)
|