LotSizingDataModel.Instance 2.0.1
Lot-sizing instance representation, descriptors and problem characterization.
Loading...
Searching...
No Matches
WolseyExtendedClassification.cs
Go to the documentation of this file.
2
3/// <summary>
4/// Preserves Wolsey's optional multi-item/machine/level extension around the
5/// single-item PROB-CAP-VAR classification.
6/// </summary>
7public sealed class WolseyExtendedClassification
8{
11 int? itemCount = null,
12 int? periodCount = null,
13 WolseyMachineClassification? machines = null,
14 WolseyMultiLevelClassification? multiLevel = null)
15 {
17 singleItem ??
18 throw new ArgumentNullException(nameof(singleItem));
19
20 if (itemCount is <= 0)
21 {
22 throw new ArgumentOutOfRangeException(
23 nameof(itemCount),
24 itemCount,
25 "NI must be positive when supplied.");
26 }
27
28 if (periodCount is <= 0)
29 {
30 throw new ArgumentOutOfRangeException(
31 nameof(periodCount),
32 periodCount,
33 "NT must be positive when supplied.");
34 }
35
36 ItemCount = itemCount;
37 PeriodCount = periodCount;
38 Machines = machines;
39 MultiLevel = multiLevel;
40 }
41
43 public int? ItemCount { get; }
44 public int? PeriodCount { get; }
47
48 public string HistoricalCode
49 {
50 get
51 {
52 var blocks = new List<string>();
53
54 if (MultiLevel is not null)
55 {
56 blocks.Add(MultiLevel.HistoricalCode);
57 }
58
59 if (Machines is not null)
60 {
61 blocks.Add(Machines.HistoricalCode);
62 }
63
64 if (ItemCount.HasValue)
65 {
66 blocks.Add($"{{NI={ItemCount.Value}}}");
67 }
68
69 if (PeriodCount.HasValue)
70 {
71 blocks.Add($"{{NT={PeriodCount.Value}}}");
72 }
73
74 blocks.Add(
75 "{" +
76 SingleItem.HistoricalCode +
77 "}");
78
79 return string.Concat(blocks);
80 }
81 }
82
83 public override string ToString() =>
85}
WolseyExtendedClassification(WolseySingleItemClassification singleItem, int? itemCount=null, int? periodCount=null, WolseyMachineClassification? machines=null, WolseyMultiLevelClassification? multiLevel=null)
Typed representation of the machine block {NK=#,[IM,VM],[LT]*,[SB1,SB2,BB],[SET,ST,...
Typed representation of Wolsey's multi-level block {NL=#,[G,A,S]}.
Lossless typed representation of Wolsey's PROB-CAP-VAR single-item classification.