shortest path curriculum (#271)

This commit is contained in:
Zafir Stojanovski 2025-03-05 22:46:10 +01:00 committed by GitHub
parent 5bac641650
commit f426db90ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 2 deletions

View file

@ -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)