mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
maze curriculum (#343)
This commit is contained in:
parent
cb7ae5c58e
commit
c81036004f
3 changed files with 63 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from reasoning_gym import create_dataset
|
||||
from reasoning_gym.games.maze import MazeConfig, MazeDataset
|
||||
from reasoning_gym.games.maze import MazeConfig, MazeCurriculum, MazeDataset
|
||||
|
||||
|
||||
def test_maze_config_validation():
|
||||
|
|
@ -125,3 +125,28 @@ def _bfs_distance(maze, start, goal, wall_char):
|
|||
queue.append((nr, nc, dist + 1))
|
||||
|
||||
return None # no path found
|
||||
|
||||
|
||||
def test_maze_curriculum():
|
||||
curriculum = MazeCurriculum()
|
||||
|
||||
base_value = {"size": 150, "seed": 1}
|
||||
|
||||
base_cfg: MazeConfig = curriculum.generate_configuration(base_value)
|
||||
assert base_cfg.seed == 1
|
||||
assert base_cfg.size == 150
|
||||
assert base_cfg.min_dist == 10 and base_cfg.max_dist == 25
|
||||
assert base_cfg.min_grid_size == 10 and base_cfg.max_grid_size == 25
|
||||
|
||||
# test incrementing attribute levels
|
||||
curriculum.increment_attr_level("dist")
|
||||
curriculum.increment_attr_level("grid_size")
|
||||
increased_cfg = curriculum.generate_configuration(base_value)
|
||||
assert increased_cfg.min_dist == 10 and increased_cfg.max_dist == 50
|
||||
assert increased_cfg.min_grid_size == 10 and increased_cfg.max_grid_size == 50
|
||||
|
||||
# test decrementing attribute level for dist again
|
||||
curriculum.decrement_attr_level("dist")
|
||||
partially_decreased_cfg = curriculum.generate_configuration(base_value)
|
||||
assert partially_decreased_cfg.min_dist == 10 and partially_decreased_cfg.max_dist == 25
|
||||
assert partially_decreased_cfg.min_grid_size == 10 and partially_decreased_cfg.max_grid_size == 50
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue