Port PebbleGame3D to solver/datagen/pebble_game.py #2

Closed
opened 2026-02-02 19:32:03 +00:00 by forbes · 0 comments
Owner

Summary

Move PebbleGame3D class from data/synthetic/pebble-game.py (L130-367) into solver/datagen/pebble_game.py.

Class overview

The (6,6)-pebble game tests Tay sparsity conditions incrementally for 3D body-bar-hinge rigidity. Each vertex (rigid body) starts with K=6 pebbles. To insert an edge, L+1=7 pebbles must be collected on its two endpoints. If successful, the edge is independent; otherwise redundant.

Methods to port

  • __init__ — initializes PebbleState, edge counter, body set
  • add_body(body_id) — registers body with 6 free pebbles
  • add_joint(joint) — expands joint to multigraph edges, tests each
  • _try_insert_edge(edge_id, u, v) — core pebble collection + edge acceptance
  • _search_and_collect(target, forbidden) — DFS to find/move free pebbles
  • _reverse_path(edge_ids, pebble_source) — reverses directed edges along path
  • get_dof(), get_internal_dof(), is_rigid(), get_redundant_count()
  • classify_assembly(grounded) — returns well-constrained/under/over/mixed

Requirements

  • Import types from solver.datagen.types (JointType, Joint, PebbleState)
  • Full type annotations on all methods
  • Preserve algorithm docstrings and references (Lee & Streinu, Tay)
  • No behavioral changes
  • __all__ = ["PebbleGame3D"]

Depends on

  • #1 (shared types)
## Summary Move `PebbleGame3D` class from `data/synthetic/pebble-game.py` (L130-367) into `solver/datagen/pebble_game.py`. ## Class overview The (6,6)-pebble game tests Tay sparsity conditions incrementally for 3D body-bar-hinge rigidity. Each vertex (rigid body) starts with K=6 pebbles. To insert an edge, L+1=7 pebbles must be collected on its two endpoints. If successful, the edge is independent; otherwise redundant. ## Methods to port - `__init__` — initializes `PebbleState`, edge counter, body set - `add_body(body_id)` — registers body with 6 free pebbles - `add_joint(joint)` — expands joint to multigraph edges, tests each - `_try_insert_edge(edge_id, u, v)` — core pebble collection + edge acceptance - `_search_and_collect(target, forbidden)` — DFS to find/move free pebbles - `_reverse_path(edge_ids, pebble_source)` — reverses directed edges along path - `get_dof()`, `get_internal_dof()`, `is_rigid()`, `get_redundant_count()` - `classify_assembly(grounded)` — returns well-constrained/under/over/mixed ## Requirements - [ ] Import types from `solver.datagen.types` (JointType, Joint, PebbleState) - [ ] Full type annotations on all methods - [ ] Preserve algorithm docstrings and references (Lee & Streinu, Tay) - [ ] No behavioral changes - [ ] `__all__ = ["PebbleGame3D"]` ## Depends on - #1 (shared types)
forbes added the phase:1port labels 2026-02-02 19:32:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/solver#2