LotSizingDataModel.Instance 2.0.1
Lot-sizing instance representation, descriptors and problem characterization.
Loading...
Searching...
No Matches
UniversalNotationGenerator.cs
Go to the documentation of this file.
1using LotSizingDataModel.Core.DecisionModel.Objectives;
5
7
8/// <summary>
9/// Generates notation scheme version 1 from typed problem descriptors.
10/// </summary>
11public sealed class UniversalNotationGenerator
12{
15 UniversalObjectiveKind objective =
17 {
18 return Generate(
19 descriptor,
21 objective);
22 }
23
24 /// <summary>
25 /// Backward-compatible temporal-only enrichment overload.
26 /// </summary>
29 IEnumerable<UniversalTemporalQualifier> temporalQualifiers,
30 UniversalObjectiveKind objective =
32 {
33 ArgumentNullException.ThrowIfNull(temporalQualifiers);
34
35 return Generate(
36 descriptor,
38 temporalQualifiers:
39 temporalQualifiers),
40 objective);
41 }
42
43 /// <summary>
44 /// Generates notation enriched with explicit derived analyses.
45 /// </summary>
48 UniversalDerivedSemantics derivedSemantics,
49 UniversalObjectiveKind objective =
51 {
52 ArgumentNullException.ThrowIfNull(descriptor);
53 ArgumentNullException.ThrowIfNull(derivedSemantics);
54
55 UniversalItemCardinality itemCardinality =
56 descriptor.Structure.ItemCount switch
57 {
58 1 => UniversalItemCardinality.Single,
59 > 1 => UniversalItemCardinality.Multiple,
61 };
62
63 UniversalProblemLevel problemLevel =
64 descriptor.Structure.ProductStructureRelationshipCount switch
65 {
66 0 => UniversalProblemLevel.SingleLevel,
67 > 0 => UniversalProblemLevel.MultiLevel,
69 };
70
71 var network =
73 {
74 Coupling = descriptor.SupplyNetwork.Coupling,
75 ForwardTopology =
77 ReverseTopology =
79 EchelonCount =
81 HasCycles =
83 HasMultiSourcing =
85 HasTransshipment =
86 descriptor.SupplyNetwork.HasTransshipment
87 };
88
90 alpha:
92 {
93 ItemCardinality = itemCardinality,
94 ProblemLevel = problemLevel,
97 Network = network
98 },
99 beta:
101 ExtractFeatures(descriptor),
102 derivedSemantics.TemporalQualifiers,
103 derivedSemantics.SatisfiedConditions),
104 gamma:
106 {
107 Objective =
108 ResolveObjective(
109 descriptor.ObjectiveFinance,
110 objective)
111 });
112 }
113
114 private static UniversalObjectiveKind ResolveObjective(
116 UniversalObjectiveKind fallback)
117 {
118 if (descriptor.HasMultipleObjectives)
119 {
120 return UniversalObjectiveKind.MultipleObjectives;
121 }
122
123 return descriptor.PrimaryObjectiveKind switch
124 {
125 OptimizationObjectiveKind.Economic =>
126 UniversalObjectiveKind.Economic,
127 OptimizationObjectiveKind.Financial =>
128 UniversalObjectiveKind.Financial,
129 OptimizationObjectiveKind.Sustainability =>
130 UniversalObjectiveKind.Sustainability,
131 OptimizationObjectiveKind.ServiceLevel =>
132 UniversalObjectiveKind.ServiceLevel,
133 _ => fallback
134 };
135 }
136
137 private static IEnumerable<UniversalNotationFeature>
138 ExtractFeatures(
140 {
141 if (descriptor.Demand.HasDemand)
142 {
143 yield return UniversalNotationFeature.Demand;
144 }
145
146 if (descriptor.Demand.IsDeterministic)
147 {
148 yield return UniversalNotationFeature.DeterministicDemand;
149 }
150
151 if (descriptor.Demand.IsTimeVarying)
152 {
153 yield return UniversalNotationFeature.TimeVaryingDemand;
154 }
155
156 if (descriptor.Production.HasProduction)
157 {
158 yield return UniversalNotationFeature.Production;
159 }
160
161 if (
162 descriptor.ProductionCapacityRegime ==
163 ProductionCapacityRegime.Uncapacitated)
164 {
165 yield return
166 UniversalNotationFeature.UncapacitatedProduction;
167 }
168
169 if (descriptor.Capacity.HasProductionCapacity)
170 {
171 yield return UniversalNotationFeature.ProductionCapacity;
172 }
173
175 {
176 yield return UniversalNotationFeature.SharedProductionCapacity;
177 }
178
180 {
181 yield return UniversalNotationFeature.TimeVaryingProductionCapacity;
182 }
183
184 if (descriptor.Capacity.HasSupplierCapacity)
185 {
186 yield return UniversalNotationFeature.SupplierCapacity;
187 }
188
189 if (descriptor.Capacity.HasTransportCapacity)
190 {
191 yield return UniversalNotationFeature.TransportCapacity;
192 }
193
194 if (descriptor.Capacity.HasWarehouseCapacity)
195 {
196 yield return UniversalNotationFeature.WarehouseCapacity;
197 }
198
199 if (descriptor.Setup.HasSetupCosts)
200 {
201 yield return UniversalNotationFeature.SetupCost;
202 }
203
204 if (descriptor.Setup.HasSetupTimes)
205 {
206 yield return UniversalNotationFeature.SetupTime;
207 }
208
209 if (descriptor.Setup.HasStartUpCosts)
210 {
211 yield return UniversalNotationFeature.StartUpCost;
212 }
213
214 if (descriptor.Setup.HasStartUpTimes)
215 {
216 yield return UniversalNotationFeature.StartUpTime;
217 }
218
219 if (descriptor.Setup.HasProductionSetupFamilies)
220 {
221 yield return UniversalNotationFeature.ProductionSetupFamily;
222 }
223
225 {
226 yield return UniversalNotationFeature.ProductionSetupFamilyTime;
227 }
228
229 if (descriptor.Production.HasLeadTimes)
230 {
231 yield return UniversalNotationFeature.ProductionLeadTime;
232 }
233
234 if (descriptor.Production.HasMinimumLotSizes)
235 {
236 yield return UniversalNotationFeature.MinimumLotSize;
237 }
238
239 if (descriptor.Production.HasMaximumLotSizes)
240 {
241 yield return UniversalNotationFeature.MaximumLotSize;
242 }
243
244 if (descriptor.Production.HasLotSizeMultiples)
245 {
246 yield return UniversalNotationFeature.LotSizeMultiple;
247 }
248
250 {
251 yield return UniversalNotationFeature.AdditionalProductionCapacity;
252 }
253
255 {
256 yield return UniversalNotationFeature.AdditionalWarehouseCapacity;
257 }
258
260 {
261 yield return UniversalNotationFeature.AdditionalTransportCapacity;
262 }
263
265 {
266 yield return UniversalNotationFeature.InitialInventory;
267 }
268
270 {
271 yield return UniversalNotationFeature.SafetyStock;
272 }
273
274 if (descriptor.InventoryService.HasBacklogging)
275 {
276 yield return UniversalNotationFeature.Backlogging;
277 }
278
279 if (descriptor.InventoryService.HasLostSales)
280 {
281 yield return UniversalNotationFeature.LostSales;
282 }
283
284 if (descriptor.Procurement.HasPurchasing)
285 {
286 yield return UniversalNotationFeature.Purchasing;
287 }
288
289 if (descriptor.Procurement.HasSupplierLeadTimes)
290 {
291 yield return UniversalNotationFeature.SupplierLeadTime;
292 }
293
295 {
296 yield return UniversalNotationFeature.Transportation;
297 }
298
300 {
301 yield return UniversalNotationFeature.TransportLeadTime;
302 }
303
305 {
306 yield return UniversalNotationFeature.Distribution;
307 }
308
309
310 if (descriptor.Scheduling.HasIntegratedScheduling)
311 {
312 yield return UniversalNotationFeature.IntegratedScheduling;
313 }
314
315 if (descriptor.Scheduling.HasBigBucketStructure)
316 {
317 yield return UniversalNotationFeature.BigBucketScheduling;
318 }
319
320 if (descriptor.Scheduling.HasSmallBucketStructure)
321 {
322 yield return UniversalNotationFeature.SmallBucketScheduling;
323 }
324
325 if (descriptor.Scheduling.HasMicroPeriodStructure)
326 {
327 yield return UniversalNotationFeature.MacroMicroScheduling;
328 }
329
331 {
332 yield return UniversalNotationFeature.ExplicitMicroPeriodGrid;
333 }
334
336 {
337 yield return UniversalNotationFeature.VariableLengthMicroPeriods;
338 }
339
341 {
342 yield return UniversalNotationFeature.FixedLengthMicroPeriods;
343 }
344
346 {
347 yield return UniversalNotationFeature.SingleItemPerMicroPeriod;
348 }
349
351 {
352 yield return UniversalNotationFeature.MultipleItemsPerMicroPeriod;
353 }
354
356 {
357 yield return UniversalNotationFeature.VariableMicroPeriodCount;
358 }
359
360 if (descriptor.Scheduling.HasInitialSetupState)
361 {
362 yield return UniversalNotationFeature.InitialSetupState;
363 }
364
365 if (descriptor.Scheduling.HasSetupCarryOver)
366 {
367 yield return UniversalNotationFeature.SetupCarryOver;
368 }
369
371 {
372 yield return UniversalNotationFeature.SetupCarryOverForbidden;
373 }
374
375 if (descriptor.Production.HasGroupingConstraints)
376 {
377 yield return UniversalNotationFeature.GroupingConstraint;
378 }
379
381 {
382 yield return
383 UniversalNotationFeature.SequenceDependentChangeoverTime;
384 }
385
387 {
388 yield return
389 UniversalNotationFeature.SequenceDependentChangeoverCost;
390 }
391
393 {
394 yield return UniversalNotationFeature.MaximumSetupCount;
395 }
396
398 {
399 yield return UniversalNotationFeature.SingleSchedulingResource;
400 }
401
403 {
404 yield return
405 UniversalNotationFeature.SmallBucketAllOrNothingProduction;
406 }
407
409 {
410 yield return
411 UniversalNotationFeature.SmallBucketContinuousProduction;
412 }
413
415 {
416 yield return
417 UniversalNotationFeature.AtMostOneProducedItemPerBucket;
418 }
420 {
421 yield return
422 UniversalNotationFeature.AtMostTwoProducedItemsPerBucket;
423 }
424
426 {
427 yield return
428 UniversalNotationFeature.AtMostOneSetupTransitionPerBucket;
429 }
430
432 {
433 yield return UniversalNotationFeature.FinancialConstraint;
434 }
435 }
436}
Typed structured description of the factual lot-sizing problem characteristics currently represented ...
ProductionCapacityRegime ProductionCapacityRegime
Gets the production-capacity regime derived from existing production and production-capacity facts.
SupplyNetworkDescriptor SupplyNetwork
Gets the physical supply-flow network descriptor.
int? EchelonCount
Gets the number of facility echelons when the graph is acyclic. Null means that a longest-path echelo...
Carries explicit derived analyses that cannot be inferred from the coarse typed descriptor alone.
IReadOnlyCollection< UniversalTemporalQualifier > TemporalQualifiers
IReadOnlyCollection< UniversalSemanticCondition > SatisfiedConditions
Typed abstract syntax tree for the versioned alpha | beta | gamma scheme.
Typed alpha-field representation of the physical network.
Alpha field: structural/environment characteristics.
Beta field: constraints and modeled extensions.
Generates notation scheme version 1 from typed problem descriptors.
UniversalLotSizingNotation Generate(LotSizingProblemDescriptor descriptor, UniversalObjectiveKind objective=UniversalObjectiveKind.Economic)
UniversalLotSizingNotation Generate(LotSizingProblemDescriptor descriptor, IEnumerable< UniversalTemporalQualifier > temporalQualifiers, UniversalObjectiveKind objective=UniversalObjectiveKind.Economic)
Backward-compatible temporal-only enrichment overload.
UniversalLotSizingNotation Generate(LotSizingProblemDescriptor descriptor, UniversalDerivedSemantics derivedSemantics, UniversalObjectiveKind objective=UniversalObjectiveKind.Economic)
Generates notation enriched with explicit derived analyses.
ProductStructureType
Identifies the structural category of a product bill-of-materials graph.
ProductionCapacityRegime
Production-capacity regime derived from already represented descriptor semantics. No new serialized s...
UniversalObjectiveKind
Objective family represented in the gamma field of notation v1.
UniversalNotationFeature
Feature vocabulary represented in the beta field of notation v1. Enum order is the canonical renderin...
UniversalProblemLevel
Canonical BOM-level token.
UniversalItemCardinality
Canonical item-cardinality token.