diff --git a/README.md b/README.md index 10a938a..967a1fe 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,26 @@ A solver laboratory for geometric tiling puzzles, starting with the tropical puz The aim is a research platform, not a single solver: - several custom Rust algorithms that can be developed and compared side by side; -- established engines such as OR-Tools CP-SAT as independent backends; +- established engines such as OR-Tools CP-SAT, as alternative formulations over the same generated placements; - Python prototypes that migrate to Rust once the idea is settled; - geometry, candidate generation, input formats, validation and benchmarking shared by all of them; - experiments on puzzle difficulty, ambiguity, uniqueness and geometric tolerances. Python owns orchestration and analysis. Rust owns the geometry and the search. +## What we've learned so far + +Three findings from the corpus so far, in plain terms. The details and the caveats are in the linked documents. + +- **The third dimension changes the search problem.** `new1` has 16 pieces. Laid flat, the search needs 1 064 878 nodes to find its assembly and show there is no other. With the roofs on, the same pieces need 68 nodes, a difference of more than four orders of magnitude. The roofs work by saying which edges can meet: on average a piece edge has between 1 and 7 possible partners with roofs, and about 77 of 82 on flat `new1`. These counts are nodes in this solver's search tree. They are not running times and not a measure of how hard the puzzle is for a person. ([experiments](docs/experiments.md#flat-against-relief-tolerance-heuristic-puzzle)) +- **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)) + +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. `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: 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). ```python from maxplus_solvers import load_puzzle diff --git a/docs/architecture.md b/docs/architecture.md index b4f5f1e..cd48f76 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -9,7 +9,7 @@ The algorithmic background is the [research brief](research-brief.md): problem t A solver laboratory, not a single solver. It should be easy to: - develop and compare several custom Rust algorithms; -- use established engines such as OR-Tools CP-SAT; +- use established engines such as OR-Tools CP-SAT, as alternative formulations over the generated candidates; - prototype in Python and move the hot parts to Rust; - share geometry, candidate generation, input formats, validation and benchmarking across solvers; - study puzzle difficulty, ambiguity, uniqueness and the effect of geometric tolerances.