Repository navigation
Phase 6: the CP-SAT backend over reachable placements - #7
Merged
Merged
Conversation
cp_sat.placements hands OR-Tools CP-SAT a finite list of placements and what they exclude among themselves, and chooses an assembly from it. The list is the placements the corner search of rust.contact_dfs puts down anywhere in its tree, built in one Rust call (tiling-search::enumerate) together with their conflicts (tiling-geometry::conflict). The model: one Boolean per placement; each class of congruent pieces takes as many placements as it has members; overlaps stated as "at most one" over a grid of probe points and the rest as pairs; coverage stated as "at least one" per probe point of the target. One worker, no objective. Tray rotations are removed from the choices using the images Rust reports, so the solver still crosses into Rust once. Switches: the listing search's anchor, cavity_pruning, closure_pruning and tray_rotations; coverage; targeted_probes (off: fewer pairs, slower). The exit test, tests/corpus/test_cp_sat.py, runs both solvers to the end on all 20 fixtures and compares the assemblies as placed polygons. The model's exclusions are also checked pair by pair against Shapely. Findings are in docs/algorithms.md: once the placements are listed the choice takes none to a few hundred conflicts where the search takes up to a million nodes, and the coverage constraints are what make it so. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jfg9fgTR9LYn4D2rTtfifs
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jfg9fgTR9LYn4D2rTtfifs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 6 of the roadmap, chained on #6 (phase 5).
What it adds
cp_sat.placements: OR-Tools CP-SAT choosing an assembly from a finite list of placements. The solver knows no geometry. Rust builds the list and what its members exclude among themselves in one call; CP-SAT runs with one worker and no objective.rust.contact_dfsputs down anywhere in its tree (tiling-search::enumerate). A list built without a search, by closing contacts under contacts, was tried first and does not stay small.tiling-geometry::conflict); coverage stated as "at least one" per probe point of the target.anchor,cavity_pruning,closure_pruning,tray_rotations;coverage;targeted_probes(off: fewer pairs, slower).cp-sat; importing the package does not load it.Exit criterion
tests/corpus/test_cp_sat.py: on all 20 fixtures, in their own regimes, CP-SAT and the Rust search both run to the end and return the same assemblies, compared as placed polygons up to the tray's rotations. Every one passes the validator.Also: the model's exclusions against Shapely pair by pair, hand-countable unit puzzles, every switch on and off, limits, and architecture tests for the new solver. The solver was broken by hand seven ways and the tests watched to fail.
Findings
Relative to the listed placements, in f64 with tolerances. Tables in
docs/algorithms.md.new1-flattakes 297 conflicts andnew2-flatnone, where the search takes about a million nodes each. The search's trouble is meeting the same dead ends again, not the number of combinations.rat1-flatin a minute; with it, 19 conflicts.Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01Jfg9fgTR9LYn4D2rTtfifs