Files
OpenNest/OpenNest.Engine/NestingEngines
ajandClaude Fable 5.2 9aed8dcda1 refactor(engine): split Irregular's engine into passes, solver and plan
IrregularNestingEngine.cs was one 1,000-line file: Solve ran its nine
passes inline over 135 lines, each repeating the same "decode, report
the alternatives, take the plan if it beats the best, re-plan its tail,
report again" by hand; the nested Solver took eleven constructor
arguments and held the decode, the banded sheet, three plan-improvement
passes and the per-stock caches together; and Decode was a single
135-line loop threading ten parameters. The next pass or decode rule had
to be added inside all of that.

Solve now reads as the list of passes. A Search holds the best plan and
the reporting, so each pass is a short method (QuickPlan,
StrategyVariants, GroupedVariants, BandedVariant, ReduceSheets,
SqueezeLastSheet, SeededVariants) over three shared steps (Offer, Adopt,
Replace). The Solver takes the engine instead of its settings one by
one, and is split in two files: decoding a strategy into a plan
(TrySheets, FillSheet, Choose, PassedOver, Copies) and improving a plan
already made (ImproveTail/ReplanTail, ReduceSheets/OnOneSheetFewer/
PackEdgeFirst, Squeeze). A decode's front direction, exponent, weights
and sheet rule travel as one Strategy rather than five arguments, with
the grouped/banded flag pair as a SheetRule. Plan, Run, Trial and the
sheet costing have their own file, as does WorkCounter.

The test hooks build their solver as Solve does, so they now also pass
on TailReplanning and PruneStockTrials; no test sets either on a hook.

No layout changes. Every progress report, plan, alternative, repeat
batch, tail re-plan (with its work-meter reading) and final result was
traced before and after on 96 solves: 26 jobs (one to three stocks,
finite stock, a sheet cap, priorities, explicit costs with salvage,
clamp rail, outlined sheets, oversize parts, mixed spacings), six engine
settings, ten searches until cancelled and the plan and quick-plan
hooks. 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>
2026-11-20 11:16:19 -05:00
..