mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
shortest path curriculum (#271)
This commit is contained in:
parent
5bac641650
commit
f426db90ec
3 changed files with 58 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ from dataclasses import dataclass
|
|||
from random import Random
|
||||
from typing import Any, Optional
|
||||
|
||||
from ..coaching import AttributeType, BaseCurriculum, RangeAttributeDefinition
|
||||
from ..factory import ProceduralDataset, register_dataset
|
||||
|
||||
QUESTION_TEMPLATE = """Your task is to find the shortest path from the start to the destination point in a grid.
|
||||
|
|
@ -163,4 +164,33 @@ class ShortestPathDataset(ProceduralDataset):
|
|||
}
|
||||
|
||||
|
||||
class ShortestPathCurriculum(BaseCurriculum):
|
||||
def __init__(self):
|
||||
super().__init__(ShortestPathCurriculum.__name__, ShortestPathConfig)
|
||||
|
||||
# Define attributes
|
||||
self._define_attributes(
|
||||
RangeAttributeDefinition(
|
||||
name="rows",
|
||||
levels=[10, 25, 50, 100],
|
||||
default_level=0,
|
||||
description="Number of rows in the grid",
|
||||
attr_type=AttributeType.APPEND,
|
||||
min_value=2,
|
||||
lower_field_name="min_rows",
|
||||
upper_field_name="max_rows",
|
||||
),
|
||||
RangeAttributeDefinition(
|
||||
name="cols",
|
||||
levels=[10, 25, 50, 100],
|
||||
default_level=0,
|
||||
description="Number of columns in the grid",
|
||||
attr_type=AttributeType.APPEND,
|
||||
min_value=2,
|
||||
lower_field_name="min_cols",
|
||||
upper_field_name="max_cols",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
register_dataset("shortest_path", ShortestPathDataset, ShortestPathConfig)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue