feat(training): enable forced full angle sweep and store per-angle results
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,9 +25,10 @@ namespace OpenNest.Engine.ML
|
|||||||
|
|
||||||
public static class BruteForceRunner
|
public static class BruteForceRunner
|
||||||
{
|
{
|
||||||
public static BruteForceResult Run(Drawing drawing, Plate plate)
|
public static BruteForceResult Run(Drawing drawing, Plate plate, bool forceFullAngleSweep = false)
|
||||||
{
|
{
|
||||||
var engine = new NestEngine(plate);
|
var engine = new NestEngine(plate);
|
||||||
|
engine.ForceFullAngleSweep = forceFullAngleSweep;
|
||||||
var item = new NestItem { Drawing = drawing };
|
var item = new NestItem { Drawing = drawing };
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ int RunDataCollection(string dir, string dbPath, string saveDir, double s, strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
var sizeSw = Stopwatch.StartNew();
|
var sizeSw = Stopwatch.StartNew();
|
||||||
var result = BruteForceRunner.Run(drawing, runPlate);
|
var result = BruteForceRunner.Run(drawing, runPlate, forceFullAngleSweep: true);
|
||||||
sizeSw.Stop();
|
sizeSw.Stop();
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
@@ -215,7 +215,12 @@ int RunDataCollection(string dir, string dbPath, string saveDir, double s, strin
|
|||||||
bestCount = result.PartCount;
|
bestCount = result.PartCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($" {size.Length}x{size.Width} - {result.PartCount}pcs, {result.Utilization:P1}, {sizeSw.ElapsedMilliseconds}ms");
|
var engineInfo = $"{result.WinnerEngine}({result.WinnerTimeMs}ms)";
|
||||||
|
if (!string.IsNullOrEmpty(result.RunnerUpEngine))
|
||||||
|
engineInfo += $", 2nd={result.RunnerUpEngine}({result.RunnerUpPartCount}pcs/{result.RunnerUpTimeMs}ms)";
|
||||||
|
if (!string.IsNullOrEmpty(result.ThirdPlaceEngine))
|
||||||
|
engineInfo += $", 3rd={result.ThirdPlaceEngine}({result.ThirdPlacePartCount}pcs/{result.ThirdPlaceTimeMs}ms)";
|
||||||
|
Console.WriteLine($" {size.Length}x{size.Width} - {result.PartCount}pcs, {result.Utilization:P1}, {sizeSw.ElapsedMilliseconds}ms [{engineInfo}] angles={result.AngleResults.Count}");
|
||||||
|
|
||||||
string savedFilePath = null;
|
string savedFilePath = null;
|
||||||
if (saveDir != null)
|
if (saveDir != null)
|
||||||
@@ -258,7 +263,7 @@ int RunDataCollection(string dir, string dbPath, string saveDir, double s, strin
|
|||||||
writer.Write(savedFilePath);
|
writer.Write(savedFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.AddRun(partId, size.Width, size.Length, s, result, savedFilePath);
|
db.AddRun(partId, size.Width, size.Length, s, result, savedFilePath, result.AngleResults);
|
||||||
runsThisPart++;
|
runsThisPart++;
|
||||||
totalRuns++;
|
totalRuns++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user