refactor(fill): extract constants and EvaluateCandidate in PairFiller

Extract magic numbers into named constants (MaxTopCandidates,
EarlyExitMinTried, etc.), extract candidate evaluation into
EvaluateCandidate method, and expose BestFits property so
PairsFillStrategy can reuse without redundant BestFitCache call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 22:48:12 -04:00
parent a9a9dc8a0a
commit 0472c12113
2 changed files with 33 additions and 26 deletions

View File

@@ -1,4 +1,3 @@
using OpenNest.Engine.BestFit;
using OpenNest.Engine.Fill;
using System.Collections.Generic;
@@ -16,11 +15,7 @@ namespace OpenNest.Engine.Strategies
var result = filler.Fill(context.Item, context.WorkArea,
context.PlateNumber, context.Token, context.Progress);
// Cache hit — PairFiller already called GetOrCompute internally.
var bestFits = BestFitCache.GetOrCompute(
context.Item.Drawing, context.Plate.Size.Length,
context.Plate.Size.Width, context.Plate.PartSpacing);
context.SharedState["BestFits"] = bestFits;
context.SharedState["BestFits"] = filler.BestFits;
return result;
}