Skip to content

Hard relief - #13

Merged
madeline-v-brandt merged 2 commits into
mainfrom
hard-relief
Nov 17, 2026
Merged

madeline-v-brandt merged 2 commits into
mainfrom
hard-relief

Conversation

@kuvychko

Copy link
Copy Markdown
Member

Add the Pleat puzzles to the corpus: relief puzzles harder than cor1

Imports plt1–plt5 from maxpluslab/tropical-puzzle-lab at d3153f5. Each is a grid of rectangles cut along their diagonals, with every corner at one of two heights. They were built so that this search finds them hard with their roofs on. The corpus grows from 18 to 28 fixtures and from nine to fourteen constructions.

Merge after the tropical-puzzle-lab lifted-family PR. CI checks that repository out at d3153f5.

What the corpus table now says

Fixture Pieces Nodes, whole search Assemblies Assuming edge to edge
cor1 (for comparison) 27 1 529 1 967
plt1 32 21 973 1 749
plt2 32 18 490 1 639
plt3 32 11 611 1 615
plt4 32 10 787 1 678
plt5 24 7 488 1 436
plt1-flat … plt5-flat 24–32 stopped at 1 500 000 ≥ 26 998 to ≥ 95 344 ends: 288 each, 72 for plt5-flat
  • The exit criterion is met (tests/corpus/test_hard_relief.py): a Pleat relief puzzle takes at least 10 000 nodes with one assembly, more than cor1, which had been the hardest. Every 32-piece Pleat is past cor1.
  • The roofs leave each edge many possible mates. The mean degree of the edge graph is 16–24, against at most 6.7 for every other relief puzzle.
  • The difficulty belongs to this search. Assuming edge to edge, every Pleat drops below cor1's 967 nodes, because most wrong matches are a short edge part way along a long one. CP-SAT, choosing among the same placements, settles each without a conflict.
  • The 288 and 72 match a formula. They equal 4!·4!/2 and 4!·3!/2: every order of the columns and rows, counted once with the half turn. That's a match in count only; the assemblies haven't been checked one by one.

Keeping the suite small

The Pleat searches are not run in the suite.

  • corpus.EXPENSIVE: all ten Pleat fixtures are in it, so the tests read their rows fromhe full maxplus-bench run checks those rows against a search.
  • corpus.UNFINISHED: the five footprints are in it too; their searches stop at the node limit.
  • CP-SAT: it is not given the Pleat footprints in benchmarks/manifests/corpus.toml. Thelimit, and CP-SAT would then enumerate every assembly of it. One attempt grew past 2.5 GB.
  • New rows: the Pleat rows were generated by running both manifests --only on the ten Pleat fixtures. No other row moves.

The whole suite takes about 2 min 40 s.

Fixes the Pleat puzzles forced

1. The duplicate check was quadratic (08da344). Each new assembly was compared with every earlier one. That cost grows with the square of the number found, and a Pleat footprint with tens of thousands of
assemblies would have taken about nine hours.

  • New assemblies are now checked by bisection over a sorted list of canonical forms (canonical::Form, Symmetry::compare_forms). The same assemblies are found and counted.
  • At 80 000 nodes, plt1-flat took 89.6 s before and 2.4 s after.
  • A unit test checks that two forms compare equal exactly when the assemblies are the same.

2. The validator lost whole pieces (f27f246). Uncovered area came from GEOS's floating-point union (Shapely on GEOS 3.14), which can silently drop a whole piece. It wrongly failed:

  • 810 mm² of CP-SAT's plt4 assembly;
  • up to 7 % of the edge-to-edge Pleat footprint assemblies;
  • cor1's own answer key turned half round with the tray, a puzzle already in the corpus.

The union is now snap-rounded to a 1e-9 mm grid (validation.GRID_MM). The regression test, every answer key turned with the tray validates, failed on cor1 before the fix. No row already committed had been
affected: those runs happened to avoid the bug.

3. Two test oracles relied on Shapely with no margin. The Rust geometry was right in both

  • The cavity oracle had the same union bug. It now unions pieces that were each grown slightly first.
  • The blocker oracle hit a tie: two pieces equally deep, to 7e-15 mm. It now accepts either.

Other test changes

  • test_benchmark.py: the thinning test allows Pleat less thinning, and a new test pins that Pleat leaves each edge many mates. The tolerance experiment was run before Pleat existed, so its test now leaves Pleat out explicitly.
  • test_edge_to_edge.py: adds the edge-to-edge assembly counts for the Pleat footprints.imit with assemblies found now counts as "solved, not whole".
  • Per-fixture tests: the CP-SAT, placement-model and contact-search tests leave out EXPENSIVE. Their bookkeeping tests list exactly what is left out.

Docs

  • README.md: a finding, "Roofs can be made to help less".
  • docs/experiments.md: what the corpus table shows for Pleat.
  • docs/algorithms.md: Pleat rows in the edge-to-edge table, and a paragraph.
  • docs/roadmap.md: a dated entry for this addition.
  • CLAUDE.md: the list of fixtures in EXPENSIVE.

Checks

  • uv run pytest: 2024 passed, including the comparison of the fixtures with the tropical-pu
  • ruff check, ruff format --check and pyright are clean.
  • cargo fmt, clippy -D warnings and cargo test are clean.

🤖 Generated with Claude Code

kuvychko and others added 2 commits November 16, 2026 12:21
record() compared each new assembly with every assembly already found, and
worked out both canonical forms again for each comparison. The cost grew
with the square of the number found: a footprint with tens of thousands of
assemblies (the flat Pleat puzzles of tropical-puzzle-lab) took about nine
hours to reach 1.5 million nodes. The search now keeps the canonical form
of each assembly in a list sorted by the tolerant order on forms, and
bisects it. Under the module's gap argument that order is total on forms
that differ, so the same assemblies are found, kept in the same order and
counted as duplicates the same way: no count in any table moves. plt1-flat
at 80 000 nodes: 3 593 assemblies, 89.6 s before, 2.4 s now; 1.5 million
nodes in 46 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfg9ffdDE7wGdk3wwUWE5H
…dator's union

Fixtures and keys regenerated from tropical-puzzle-lab d3153f5b6a84, which adds
plt1 to plt5: grids of triangles with every corner at one of two heights, built
to be hard for the contact search with roofs on. Relief, a whole search takes
7 488 to 21 973 nodes with one assembly, against cor1's 1 529; flat, the search
stops at the node limit with tens of thousands of assemblies found.

- All ten Pleat fixtures are in corpus.EXPENSIVE: the suite reads their rows
  from the committed tables and does not search them. The footprints are also
  UNFINISHED. tests/corpus/test_hard_relief.py is the exit test.
- CP-SAT is not given the Pleat footprints in the corpus manifest: it would
  enumerate every assembly of a listing stopped at the limit.
- The Pleat rows of corpus.md and edge_to_edge.md come from the two manifests
  run --only on the Pleat fixtures; no other row moves.

The validator's uncovered area came from GEOS's floating-point union, which
lost a whole piece on some assemblies (GEOS 3.14): 810 mm^2 of CP-SAT's plt4
assembly, up to 7 % of the edge-to-edge Pleat footprint assemblies, and cor1's
own answer key turned half round with the tray. The union is now snap-rounded
to a 1e-9 mm grid. The new test, every key turned with the tray validates,
failed on cor1 before the fix. Two test oracles had the same union and are
corrected too; the Rust geometry was right throughout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfg9ffdDE7wGdk3wwUWE5H
@madeline-v-brandt
madeline-v-brandt merged commit f8a9324 into main Nov 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants