LotSizingDataModel.Instance 2.0.1
Lot-sizing instance representation, descriptors and problem characterization.
Loading...
Searching...
No Matches
MacroMicroSchedulingProblemClassAnalyzer.cs
Go to the documentation of this file.
1using LotSizingDataModel.Core.DecisionModel.Scheduling;
3
5
7{
8 private readonly LotSizingProblemClassExtensionAnalyzer _extensionAnalyzer;
9
14
17 {
18 _extensionAnalyzer =
19 extensionAnalyzer ??
20 throw new ArgumentNullException(nameof(extensionAnalyzer));
21 }
22
26 {
27 ArgumentNullException.ThrowIfNull(descriptor);
28 ArgumentNullException.ThrowIfNull(definition);
29
30 if (definition.Id !=
31 CanonicalLotSizingProblemClassId.GeneralLotSizingAndScheduling)
32 {
34 definition,
35 LotSizingProblemClassMatchKind.NotRepresentable,
36 failedRequirements:
37 new[] { "MacroMicroSchedulingAnalyzer:UnsupportedClass" });
38 }
39
40 var incomplete = new List<string>();
41 var contradictions = new List<string>();
42 SchedulingDescriptor scheduling = descriptor.Scheduling;
43
44 if (!scheduling.HasIntegratedScheduling)
45 contradictions.Add("Scheduling:Integrated");
46
47 if (!scheduling.HasMicroPeriodStructure)
48 contradictions.Add("Scheduling:MacroMicro");
49
50 if (!scheduling.HasExplicitMicroPeriodGrid)
51 incomplete.Add("Scheduling:MicroPeriodGrid");
52
53 if (scheduling.MicroPeriodLengthMode == MicroPeriodLengthMode.Unspecified)
54 incomplete.Add("Scheduling:MicroPeriodLengthMode");
55 else if (!scheduling.HasVariableLengthMicroPeriods)
56 contradictions.Add("Scheduling:VariableMicroPeriodLength");
57
58 if (scheduling.MicroPeriodAssignmentMode == MicroPeriodAssignmentMode.Unspecified)
59 incomplete.Add("Scheduling:MicroPeriodAssignmentMode");
60 else if (!scheduling.HasSingleItemPerMicroPeriod)
61 contradictions.Add("Scheduling:SingleItemPerMicroPeriod");
62
63 if (descriptor.Structure.ItemCount == 0)
64 incomplete.Add("Structure:ItemCount");
65 else if (!descriptor.Structure.IsMultiItem)
66 contradictions.Add("Structure:MultiItem");
67
68 if (!descriptor.Structure.IsSingleLevel)
69 contradictions.Add("Structure:SingleLevel");
70
71 if (scheduling.SchedulingResourceCount == 0)
72 incomplete.Add("Scheduling:ResourceCount");
73 else if (!scheduling.HasSingleSchedulingResource)
74 contradictions.Add("Scheduling:SingleResource");
75
76 if (!descriptor.Demand.HasDemand)
77 contradictions.Add("Demand:Present");
78
79 if (!descriptor.Demand.IsDeterministic)
80 contradictions.Add("Demand:Deterministic");
81
82 if (!descriptor.Production.HasProduction)
83 contradictions.Add("Production:Present");
84
85 if (!descriptor.Capacity.HasProductionCapacity)
86 contradictions.Add("Capacity:Production");
87
89 contradictions.Add("Capacity:Shared");
90
91 if (contradictions.Count > 0)
92 {
94 definition,
96 failedRequirements: contradictions);
97 }
98
99 if (incomplete.Count > 0)
100 {
102 definition,
104 failedRequirements: incomplete);
105 }
106
107 var coreExtensions =
108 new HashSet<LotSizingProblemClassExtensionKind>
109 {
110 LotSizingProblemClassExtensionKind.IntegratedScheduling,
112 };
113
115 _extensionAnalyzer
116 .Analyze(descriptor)
117 .Where(extension => !coreExtensions.Contains(extension))
118 .ToArray();
119
121 definition,
122 extensions.Length == 0
124 : LotSizingProblemClassMatchKind.CompatibleExtension,
125 extensions);
126 }
127}
Typed structured description of the factual lot-sizing problem characteristics currently represented ...
Factual integrated lot-sizing/scheduling characteristics.
Identifies modeled extensions outside the six currently executable canonical lot-sizing core signatur...
LotSizingProblemClassMatchResult Assess(LotSizingProblemDescriptor descriptor, LotSizingProblemClassDefinition definition)
LotSizingProblemClassMatchKind
Relationship between an instance descriptor and one canonical problem class.
LotSizingProblemClassExtensionKind
Modeled characteristics outside the canonical core signatures.
CanonicalLotSizingProblemClassId
Stable canonical LotSizingDataModel identifiers for problem classes.