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
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ uv run maxplus-bench run benchmarks/manifests/corpus.toml --no-times
uv run maxplus-bench run benchmarks/manifests/edge_to_edge.toml --no-times # the table in benchmarks/results/edge_to_edge.md
uv run maxplus-bench run benchmarks/manifests/tolerance.toml # an experiment; records go to benchmarks/results/<name>.jsonl
uv run maxplus-bench proxies --results benchmarks/results/corpus.jsonl # difficulty proxies against what the searches cost
uv run maxplus-bench figure # redraw docs/figures/at-a-glance.svg from the two committed tables
uv run python scripts/import_fixtures.py --source ../tropical-puzzle-lab # regenerate fixtures and keys
uv run python scripts/import_fixtures.py --source ../tropical-puzzle-lab --check # compare, write nothing
```
Expand Down Expand Up @@ -85,14 +86,15 @@ Rules:

## Invariants that are easy to break

- **A public number can be traced.** Every figure the README or `docs/` quotes names its puzzle, regime, solver, assumption and metric, and comes from a committed table or a stated run. Relative links and quoted repository paths in them resolve (`tests/architecture/test_doc_links.py`).
- **Solver instances carry no answer.** The source `puzzle.json` leaks the solution three ways: `reference.poses`; local polygons stored in their solved orientation (every reference `theta` is 0); and piece ids and order that encode the tropical construction. Instances must be sanitized: seeded random rotation per piece (roof gradient rotated with it), random starting vertex, shuffled order, opaque ids, no `reference`, `tropical` or `provenance`. The sanitizer seed is part of the answer, since the rotations can be recomputed from it: it is recorded in the answer key and never in an instance. Answer keys live under `tests/` and only tests load them.
- **An assumption is not a rule.** A pruning rule leaves what a whole search finds unchanged; an assumption (`SolverConfig.assumptions`, today only `edge-to-edge`) narrows it. A solver declares the assumptions it can make, a result records them and names a candidate set that says so, and results under different assumptions are not compared. Rules that follow from an assumption are options, tested not to change what the search finds under it.
- **Three information regimes stay separate:** footprint (polygons only), relief (polygons and roof planes), tropical-aware (construction data as well). A solver declares which one it uses; results from different regimes are not comparable.
- **The validator is independent of the search.** `validation.py` must not import `_native` or reuse the Rust geometry, so one bug cannot affect both. It follows the browser's completion rules and may only depart from them on the stricter side; the three places it does are listed in its module docstring.
- **Solvers never call the validator.** `api.solve(..., validate=True)` is the only place the two meet, after the search has returned. A search that consulted the validator would be checking its answer with its own oracle.
- **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.
- **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, then the README's figure with `maxplus-bench figure`, and say why in the commit.
- **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`.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2026 Igor Kuvychko
Copyright (c) 2026 Igor Kuvychko and Madeline V. Brandt

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading
Loading