4using System.Threading.Tasks;
5using LotSizingDataModel.Instance;
69 ArgumentNullException.ThrowIfNull(
72 ArgumentNullException.ThrowIfNull(
75 ArgumentNullException.ThrowIfNull(
78 ArgumentNullException.ThrowIfNull(
109 "Standard lot-sizing MILP formulation";
115 "Solver-independent mixed-integer linear formulation " +
116 "for normalized lot-sizing instances.";
138 LotSizingInstance instance)
140 if (instance is
null)
145 return instance.PlanningHorizon > 0;
158 LotSizingInstance instance)
160 ArgumentNullException.ThrowIfNull(
163 if (!
string.IsNullOrWhiteSpace(
167 $
"{instance.Name.Trim()} - {FormulationId}";
170 if (!
string.IsNullOrWhiteSpace(
171 instance.InstanceId))
174 $
"{instance.InstanceId.Trim()} - {FormulationId}";
177 return base.CreateModelName(
197 LotSizingInstance instance,
199 CancellationToken cancellationToken)
201 if (_options.IncludeTransport)
204 .Validate(instance.SupplyChain)
205 .Where(issue => issue.Severity ==
LotSizingDataModel.Core.Validation.SupplyChainValidator.ValidationSeverity.Error
206 && issue.Path.StartsWith(
"supplyChain.transport", StringComparison.Ordinal))
208 if (transportErrors.Length > 0)
209 throw new InvalidOperationException(
"Invalid transport structure: " +
string.Join(
"; ", transportErrors.Select(issue => issue.ToString())));
212 return _variableBuilder.BuildAsync(
235 LotSizingInstance instance,
237 CancellationToken cancellationToken)
239 return _objectiveBuilder.BuildAsync(
262 LotSizingInstance instance,
264 CancellationToken cancellationToken)
266 return _constraintBuilder.BuildAsync(
Provides the shared state required while constructing a solver-independent mathematical model.