Skip to content

release: v0.5.0 — exact-NFP construction mode (strategy="nfp") + multi-start order diversification + evaluator early-terminate - #3

Merged
TexasCoding merged 2 commits into
mainfrom
release/v0.5.0
Jul 10, 2026
Merged

TexasCoding merged 2 commits into
mainfrom
release/v0.5.0

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Summary

The largest release since the engine's inception: an opt-in second placement engine built on exact no-fit-polygon geometry in scaled integer arithmetic (strategy="nfp"), plus two improvements to the sampling engine. Every determinism guarantee holds — 16 cross-platform golden cases (7 new) prove byte-identity on all three shipped platforms.

Exact-NFP construction mode (feature #4, docs/03) — opt-in, default-off

  • Integer geometry substrate (crates/optimizer/src/nfp/): 2^20 fixed grid, i64 coords + i128 predicates, orientation-normalized convolution union-fill, convex edge-merge fast path, quads-only face-classified frame IFP (correct for concave containers), □E contact backoff, eager mirror-derived pair cache, hard input-domain gate.
  • Placer: exact candidate walk over region vertices (exact for the linear LBF loss), CDE-verified, sampling fallback per part; separation tail unchanged.
  • Public API: PlacementStrategy / NestConfig / NestError + nest_with_config + nest_multi_with_config; wheel gains strategy="sampling"|"nfp" on both pyfunctions.
  • Acceptance (consumer 13-shape corpus, paired seeds, K=16): NFP 83.88% vs sampling 83.27% mean (+0.61pp, floor held on every seed, 1.02× wall-clock; 84.03% all-time best) → SHIP OPT-IN per docs/03 §10.
  • New dep: i_overlay = 7.0.2 exact-pinned (MIT/Apache-2.0, pure Rust, source-audited). MSRV 1.87 → 1.88.

Sampling engine (docs/02 §11.2)

  • Multi-start order diversification (contiguous block split; doubling K floor guarantee): consumer corpus 82.76% → 83.44% at restarts=16. ⚠️ restarts>1 layouts change vs v0.4.x (deterministically); restarts=1 byte-identical.
  • Deterministic early-terminate in the separation evaluator: ~13–15% faster, provably output-identical.
  • Import hoist: K multi-start runs share one import.

Test plan

  • 88 tests / 14 suites (workspace release) + 76 (parallel feature) + debug legs — green locally
  • clippy -D warnings clean on the full workspace (both feature configurations); fmt clean
  • All pre-existing goldens byte-identical; 7 new golden cases blessed on macOS-arm64
  • CI 3-platform matrix — the first cross-platform execution of the NFP goldens (the byte-identity proof for the integer pipeline)

🤖 Generated with Claude Code

TexasCoding and others added 2 commits July 10, 2026 10:51
…i-start order diversification + evaluator early-terminate

Optimizer round 3 (docs/02 §11.2):
- Deterministic early-terminate in the separation evaluator (strict-greater
  bailout on canonically-ordered partial sums) — ~13-15% faster separation,
  provably output-identical (goldens byte-frozen).
- Multi-start order diversification: contiguous block split (leading half
  canonical largest-first, trailing half seeded-jittered insertion order).
  Doubling n_starts keeps every canonical stream the smaller run explored, so
  the old best-of-K is a floor for the new best-of-2K. +1.0pp mean on
  diameter-misleading mixes; consumer corpus 82.76% -> 83.44% at restarts=16.
- Compression phase (sparrow compress loop) implemented, measured (zero gain,
  2-3.5x cost), reverted with mechanism analysis: fixed-bin insertion-driven
  separation subsumes untargeted wall squeezes.
- N1a import hoist: items/container imported once per call (Problem), shared
  read-only across the K multi-start threads.

Feature #4 — exact-NFP construction mode (docs/03), opt-in, default-off:
- Integer geometry substrate (crates/optimizer/src/nfp/): 2^20 fixed grid,
  i64 coords + i128 predicates, orientation-normalized convolution union-fill
  (winding-cancellation fix), convex edge-merge fast path, quads-only
  face-classified frame IFP (correct for concave containers), □E=16 contact
  backoff, Booth-canonicalized shapes, eager mirror-derived pair cache with
  domain gate. i_overlay = 7.0.2 exact-pinned (integer i64 API only;
  MIT/Apache-2.0; source-audited for determinism hazards). MSRV 1.87 -> 1.88.
- Placer: exact (cost, rot_idx, x, y) candidate walk over IFP-minus-NFPs
  region vertices (exact for the linear LBF loss), CDE-verified, placed
  directly (no slide); per-part sampling fallback; separation tail unchanged.
- Public API: PlacementStrategy / NestConfig / NestError + nest_with_config +
  nest_multi_with_config (Sampling configs are test-locked frozen wrappers of
  the existing entry points). PartsGeometry shared across sheets in multi.
- Wheel: strategy="sampling"|"nfp" kwarg on nest() and nest_multi().
- 7 new golden cases incl. nfp-contact-columns (100% util contact grid — the
  exact-fit artifact killed by construction), nfp-concave-pocket (part nested
  inside a C-part pocket), and jittered-winner multistart cases pinning both
  diversification paths cross-platform.
- Acceptance (consumer 13-shape corpus, paired seeds, K=16): NFP 83.88% vs
  sampling 83.27% mean (+0.61pp, floor held on every seed, 1.02x wall-clock;
  84.03% = all-time best on this corpus) -> SHIP OPT-IN per docs/03 §10.

88 tests / 14 suites green (release + parallel + debug legs); clippy
-D warnings clean on both feature sets; all pre-existing goldens
byte-identical (sampling behavior frozen for n_starts=1; n_starts>1 layouts
changed vs v0.4.x per the order-diversification note in nest_multistart docs).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Clears the supply-chain gate: the advisory flags unsoundness in
Error::downcast_mut on 1.0.102 (a jagua-fork import-path dependency; not on
any placement path — goldens unaffected, lock-only change).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TexasCoding
TexasCoding merged commit a3d812f into main Jul 10, 2026
5 checks passed
@TexasCoding
TexasCoding deleted the release/v0.5.0 branch July 10, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant