ULSAlgorithms 1.1.0-g3e5595996d
High-performance exact and heuristic algorithms for uncapacitated lot sizing
Loading...
Searching...
No Matches
HoChangSolisNetLeastPeriodCostSolver.cs
Go to the documentation of this file.
1using System.Buffers;
6
8
9/// <summary>
10/// Implements the Ho-Chang-Solis net Least Period Cost (nLPC) heuristic.
11/// </summary>
12/// <remarks>
13/// <para>
14/// For a lot beginning in period i and ending in period j, Ho, Chang and Solis
15/// define the net average period cost as the setup-plus-holding cost divided by
16/// the number of non-zero-demand periods in [i,j]. Zero-demand periods are
17/// explicitly skipped by the stopping test.
18/// </para>
19/// <para>
20/// The lot is extended while the net average period cost does not increase.
21/// This implementation evaluates the same published stopping rule
22/// incrementally, so each calendar period is scanned only a constant number of
23/// times.
24/// </para>
25/// <para>
26/// Reference: J. C. Ho, Y.-L. Chang and A. O. Solis,
27/// "Two modifications of the least cost per period heuristic for dynamic
28/// lot-sizing", Journal of the Operational Research Society 57(8),
29/// 1005-1013, 2006, DOI 10.1057/palgrave.jors.2602076.
30/// </para>
31/// </remarks>
33{
34 public string Name =>
35 "Ho-Chang-Solis net Least Period Cost";
36
38 UlsSolverKind.Heuristic;
39
40 public static bool IsApplicable(
41 UlsProblem problem) =>
43
45 UlsProblem problem,
46 CancellationToken cancellationToken = default)
47 {
48 ArgumentNullException.ThrowIfNull(problem);
49 cancellationToken.ThrowIfCancellationRequested();
50
52 problem,
53 Name);
54
55 int horizon = problem.Horizon;
56 int[] buffer =
57 ArrayPool<int>.Shared.Rent(horizon);
58
59 try
60 {
61 Span<int> cycleEnds =
62 buffer.AsSpan(0, horizon);
63
65 problem,
66 cycleEnds,
67 useImprovedTieBreak: false,
68 cancellationToken);
69
71 problem,
72 cycleEnds,
73 Name,
74 cancellationToken);
75 }
76 finally
77 {
78 ArrayPool<int>.Shared.Return(
79 buffer,
80 clearArray: false);
81 }
82 }
83}
Implements the Ho-Chang-Solis net Least Period Cost (nLPC) heuristic.
string Name
Gets the stable human-readable name of the solver.
UlsSolveResult Solve(UlsProblem problem, CancellationToken cancellationToken=default)
Solves an uncapacitated lot-sizing problem.
Shared applicability checks for classical stationary-cost lot-sizing heuristics.
static void ThrowIfNotStationary(UlsProblem problem, string solverName)
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)
Shared incremental implementation of the Ho-Chang-Solis net average period cost recursion.
static void BuildCycleEnds(UlsProblem problem, Span< int > cycleEnds, bool useImprovedTieBreak, CancellationToken cancellationToken)
Represents a validated classical uncapacitated lot-sizing problem.
Definition UlsProblem.cs:23
int Horizon
Gets the number of planning periods.
Definition UlsProblem.cs:82
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.