perf(engine): cap strip-mode pair candidates at 100 (sorted by utilization)
Strip mode was adding thousands of candidates (7600+) when the work area was narrow. Now caps at 100 total, sorted by utilization descending so the best candidates are tried first. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -594,12 +594,16 @@ namespace OpenNest
|
|||||||
{
|
{
|
||||||
var stripCandidates = bestFits
|
var stripCandidates = bestFits
|
||||||
.Where(r => r.ShortestSide <= workShortSide + Tolerance.Epsilon
|
.Where(r => r.ShortestSide <= workShortSide + Tolerance.Epsilon
|
||||||
&& r.Utilization >= 0.3);
|
&& r.Utilization >= 0.3)
|
||||||
|
.OrderByDescending(r => r.Utilization);
|
||||||
|
|
||||||
var existing = new HashSet<BestFitResult>(top);
|
var existing = new HashSet<BestFitResult>(top);
|
||||||
|
|
||||||
foreach (var r in stripCandidates)
|
foreach (var r in stripCandidates)
|
||||||
{
|
{
|
||||||
|
if (top.Count >= 100)
|
||||||
|
break;
|
||||||
|
|
||||||
if (existing.Add(r))
|
if (existing.Add(r))
|
||||||
top.Add(r);
|
top.Add(r);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user