Candidate ordering has an enormous effect on time to the first solution. The current solver tries sizes in descending order, while published smallest-valley implementations found ascending order effective.
Parallel workers may also benefit from complementary orderings rather than identical traversal.
Proposed work
Make candidate ordering a search policy.
Compare ascending, descending and justified best-fit policies.
## Background
Candidate ordering has an enormous effect on time to the first solution. The current solver tries sizes in descending order, while published smallest-valley implementations found ascending order effective.
Parallel workers may also benefit from complementary orderings rather than identical traversal.
## Proposed work
- Make candidate ordering a search policy.
- Compare ascending, descending and justified best-fit policies.
- Optionally add seeded deterministic randomized ordering.
- Evaluate a multi-worker portfolio with complementary policies.
- Keep reproducible seeds in benchmark reports.
## Acceptance criteria
- Search completeness is independent of policy.
- Benchmarks report distributions over repeated runs where randomness is used.
- Select a stable default based on time-to-first-solution, not solution enumeration.
- Record node counts as well as elapsed time.
## References
- https://www.or.uni-bonn.de/~hougardy/paper/PerfectRectanglePacking.pdf
- https://github.com/lightln2/partridge-solver
Introduce an explicit deterministic search policy with ascending, descending, and best-fit choices.
Define best-fit as trying an available square exactly matching the selected valley width first, then the remaining candidates in ascending order. This closes the valley without a shelf remainder when possible while still trying every fitting candidate.
Preserve benchmark schema-v1 and --candidate-order compatibility; best-fit is an additional field value, not a wire-format rename.
Do not add seeded randomization or a worker portfolio: measured deterministic policies already identify a default, ascending/best-fit have little search-tree diversity, descending is consistently slower, and shared-frontier parallelism belongs to #11.
Repeated single-worker Release measurements (Apple Clang 21, arm64, -O3 -DNDEBUG), with independent validation and stable counters:
order
policy
counted median
counter-free median
nodes
8
ascending
0.808 s
0.794 s
7,735,369
8
descending
1.310 s
1.268 s
12,186,125
8
best-fit
0.817 s
0.823 s
7,679,349
9 direct
ascending
5.522 s
not measured
45,840,266
9 direct
best-fit
5.651 s
not measured
45,746,016
Ascending remains the stable single-thread default because it has the lowest measured time to first solution for orders 8 and direct 9. Best-fit's slightly smaller trees do not offset its policy checks. Exhaustive order-5 searches visit identical node counts under all three policies, confirming ordering does not affect completeness.
10x10/11x11 assessment: issue #4 established that public/direct order 10 exceeds a 20-second exploratory cap, and public order 11 first performs the same order-10 search. Best-fit changes direct order-9 nodes by only about 0.2%, so there is no evidence to repeat a long order-10 probe. Both stay opt-in benchmarks; automated route-boundary coverage still verifies order 11 chooses construction.
Review and verification:
independent diff review found no correctness issue;
References: issue #12, issue #4's merged skyline measurements, and Hougardy's observation that candidate order strongly changes feasible-instance time to first solution.
Implementation/review decision before merge:
- Introduce an explicit deterministic search policy with `ascending`, `descending`, and `best-fit` choices.
- Define best-fit as trying an available square exactly matching the selected valley width first, then the remaining candidates in ascending order. This closes the valley without a shelf remainder when possible while still trying every fitting candidate.
- Preserve benchmark schema-v1 and `--candidate-order` compatibility; `best-fit` is an additional field value, not a wire-format rename.
- Do not add seeded randomization or a worker portfolio: measured deterministic policies already identify a default, ascending/best-fit have little search-tree diversity, descending is consistently slower, and shared-frontier parallelism belongs to #11.
Repeated single-worker Release measurements (Apple Clang 21, arm64, -O3 -DNDEBUG), with independent validation and stable counters:
| order | policy | counted median | counter-free median | nodes |
| --- | --- | ---: | ---: | ---: |
| 8 | ascending | 0.808 s | 0.794 s | 7,735,369 |
| 8 | descending | 1.310 s | 1.268 s | 12,186,125 |
| 8 | best-fit | 0.817 s | 0.823 s | 7,679,349 |
| 9 direct | ascending | 5.522 s | not measured | 45,840,266 |
| 9 direct | best-fit | 5.651 s | not measured | 45,746,016 |
Ascending remains the stable single-thread default because it has the lowest measured time to first solution for orders 8 and direct 9. Best-fit's slightly smaller trees do not offset its policy checks. Exhaustive order-5 searches visit identical node counts under all three policies, confirming ordering does not affect completeness.
10x10/11x11 assessment: issue #4 established that public/direct order 10 exceeds a 20-second exploratory cap, and public order 11 first performs the same order-10 search. Best-fit changes direct order-9 nodes by only about 0.2%, so there is no evidence to repeat a long order-10 probe. Both stay opt-in benchmarks; automated route-boundary coverage still verifies order 11 chooses construction.
Review and verification:
- independent diff review found no correctness issue;
- Release CTest: 10/10 passed (10.46 s);
- Debug CTest: 10/10 passed (63.71 s);
- benchmark emitted valid schema-v1 best-fit output;
- `git diff --check` passed.
References: issue #12, issue #4's merged skyline measurements, and Hougardy's observation that candidate order strongly changes feasible-instance time to first solution.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Background
Candidate ordering has an enormous effect on time to the first solution. The current solver tries sizes in descending order, while published smallest-valley implementations found ascending order effective.
Parallel workers may also benefit from complementary orderings rather than identical traversal.
Proposed work
Acceptance criteria
References
Does a single policy apply across multiple sizes?
Implementation/review decision before merge:
ascending,descending, andbest-fitchoices.--candidate-ordercompatibility;best-fitis an additional field value, not a wire-format rename.Repeated single-worker Release measurements (Apple Clang 21, arm64, -O3 -DNDEBUG), with independent validation and stable counters:
Ascending remains the stable single-thread default because it has the lowest measured time to first solution for orders 8 and direct 9. Best-fit's slightly smaller trees do not offset its policy checks. Exhaustive order-5 searches visit identical node counts under all three policies, confirming ordering does not affect completeness.
10x10/11x11 assessment: issue #4 established that public/direct order 10 exceeds a 20-second exploratory cap, and public order 11 first performs the same order-10 search. Best-fit changes direct order-9 nodes by only about 0.2%, so there is no evidence to repeat a long order-10 probe. Both stay opt-in benchmarks; automated route-boundary coverage still verifies order 11 chooses construction.
Review and verification:
git diff --checkpassed.References: issue #12, issue #4's merged skyline measurements, and Hougardy's observation that candidate order strongly changes feasible-instance time to first solution.