diff --git a/reasoning_gym/algorithmic/graph_color.py b/reasoning_gym/algorithmic/graph_color.py index 408a9f43..b555ec59 100644 --- a/reasoning_gym/algorithmic/graph_color.py +++ b/reasoning_gym/algorithmic/graph_color.py @@ -197,6 +197,9 @@ class GraphColorDataset(ProceduralDataset): num_colors=num_colors, ) solution = greedy_graph_coloring(puzzle) + if not solution: + num_vertices = rng.randint(self.config.min_num_vertices, self.config.max_num_vertices) + num_colors = rng.randint(self.config.min_num_colors, self.config.max_num_colors) edges = str(puzzle["edges"]) question = f"""Please provide a coloring for this graph such that every vertex is not connected to a vertex of the same color. The graph has these properties: @@ -253,21 +256,21 @@ class GraphColorCurriculum(BaseCurriculum): self._define_attributes( RangeAttributeDefinition( name="num_vertices", - levels=[10, 20, 30, 40], + levels=[10, 12, 15, 18], default_level=0, description="Number of vertices in the graph", - attr_type=AttributeType.APPEND, + attr_type=AttributeType.STATIC, min_value=10, lower_field_name="min_num_vertices", upper_field_name="max_num_vertices", ), RangeAttributeDefinition( name="num_colors", - levels=[3, 4, 5, 6], + levels=[5, 4, 3], default_level=0, description="Number of colors in the graph", - attr_type=AttributeType.APPEND, - min_value=2, + attr_type=AttributeType.STATIC, + min_value=3, lower_field_name="min_num_colors", upper_field_name="max_num_colors", ),