Files
OpenNest-Engines/OpenNest.Engine.Qwen38FlashNext/Qwen38FlashNextNestingEngine.cs
T
ajandClaude Opus 5.5 90f07603e2 feat(qwen38flashnext): add the finished engine
Qwen3.8-Flash-Next's final version after a 14.5-hour optimization run
(its commit 7d7fca3): cost-first sheet trials, largest-area-first
demand order, and a cached-triangulation exact gate that brought a
219-part production job from timeout to ~106 s. 13/13 tests pass
against OpenNest master.

README cleaned for publishing: the model-facing template rules are
replaced by a one-line independence statement, the production job is
described generically instead of by its PEP job/file name (also in a
JobSolver comment), results show both sheet pools as re-measured here
(the 9-size claim in its report didn't reproduce: it grabs 96x240 and
under-fills them), and the stale StockLadder-crash note is gone now
that core leaves etch marks out of nesting.

Also drops a stale Aurora plugin reference from Opus55's README and
lists the engine in the repo README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 06:57:11 -04:00

49 lines
2.2 KiB
C#

using System;
using System.Threading;
using OpenNest.Engine.Jobs;
using OpenNest.Engine.Qwen38FlashNext.Engine;
namespace OpenNest.Engine.Qwen38FlashNext;
/// <summary>
/// Independent whole-job nesting engine: bottom-left-first placement over convex
/// No-Fit-Polygons with an exact material-clearance gate, driven sheet by sheet by a
/// greedy demand scheduler.
/// <para>
/// Per sheet, parts are demanded in the engine's own order (priority, then the
/// largest material area, then id) and each requirement is drained greedily. For a part instance the engine enumerates its
/// legal orientations (policy angles, or 0/90/180/270 plus the rotating-calipers
/// minimum bounding rectangle for automatic rotation), builds for every placed part a
/// convex NFP as placedHull (+) disk(spacing) (+) reflect(candidateHull) via its own
/// Minkowski edge-merge, generates the corner-point feasible-region candidates (anchor
/// box corners, NFP vertices, NFP-edge/box-line slides), and places the instance at the
/// lowest-leftmost candidate whose exact material clearance the engine's collision gate
/// accepts (cached-triangulation clip with a sound fast-shell prefilter). Which stock
/// the next sheet uses is chosen by re-packing each available size and committing the
/// trial that delivers the cheapest plate area per unit of part area placed; the
/// job stops when demand is met, stock runs out, nothing further can be placed, or the
/// plate cap is hit. See Engine/ for the placement core and README.md for the design
/// write-up.
/// </para>
/// <para>
/// The engine is self-contained: it calls no built-in <see cref="INestingEngine"/>,
/// nester, filler, or runner, and is deterministic - identical input, identical layout.
/// </para>
/// </summary>
public sealed class Qwen38FlashNextNestingEngine : INestingEngine
{
public NestJobResult Solve(
NestJob job,
IProgress<NestJobProgress>? progress = null,
CancellationToken token = default
)
{
ArgumentNullException.ThrowIfNull(job);
token.ThrowIfCancellationRequested();
var preparation = new PartPreparation(job.Parts);
var solver = new JobSolver(job, preparation);
return solver.Solve(progress, token);
}
}