ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
FedergruenTzurNoSpeculativeMotiveSolver.cs
Go to the documentation of this file.
5
7
8/// <summary>
9/// Implements Federgruen-Tzur's linear-time forward algorithm for models
10/// without speculative inventory motives.
11/// </summary>
12/// <remarks>
13/// <para>
14/// Applicability is equivalent to the transformed variable-cost sequence
15/// <c>C(t)=p[t]-H(t-1)</c> being nonincreasing. In the original cost notation,
16/// this is the adjacent condition
17/// <c>p[t] + h[t] &gt;= p[t+1]</c>.
18/// </para>
19/// <para>
20/// Under this condition Federgruen and Tzur show that each new period is
21/// inserted at the end of the Minimal Optimal Predecessor list. Candidates are
22/// deleted only from the front or back, so an ordinary array/list structure
23/// gives <c>O(n)</c> time and <c>O(n)</c> space.
24/// </para>
25/// <para>
26/// Reference:
27/// A. Federgruen and M. Tzur,
28/// "A Simple Forward Algorithm to Solve General Dynamic Lot Sizing Models with
29/// n Periods in O(n log n) or O(n) Time",
30/// Management Science 37(8), 909-925, 1991, Section 4.
31/// DOI: 10.1287/mnsc.37.8.909.
32/// </para>
33/// </remarks>
35{
36 /// <inheritdoc />
37 public string Name =>
38 "Federgruen-Tzur no-speculative-motive O(n)";
39
40 /// <inheritdoc />
42
43 /// <summary>
44 /// Determines whether the no-speculative-motive condition holds.
45 /// </summary>
46 public static bool IsApplicable(UlsProblem problem)
47 {
48 ArgumentNullException.ThrowIfNull(problem);
49
50 var productionCosts = problem.UnitProductionCosts;
51 var holdingCosts = problem.HoldingCosts;
52
53 for (var period = 0; period < problem.Horizon - 1; period++)
54 {
55 var deliveredNext =
56 productionCosts[period] +
57 holdingCosts[period];
58
59 if (!double.IsFinite(deliveredNext) ||
60 deliveredNext < productionCosts[period + 1])
61 {
62 return false;
63 }
64 }
65
66 return true;
67 }
68
69 /// <inheritdoc />
70 /// <exception cref="NotSupportedException">
71 /// Thrown when the no-speculative-motive condition is violated.
72 /// </exception>
74 UlsProblem problem,
75 CancellationToken cancellationToken = default)
76 {
77 ArgumentNullException.ThrowIfNull(problem);
78 cancellationToken.ThrowIfCancellationRequested();
79
80 if (!IsApplicable(problem))
81 {
82 throw new NotSupportedException(
83 "FedergruenTzurNoSpeculativeMotiveSolver requires " +
84 "p[t] + h[t] >= p[t+1] for every adjacent period.");
85 }
86
88 problem,
89 Name,
90 cancellationToken);
91 }
92}
Implements Federgruen-Tzur's linear-time forward algorithm for models without speculative inventory m...
static bool IsApplicable(UlsProblem problem)
Determines whether the no-speculative-motive condition holds.
UlsSolveResult Solve(UlsProblem problem, CancellationToken cancellationToken=default)
Shared allocation-conscious forward recurrence for the two Federgruen-Tzur linear-time specialization...
static UlsSolveResult SolveNoSpeculativeMotive(UlsProblem problem, string solverName, CancellationToken cancellationToken)
Represents a validated classical uncapacitated lot-sizing problem.
Definition UlsProblem.cs:23
ReadOnlySpan< double > UnitProductionCosts
Gets unit production costs by period.
ReadOnlySpan< double > HoldingCosts
Gets end-of-period unit holding costs by period.
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.