35 public string Name =>
"Part-Period Simplified";
44 CancellationToken cancellationToken =
default)
46 ArgumentNullException.ThrowIfNull(problem);
47 cancellationToken.ThrowIfCancellationRequested();
51 var buffer = ArrayPool<int>.Shared.Rent(horizon);
55 var cycleEnds = buffer.AsSpan(0, horizon);
66 ? double.PositiveInfinity
74 while (start < horizon)
76 cancellationToken.ThrowIfCancellationRequested();
78 if (
double.IsPositiveInfinity(epp))
80 cycleEnds[start] = horizon - 1;
85 var partPeriods = 0.0;
87 for (var end = start + 1; end < horizon; end++)
89 var candidatePartPeriods =
94 if (!
double.IsFinite(candidatePartPeriods))
96 throw new ArithmeticException(
97 "Numerical overflow while accumulating part-periods.");
100 if (candidatePartPeriods > epp)
105 partPeriods = candidatePartPeriods;
109 cycleEnds[start] = bestEnd;
125 ArrayPool<int>.Shared.Return(
Shared applicability checks for classical stationary-cost lot-sizing heuristics.
static void ThrowIfNotStationary(UlsProblem problem, string solverName)
static bool HasStationaryRelevantCosts(UlsProblem problem)
static int FindNextPositiveDemand(ReadOnlySpan< double > demands, int start)
Builds and validates a zero-backlogging heuristic solution from a set of replenishment cycles.
static UlsSolveResult Build(UlsProblem problem, ReadOnlySpan< int > cycleEnds, string solverName, CancellationToken cancellationToken)
Implements the Part-Period Simplified (PPS) rule, also described as the Least Total Cost (LTC) no-ove...
UlsSolverKind Kind
Gets the broad family of the solver.
static bool IsApplicable(UlsProblem problem)
UlsSolveResult Solve(UlsProblem problem, CancellationToken cancellationToken=default)
Solves an uncapacitated lot-sizing problem.
string Name
Gets the stable human-readable name of the solver.
Represents a validated classical uncapacitated lot-sizing problem.
int Horizon
Gets the number of planning periods.
ReadOnlySpan< double > HoldingCosts
Gets end-of-period unit holding costs by period.
ReadOnlySpan< double > Demands
Gets demand by period.
ReadOnlySpan< double > SetupCosts
Gets fixed setup costs by period.
Represents the outcome returned by a ULS solution strategy.
Defines the common strategy contract implemented by every ULS solver.
UlsSolverKind
Identifies the broad family of a ULS solution strategy.