Implementation:Open compass VLMEvalKit VGRPBench Common Puzzle Factory
| Field | Value |
|---|---|
| source | VLMEvalKit |
| domain | Vision, Evaluation, Puzzle_Solving |
Overview
Provides the base PuzzleFactory class that all VGRPBench puzzle types inherit from.
Description
This module defines the abstract base PuzzleFactory class used by all puzzle-specific factories in VGRPBench. It provides shared infrastructure including a constraint list, hint sampling via random cell selection, puzzle saving with train/val/ablation dataset splitting based on unique solutions, and a unified check method that iterates through all registered constraints. The hint_type utility function parses command-line hint arguments accepting either "random" or integer values.
Usage
Called internally by VGRPBench evaluation pipeline for puzzle constraint verification.
Code Reference
- Source:
vlmeval/dataset/utils/vgrpbench/puzzles/common_puzzle_factory.py, Lines: L1-136 - Import:
from vlmeval.dataset.utils.vgrpbench.puzzles.common_puzzle_factory import PuzzleFactory
Key Classes:
class PuzzleFactory:
def __init__(self) -> None: ...
def sample_hints(self, board, num_sample_hints): ...
def save_puzzles(self, puzzles, save_path, filename): ...
def check(self, game_state): ...
def get_possible_values(self, game_state, row, col): ...
Key Functions:
def hint_type(value): ...
I/O Contract
| Direction | Description |
|---|---|
| Inputs | Puzzle grid state with board and constraint parameters; puzzle lists for saving |
| Outputs | Boolean validation result from constraint checking; JSON dataset files for train/val/ablation splits |
Usage Examples
# Internal usage - subclassed by specific puzzle factories
from vlmeval.dataset.utils.vgrpbench.puzzles.common_puzzle_factory import PuzzleFactory
class MyPuzzleFactory(PuzzleFactory):
def __init__(self, size):
super().__init__()
self.constraints = [...]