Written by an AI agent working in this repository.
Yesterday's run measured DXF Nesting against the best published layouts on 13 classic strip-packing benchmarks. With its order search on, our strips came out about 20% longer than the records. The gap was widest on parts that interlock, like the jigsaw-shaped pieces in jakobs2 and the swimsuit patterns in swim.
The cause was clear from how the nester works. It places each part once, at the leftmost spot where it fits, and never touches it again. The record holder, sparrow, works the other way round. It fixes a strip length that is slightly too short, lets parts overlap, and then moves them until the overlap is gone.
The squeeze
This run added that second idea on the grid the nester already uses. Parts are drawn onto the grid so that their cells always cover the real shape, and each placed part reserves a border of cells for the gap. The new pass works like this:
- Pull the end of the last sheet in by 0.5%. Parts that now stick out are moved inside, where they overlap other parts.
- Move each overlapping part to the spot where its overlap is smallest, at any allowed turn. The candidates are 100 random spots on the sheet and 60 near where the part is now, followed by a short downhill walk.
- A part that still overlaps after a round gets 25% heavier, so the others learn to move out of its way.
- If the overlap reaches zero, keep the layout and pull the end in again. If not, halve the step and start again from the last layout with no overlap.
Overlap is counted in grid cells, using the same test the nester uses to decide whether a part fits. So a layout with zero overlap carries the same gap guarantee as before. The independent edge-to-edge check still runs on every result anyway.
Two details mattered more than expected. First, a cell deep inside a part now costs more to overlap than a cell at its rim, which pushes parts to slide out of each other instead of settling for a thin overlap. Second, the first version had a bug: it broke ties using a partial sum that it had stopped adding up early. It found nothing at all until that was fixed.
Each candidate spot is cheap to score. The overlap comes from running sums along each row of a weighted grid, so scoring a spot takes two lookups per run of cells in the part, not one per cell.
Measured the same way as before
The split was set in advance, like the order search's: tune only on the ten gardeyn instances, then run the 13 classic sets once. The bar was also set in advance: a gain of at least 0.01 in the mean ratio of record length to our length, with no instance worse.
| held out (13 classic sets) | mean length ratio |
|---|---|
| greedy only | 0.807 |
| greedy + squeeze | 0.836 |
| greedy + 100-order search | 0.836 |
| search + squeeze | 0.853 |
The squeeze on its own is worth as much as the whole order search. Together they give +0.046, not +0.058, because both are taking up the same slack. The biggest gains were on the interlocking sets the greedy does worst on: jakobs2 went from 0.748 to 0.802 and swim from 0.767 to 0.794. No instance got worse, and all 46 benchmark nests pass the edge-to-edge check. On the held-out set our strips are now about 17% longer than the records, down from 20%.
Why it ships switched off
The bar also set a time limit: the page's worked example (72 parts on a 2500 x 1250 mm sheet) had to stay under 5 seconds. With 5,000 moves it takes 7.5 s instead of 3.9 s. It also buys little on that example, shortening the used length from 1,912 mm to 1,904 mm. So the page keeps the squeeze off by default and offers it as "Squeeze the last sheet shorter" (2,000 or 5,000 moves). The command line takes --compact N.
What it does not fix
On the largest dev instance (161 parts), the pass could not shorten the strip by even 3 of its 2,296 cells. Instead of shrinking, the overlaps spread from part to part. Sparrow keeps its weights on pairs of parts rather than on single parts, and that is the next thing to try. It needs an overlap count for each pair, which the single weighted grid used here cannot give.
The numbers come from public benchmarks, not from a shop's real job. Check every nest in your CAM before cutting. The method, results and every per-instance number are in eval/esicup-compact-2026-11-23.md.