PairFiller previously only filled the main grid with pair patterns, leaving narrow waste strips unfilled. Row/Column strategies filled their remnants, winning on count despite worse base grids. Now PairFiller evaluates grid+remnant together for each angle/direction combination, picking the best total. Uses a two-phase approach: fast grid evaluation first, then remnant filling only for grids within striking distance of the current best. Remnant results are cached via FillResultCache. Constructor now takes Plate (needed to create remnant engine). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
25 lines
720 B
C#
25 lines
720 B
C#
using OpenNest.Engine.Fill;
|
|
using System.Collections.Generic;
|
|
|
|
namespace OpenNest.Engine.Strategies
|
|
{
|
|
public class PairsFillStrategy : IFillStrategy
|
|
{
|
|
public string Name => "Pairs";
|
|
public NestPhase Phase => NestPhase.Pairs;
|
|
public int Order => 100;
|
|
|
|
public List<Part> Fill(FillContext context)
|
|
{
|
|
var comparer = context.Policy?.Comparer;
|
|
var filler = new PairFiller(context.Plate, comparer);
|
|
var result = filler.Fill(context.Item, context.WorkArea,
|
|
context.PlateNumber, context.Token, context.Progress);
|
|
|
|
context.SharedState["BestFits"] = result.BestFits;
|
|
|
|
return result.Parts;
|
|
}
|
|
}
|
|
}
|