mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-29 17:01:06 -04:00
Every whole-job engine chooses among the offered stock sizes, and on the synthetic benchmark nests Default matched or beat StockLadder on all 18 runs (saved sizes, a six-size pool, with and without salvage credit), costing 30-40% less in total with mixed sizes. Its sheet-swap step never produced a win over Irregular's tail re-plan. The registry maps "StockLadder" to Default so saved selections, scripts and API requests keep working. OrderedPlateNester stays: Fill and the remnant strategies use it for restricted rotations, and its golden layout is now pinned through NestJobRunner with the parts requested largest first, as StockLadder requested them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.6 KiB
C#
40 lines
1.6 KiB
C#
using System;
|
|
|
|
namespace OpenNest.Engine.Jobs;
|
|
|
|
/// <summary>Immutable per-job options; selection never changes the legacy global registry.</summary>
|
|
public sealed class NestJobOptions
|
|
{
|
|
public NestJobOptions(
|
|
string placementStrategy = "Fill",
|
|
int? maxPlates = null,
|
|
double salvageRate = 0,
|
|
double minimumSalvageDimension = 0
|
|
)
|
|
{
|
|
ArgumentException.ThrowIfNullOrWhiteSpace(placementStrategy);
|
|
if (maxPlates <= 0)
|
|
throw new ArgumentOutOfRangeException(nameof(maxPlates));
|
|
if (!double.IsFinite(salvageRate) || salvageRate < 0 || salvageRate > 1)
|
|
throw new ArgumentOutOfRangeException(nameof(salvageRate));
|
|
if (!double.IsFinite(minimumSalvageDimension) || minimumSalvageDimension < 0)
|
|
throw new ArgumentOutOfRangeException(nameof(minimumSalvageDimension));
|
|
PlacementStrategy = placementStrategy;
|
|
MaxPlates = maxPlates;
|
|
SalvageRate = salvageRate;
|
|
MinimumSalvageDimension = minimumSalvageDimension;
|
|
}
|
|
|
|
/// <summary>Fraction of eligible edge-offcut area credited by <see cref="NestJobCost.NetSheetCost"/> (0..1).</summary>
|
|
public double SalvageRate { get; }
|
|
|
|
/// <summary>Both offcut dimensions must meet this caller-supplied minimum in job units.
|
|
/// Zero disables credit; scraps and holes are never credited.</summary>
|
|
public double MinimumSalvageDimension { get; }
|
|
|
|
public string PlacementStrategy { get; }
|
|
|
|
/// <summary>Maximum physical sheets to commit, or null for no explicit cap.</summary>
|
|
public int? MaxPlates { get; }
|
|
}
|