29 string formulationFamily,
30 IEnumerable<CanonicalLotSizingProblemClassId>
31 supportedProblemClasses,
32 IEnumerable<LotSizingProblemClassExtensionKind>?
33 supportedExtensions =
null,
34 IEnumerable<LotSizingProblemClassExtensionKind>?
35 knownUnsupportedExtensions =
null,
36 IEnumerable<OptimizationObjectiveKind>?
37 supportedObjectiveKinds =
null,
38 IEnumerable<string>? evidence =
null)
40 if (
string.IsNullOrWhiteSpace(formulationId))
42 throw new ArgumentException(
43 "A formulation identifier is required.",
44 nameof(formulationId));
47 if (
string.IsNullOrWhiteSpace(formulationFamily))
49 throw new ArgumentException(
50 "A formulation family is required.",
51 nameof(formulationFamily));
54 ArgumentNullException.ThrowIfNull(supportedProblemClasses);
59 _supportedProblemClasses =
60 supportedProblemClasses
62 .OrderBy(value => (
int)value)
65 _supportedExtensions =
66 (supportedExtensions ??
67 Array.Empty<LotSizingProblemClassExtensionKind>())
69 .OrderBy(value => (
int)value)
72 _knownUnsupportedExtensions =
73 (knownUnsupportedExtensions ??
74 Array.Empty<LotSizingProblemClassExtensionKind>())
76 .OrderBy(value => (
int)value)
79 _supportedObjectiveKinds =
80 (supportedObjectiveKinds ??
83 OptimizationObjectiveKind.Economic
87 value != OptimizationObjectiveKind.Unknown)
89 .OrderBy(value => (
int)value)
92 LotSizingProblemClassExtensionKind[] overlap =
94 .Intersect(_knownUnsupportedExtensions)
97 if (overlap.Length > 0)
99 throw new ArgumentException(
100 "A formulation extension cannot be both supported and " +
101 "known unsupported: " +
102 string.Join(
",", overlap));
106 (evidence ?? Array.Empty<
string>())
107 .Where(value => !
string.IsNullOrWhiteSpace(value))
108 .Select(value => value.Trim())
109 .Distinct(StringComparer.Ordinal)