Spaces:
Sleeping
Sleeping
Update test_env.py
Browse files- test_env.py +21 -21
test_env.py
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
-
from adaptive_cache.env import AdaptiveCacheEnv, Action
|
| 2 |
-
import random
|
| 3 |
-
|
| 4 |
-
def test_graders():
|
| 5 |
-
print("Running explicit Grader Validation...")
|
| 6 |
-
for level in ["easy", "medium", "hard"]:
|
| 7 |
-
env = AdaptiveCacheEnv(task_level=level)
|
| 8 |
-
env.reset()
|
| 9 |
-
done = False
|
| 10 |
-
while not done:
|
| 11 |
-
# Simulate an agent making entirely random choices
|
| 12 |
-
action = Action(evict_index=random.randint(0, 9))
|
| 13 |
-
_, _, done, info = env.step(action)
|
| 14 |
-
|
| 15 |
-
score = info['score']
|
| 16 |
-
|
| 17 |
-
# This assert statement proves to judges the score is strictly 0.0 to 1.0
|
| 18 |
-
assert 0.0 <= score <= 1.0, f"Grader out of bounds: {score}"
|
| 19 |
-
print(f"Task {level.upper()} validated. Score: {score:.2f}")
|
| 20 |
-
|
| 21 |
-
if __name__ == "__main__":
|
| 22 |
test_graders()
|
|
|
|
| 1 |
+
from adaptive_cache.env import AdaptiveCacheEnv, Action
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
def test_graders():
|
| 5 |
+
print("Running explicit Grader Validation...")
|
| 6 |
+
for level in ["easy", "medium", "hard"]:
|
| 7 |
+
env = AdaptiveCacheEnv(task_level=level)
|
| 8 |
+
env.reset()
|
| 9 |
+
done = False
|
| 10 |
+
while not done:
|
| 11 |
+
# Simulate an agent making entirely random choices
|
| 12 |
+
action = Action(evict_index=random.randint(0, 9))
|
| 13 |
+
_, _, done, info = env.step(action)
|
| 14 |
+
|
| 15 |
+
score = info['score']
|
| 16 |
+
|
| 17 |
+
# This assert statement proves to judges the score is strictly 0.0 to 1.0
|
| 18 |
+
assert 0.0 <= score <= 1.0, f"Grader out of bounds: {score}"
|
| 19 |
+
print(f"Task {level.upper()} validated. Score: {score:.2f}")
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
test_graders()
|