Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Rules:
- **Search rules are switches, and the measurement is the product.** The question is what makes a puzzle hard and what helps, not how fast a solver is. A pruning rule, an ordering or a symmetry reduction added to a solver is an option that can be turned off, is tested not to change what the whole search finds, and gets its row in the ablation table of `docs/algorithms.md`. A rule that costs more than it saves stays, switched off, with its numbers.
- **Experiments are callers.** `experiments/` goes through `api.solve` like any user, and nothing outside it imports it. Only `experiments/plotting.py` imports matplotlib; running a manifest needs no plotting stack.
- **A committed table has no times.** `benchmarks/results/*.md` are written with `--no-times`: statuses and counts, which a deterministic solver reproduces exactly and a test compares. Times, CP-SAT's own counts and the `.jsonl` records belong to a machine and are not committed. When a solver change moves a count, regenerate the table with the command and say why in the commit.
- **The suite does not run million-node searches.** The footprints in `corpus.EXPENSIVE` (`tests/support/corpus.py`: `cor1-flat`, `new1-flat`, `new2-flat`) are left out of the per-fixture tests, and the table tests reproduce every other row with `maxplus-bench run --only`. Their rows are checked against a search only by running the full command, so a solver change that could move them means running it by hand. There is no `slow` marker; a test that needs one is a test to make smaller.
- **The suite does not run million-node searches.** The fixtures in `corpus.EXPENSIVE` (`tests/support/corpus.py`: `cor1-flat`, `new1-flat`, `new2-flat`, and all ten Pleat fixtures, `plt1` to `plt5` with their footprints) are left out of the per-fixture tests, and the table tests reproduce every other row with `maxplus-bench run --only`. Their rows are checked against a search only by running the full command, so a solver change that could move them means running it by hand. There is no `slow` marker; a test that needs one is a test to make smaller.
- **Completeness and uniqueness are explicit claims.** A result says whether the search was exhaustive and over which candidate set. "No solution found" and CP-SAT `INFEASIBLE` are relative to the candidates generated unless completeness is proven.
- **Layering is one-way:** core ← geometry ← search ← py. Python reaches Rust only through `_native`.
- **Production solvers cross the Python/Rust boundary once per solve.** Prototypes may call individual geometry primitives; a Rust solver receives the instance and runs to completion. `cp_sat.placements` makes its one call for the list of placements and their conflicts; everything it then needs, down to which placement a tray rotation turns each into, is in that answer.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ Three findings from the corpus so far, in plain terms. The details and the cavea
- **Knowing the structure can matter more than a better search.** Tropical cuts never leave a T-junction between pieces. Searching only for assemblies whose pieces meet edge to edge takes flat `new1` from 1 064 878 nodes to 49, which is fewer than the roofs alone need. Finding the right structure did more here than any improvement to the search algorithm. This is an assumption, though, and not a shortcut: it narrows which assemblies count. For example, `rat1` laid flat has 101 assemblies, and only the intended one has no T. ([algorithms](docs/algorithms.md#assuming-the-pieces-meet-edge-to-edge))
- **Difficulty has more than one dimension.** The number of pieces is not a reliable guide. Two nine-piece flat puzzles cost 45 and 6 104 nodes, more than two orders of magnitude apart. Ambiguity varies as well: the 11-piece `rat1` has 101 assemblies without its roofs and one with them. ([difficulty proxies](docs/experiments.md#difficulty-proxies))

- **Roofs can be made to help less.** The Pleat puzzles, built for this in Tropical Puzzle Lab, stand every corner of a grid of triangles at one of just two heights, so many edges look alike even with their roofs. The hardest, `plt1` with 32 pieces, takes 21 973 nodes with its roofs on and still has one assembly, against 1 529 for `cor1` and at most 94 for the rest. Without roofs the same triangles fit together in tens of thousands of ways. Assuming edge to edge brings it down to 749 nodes, and CP-SAT settles it without a single conflict, so it is hard for this search, not for every method. ([experiments](docs/experiments.md#the-corpus-table))

One question is still open. `cor1`, with 27 pieces, was built to be hard, and its flat search has not been seen to finish. Everything above is computational evidence, not proof. It is relative to the placements the solvers generate and to floating-point arithmetic with stated tolerances. [docs/solver-contract.md](docs/solver-contract.md) says exactly what a result claims.

## Status

**Contracts and fixtures.** The instance format, the sanitizing importer and the benchmark corpus exist: 18 puzzles from Tropical Puzzle Lab (nine constructions, each with its roofs and without) and 4 synthetic ones with known solution counts, each with an answer key that only tests read. An independent validator checks an assembly against the browser player's completion rules. The Rust geometry kernel (separating-axis depth, convex clipping, containment, edge signatures, roof continuity) is in place and agrees with the validator on random poses of every fixture's pieces. Three solvers exist. `python.contact_dfs` is a Python prototype of the contact search. `rust.contact_dfs` is that search in Rust with roofs, pruning and symmetry handling: it runs the search to its end on 17 of the 18 corpus puzzles, and every assembly it returns passes the validator. The eighteenth, `cor1-flat`, was built to be hard and has not been seen to end without roofs. `cp_sat.placements` hands the placements that search reaches to OR-Tools CP-SAT as a plain choice problem, and returns the same assemblies by other means. It is a second formulation over the same candidate set, not an independent enumeration of every possible placement. It checks the search's bookkeeping and pruning, but it cannot find an assembly that uses a placement the search never generated. `maxplus-bench` runs experiment manifests over the corpus and writes the results table; [docs/experiments.md](docs/experiments.md) has what the first experiments found about tolerance, heuristics and difficulty proxies. Each rule of either can be switched off, because the question here is what makes a puzzle hard and what helps, not how fast one solver is; [docs/algorithms.md](docs/algorithms.md) has the measurements. `rust.contact_dfs` can also be told to assume that the pieces meet edge to edge, as every tropical cut does (`--assume edge-to-edge`); then the footprint puzzles that took a million nodes take about fifty. The work is laid out in [docs/roadmap.md](docs/roadmap.md), and the design in [docs/architecture.md](docs/architecture.md).
**Contracts and fixtures.** The instance format, the sanitizing importer and the benchmark corpus exist: 28 puzzles from Tropical Puzzle Lab (fourteen constructions, each with its roofs and without) and 4 synthetic ones with known solution counts, each with an answer key that only tests read. An independent validator checks an assembly against the browser player's completion rules. The Rust geometry kernel (separating-axis depth, convex clipping, containment, edge signatures, roof continuity) is in place and agrees with the validator on random poses of every fixture's pieces. Three solvers exist. `python.contact_dfs` is a Python prototype of the contact search. `rust.contact_dfs` is that search in Rust with roofs, pruning and symmetry handling: it runs the search to its end on 22 of the 28 corpus puzzles, and every assembly it returns passes the validator. The other six are footprints it stops at 1 500 000 nodes: `cor1-flat`, built to be hard, and the five Pleat footprints, which have tens of thousands of assemblies each. `cp_sat.placements` hands the placements that search reaches to OR-Tools CP-SAT as a plain choice problem, and returns the same assemblies by other means. It is a second formulation over the same candidate set, not an independent enumeration of every possible placement. It checks the search's bookkeeping and pruning, but it cannot find an assembly that uses a placement the search never generated. `maxplus-bench` runs experiment manifests over the corpus and writes the results table; [docs/experiments.md](docs/experiments.md) has what the first experiments found about tolerance, heuristics and difficulty proxies. Each rule of either can be switched off, because the question here is what makes a puzzle hard and what helps, not how fast one solver is; [docs/algorithms.md](docs/algorithms.md) has the measurements. `rust.contact_dfs` can also be told to assume that the pieces meet edge to edge, as every tropical cut does (`--assume edge-to-edge`); then the footprint puzzles that took a million nodes take about fifty. The work is laid out in [docs/roadmap.md](docs/roadmap.md), and the design in [docs/architecture.md](docs/architecture.md).

```python
from maxplus_solvers import load_puzzle
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fixtures/cor1-flat.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
},
"source": {
"repository": "https://github.com/maxpluslab/tropical-puzzle-lab",
"commit": "cfe2c8be097132aa378b2cf397b93524fb869fe1",
"commit": "d3153f5b6a84aab7242bad12b443687c19375691",
"puzzleId": "cor1-flat",
"geometryHash": "049804fdb45e2f37430c7616cd461063ac9d71eedc67e963f2c77ac1ce95bcf5"
}
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/fixtures/cor1.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@
},
"source": {
"repository": "https://github.com/maxpluslab/tropical-puzzle-lab",
"commit": "cfe2c8be097132aa378b2cf397b93524fb869fe1",
"commit": "d3153f5b6a84aab7242bad12b443687c19375691",
"puzzleId": "cor1",
"geometryHash": "78efff393692b812602735262414c51f99283649055de578ec070a3c7497c0e1"
}
Expand Down
Loading
Loading