Irregular overran DeadlineNestingEngine's 30 s limit by up to 50x in the
ML flag-sweep pilot (1,537 s on a 450-per-sheet part). Stack samples put
every second of the overrun in BlockCatalog.Rectangles: after a sheet fill
places a Lattice block of hundreds of detailed parts, the next block
preparation builds the free region one Clipper difference per part and
then sorts out every maximal rectangle with a quadratic dominance pass,
and neither checked the token. It shows only once best fits are cached
(a warm app, worker or sweep process), which is when the fill gets there
within the limit.
MaximalRectangles.InRegion now takes a token and a `largest` count: it
stops dominance checks past that rank, keeping every result tied in area
with the last, so its results are exactly the full search's down to that
area and Rectangles' top two are unchanged. The free region checks the
token per part. Layouts do not change; the reproducing job's whole solve
now takes 34 s instead of over 1,000.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FrontierPacker.Fill was one 165-line method: three local functions
(Track, Block, PrepareBlocks) closed over nine variables of the fill in
progress, the seated-parts pass repeated Block's parallel loop inline,
and the placement loop carried its retirement rules between them.
Choose kept its leader in seven loose variables behind a local function,
and BestVertex took twelve parameters, four of them outs that every
TryLowest threaded back out. Every pass of the engine goes through this
class, so the next change to the placement rule had to be made inside
all of that.
Fill now reads as its steps: TrackDemand, Seat, PrepareBlocks, then
Choose and Place until nothing fits. The fill in progress is a Sheet
(copies left, regions, pairs, blocks, parts placed, front) passed to
each step, the leader of a choice is a Leader that Consider updates, and
a candidate's point and scores travel as one Spot, with the inner-fit
box and the piece's box as Extents. The repeated expressions have one
definition each: the part's reach along the front axis, a region losing
what a part blocks, the parallel blocking pass, the two retirements of
emptied regions and pairs, and the "lower across, then lower leading
edge" tie-break shared by Choose and BestVertex. The tolerances and the
block limits (two preparations per fill, four types, three copies) are
named constants. PackAxis, Placed and SheetFill, which the whole engine
uses, have their own files.
The constructor keeps its shape: most call sites name its optional
arguments already. The two that passed positional nulls now name them.
No layout changes, and no change to the order work is metered or to the
parallel passes: a placement still blocks one pass per part. Traced
before and after: every progress report, plan, alternative, repeat
batch, tail re-plan (with its work-meter reading) and final result of
70 solves (one to three stocks, mixed spacings, finite stock, a sheet
cap, priorities, explicit costs with salvage and both offcut axes, clamp
rails, outlined sheets, oversize parts, all four quadrants, grouped and
banded jobs, four engine settings, seven searches until cancelled), the
poses and work-meter reading of 2,298 direct Fill calls (pairs, blocks,
type weights, group ranks, reach, within, seated parts, a starting
front, clamps, outline and cutout boundaries with obstacles, pair-only
orientations), and six cutout proposals. The traces are byte-identical.
Engine suite and the problem-nest corpus's auto-nest area pass.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Lattice band certification prepares each member's outline once instead of
re-inflating both parts for every pair (about 40% of each pattern's cost).
- Strip packing builds each beam level's band searches ahead in parallel,
each on its own drawing copy; prefetched patterns charge no work and bind
no orientations until requested in strip order, so the work meter and
results match building them in turn.
- FrontierPacker blocks seated parts in one parallel pass, not one per part.
Layouts and work counts are unchanged on the README, clamp-rail, 2x and
tutorial jobs and the synthetic nests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Irregular decodes the job once more in full-height strips along X when
like parts group and every part shares one priority. A sheet that can
take all the remaining parts is packed two ways and the better kept:
- Bands: each type of three or more copies as its Lattice pattern in the
narrowest strip that holds all its copies, bands side by side, the
held-back copies and one-offs filling the gaps.
- Strips: each strip holds the largest remaining part, as its band or a
column one to three copies wide, every other part filling its gaps; a
beam of the four densest partial sheets carries strip to strip.
Band patterns are filled one grid unit wider than the spacing so a stack
of rings passes the strict certification, members on a clamp go to the
gap fill, and a short band moves flush to the far edge when that keeps
it off the clamps. The plan replaces the result only by beating it.
On seven sample parts (130 copies, 60 x 120) the layout ends at 102.9"
instead of 107.7", and at 104.6" instead of 108.6" with the desktop's
edge spacing and bottom clamp rail; at about twice the quantities the
second sheet ends at 104.7" instead of 106.2". Every other benchmark job
is unchanged. Solves of these jobs take about twice as long.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Priority worked like a rank (lower first) with a default of 0, and the
Edit Drawing form stopped at 0, so moving one part ahead of the rest
meant renumbering every other drawing. Higher-first lets a user raise a
single part to 1 and leave everything else at the default.
Every engine, filler and candidate comparer now serves the highest tier
first. Stored values keep their order:
- .nest files add `nestPriority` and keep writing the negated value under
`priority`, so older readers nest in the same order; files without
`nestPriority` are negated on read. Drawing packages strip both, so
package hashes are unchanged.
- Library settings send both keys the same way for older clients.
- Server schema v18 negates stored drawing priorities (an older server
refuses the upgraded database).
- Job documents move to version 2; version 1 jobs are converted, and an
older worker refuses version 2 instead of reversing the order.
The Edit Drawing form now accepts negative priorities and says higher
numbers nest first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After its six variants and tail re-plan, Irregular decodes the job again
with each type of three or more copies packed as one group, in a searched
order, holding back up to four copies per group that would start a ragged
row and filling them into the gaps afterward. When everything fits, the
best candidates are re-packed in a strip ending just short of the front.
The pass runs after the ungrouped search, which is unchanged, and replaces
its result only by beating it. The help tutorial's parts now end at 34.9"
instead of 38.1" on 60 x 120.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Compare cutout proposals, frame angles and bundles by insert outline area,
and add bounded largest-first packer candidates so big parts get the first
move in an empty hole. On the real job the four frames go from 54-70% to
77-81% filled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Under a time limit, Irregular often finished in about a second and left
the rest unused: on the converted Nestbolt b-jakobs1 job it used five
sheets where four fit.
NestJobOptions.SearchUntilCancelled asks an engine to keep searching
after its normal search until the token is cancelled.
DeadlineNestingEngine sets it. Irregular then re-runs its six variants
with seeded per-type weights on its placement rule (seeds 1, 2, 3, ...,
each weight within e^+-0.4), reports each plan that beats its best,
then re-plans that plan's tail and reports any gain. It skips this when
the token cannot be cancelled, nobody listens for progress, nothing is
placeable, or the job has one part type, so unlimited solves are
unchanged.
Default now runs Irregular last (Rectangles, Circles, Irregular) so
Circles still runs, and chooses only after every candidate has run, in
tie-break order, so the run order never changes the choice. Unlimited
choices match the old run order {Rectangles, Irregular, Circles} except
when three candidates are near-tied within the 1e-9 comparison
tolerance without being transitively ordered (only on all-round jobs,
where Circles bids).
b-jakobs1 on one CPU, 10 s limit: 5 sheets (4.500) -> 4 (3.751).
Add PackBoundary: a closed outline with obstacles, bound to one
NoFitCache, whose per-orientation inner-fit polygon (the clearance
footprint inside the outline eroded by the other half clearance) is
computed once and shared. FrontierPacker takes an optional boundary and
seeds each region from that inner fit, drops orientations with no fit
and subtracts obstacle no-fit polygons like clamp ones; without a
boundary it is unchanged, so rectangular stock layouts are identical.
CutoutLatticeFill.InnerFit now calls the shared kernel with the same
Clipper operations, so lattice results are unchanged. The engine's
strategy variants are internal so a cutout proposal can reuse them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The frontier packer reports its placements after each choice; the engine
turns them into preview parts at most four times a second and sends them as
NestProgress.BestParts with the stock work area, which desktop Auto Nest
already draws on the plate view. Reporting only reads finished placements,
so layouts are unchanged with or without a progress sink.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the two production plug-in engines into OpenNest.Engine under names
that describe the jobs they suit:
- Rectangles: plain and near-rectangular plates, maximal-rectangles box
packing (was the RectanglesNestingEngine plug-in)
- Irregular: irregular profiles, no-fit-polygon frontier packing (was the
Opus55NestingEngine plug-in)
Their tests and the shared engine contract/layout test kit move into
OpenNest.Engine.Tests/NestingEngines.
The registry maps the old plug-in names to the new engines, so saved desktop
selections, scripts and API requests keep working, and a leftover plug-in DLL
under an old name cannot shadow its replacement. Desktop startup passes the
registry's lookup when restoring the saved Auto Nest engine.