ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
FedergruenTzurNondecreasingSetupSolver.cs
Go to the documentation of this file.
5
7
8/// <summary>
9/// Implements Federgruen-Tzur's linear-time forward algorithm for
10/// nondecreasing setup costs.
11/// </summary>
12/// <remarks>
13/// <para>
14/// The required condition is
15/// <c>f[t] &lt;= f[t+1]</c> for every adjacent pair of periods. Variable
16/// production and holding costs remain general within the non-negative
17/// <see cref="UlsProblem"/> contract; speculative inventory motives are allowed.
18/// </para>
19/// <para>
20/// Federgruen and Tzur prove that a new period either does not enter the
21/// Minimal Optimal Predecessor set or is inserted directly at its end. All
22/// insertions and deletions therefore occur at the list ends and cost constant
23/// amortized time. The complete algorithm is <c>O(n)</c> time and
24/// <c>O(n)</c> space.
25/// </para>
26/// <para>
27/// Reference:
28/// A. Federgruen and M. Tzur,
29/// "A Simple Forward Algorithm to Solve General Dynamic Lot Sizing Models with
30/// n Periods in O(n log n) or O(n) Time",
31/// Management Science 37(8), 909-925, 1991, Section 3.
32/// DOI: 10.1287/mnsc.37.8.909.
33/// </para>
34/// </remarks>
36{
37 /// <inheritdoc />
38 public string Name =>
39 "Federgruen-Tzur nondecreasing-setup O(n)";
40
41 /// <inheritdoc />
43
44 /// <summary>
45 /// Determines whether setup costs are nondecreasing.
46 /// </summary>
47 public static bool IsApplicable(UlsProblem problem)
48 {
49 ArgumentNullException.ThrowIfNull(problem);
50
51 var setupCosts = problem.SetupCosts;
52
53 for (var period = 0; period < problem.Horizon - 1; period++)
54 {
55 if (setupCosts[period] > setupCosts[period + 1])
56 {
57 return false;
58 }
59 }
60
61 return true;
62 }
63
64 /// <inheritdoc />
65 /// <exception cref="NotSupportedException">
66 /// Thrown when setup costs are not nondecreasing.
67 /// </exception>
69 UlsProblem problem,
70 CancellationToken cancellationToken = default)
71 {
72 ArgumentNullException.ThrowIfNull(problem);
73 cancellationToken.ThrowIfCancellationRequested();
74
75 if (!IsApplicable(problem))
76 {
77 throw new NotSupportedException(
78 "FedergruenTzurNondecreasingSetupSolver requires " +
79 "nondecreasing setup costs.");
80 }
81
83 problem,
84 Name,
85 cancellationToken);
86 }
87}
Implements Federgruen-Tzur's linear-time forward algorithm for nondecreasing setup costs.
static bool IsApplicable(UlsProblem problem)
Determines whether setup costs are nondecreasing.
UlsSolveResult Solve(UlsProblem problem, CancellationToken cancellationToken=default)
Shared allocation-conscious forward recurrence for the two Federgruen-Tzur linear-time specialization...
static UlsSolveResult SolveNondecreasingSetupCosts(UlsProblem problem, string solverName, CancellationToken cancellationToken)
Represents a validated classical uncapacitated lot-sizing problem.
Definition UlsProblem.cs:23
ReadOnlySpan< double > SetupCosts
Gets fixed setup costs by period.
Definition UlsProblem.cs:97
Represents the outcome returned by a ULS solution strategy.
Defines the common strategy contract implemented by every ULS solver.
Definition IUlsSolver.cs:14
UlsSolverKind
Identifies the broad family of a ULS solution strategy.