2using System.Collections.Generic;
4using LotSizingDataModel.Instance;
40 LotSizingInstance instance,
42 string requestedFormulationId =
"",
43 bool allowFallback =
true)
45 ArgumentNullException.ThrowIfNull(
48 ArgumentNullException.ThrowIfNull(
51 string normalizedRequestedFormulationId =
52 requestedFormulationId?.Trim() ??
58 if (!
string.IsNullOrWhiteSpace(
59 normalizedRequestedFormulationId))
62 normalizedRequestedFormulationId,
64 requestedFormulation))
66 if (requestedFormulation!.CanBuild(
73 normalizedRequestedFormulationId,
79 $
"Requested formulation " +
80 $
"'{requestedFormulation.FormulationId}' " +
87 $
"Requested formulation " +
88 $
"'{requestedFormulation.FormulationId}' does " +
89 "not support the supplied lot-sizing " +
95 $
"Requested formulation " +
96 $
"'{normalizedRequestedFormulationId}' is not " +
106 normalizedRequestedFormulationId,
107 "No compatible requested " +
108 "formulation could be selected.");
122 formulation.CanBuild(
125 if (fallbackFormulation is
null)
130 normalizedRequestedFormulationId,
131 "No registered mathematical formulation " +
132 "supports the supplied lot-sizing " +
143 !
string.IsNullOrWhiteSpace(
144 normalizedRequestedFormulationId);
148 normalizedRequestedFormulationId,
158 ? $
"Fallback formulation " +
159 $
"'{fallbackFormulation.FormulationId}' was " +
162 $
"'{fallbackFormulation.FormulationId}' was " +
163 "selected automatically.");
168 private static void AddDiagnostics(
170 IEnumerable<string> diagnostics)