4using System.Threading.Tasks;
5using LotSizingDataModel.Core.Indexing;
6using LotSizingDataModel.Core.Relationships;
7using LotSizingDataModel.Instance;
51 LotSizingInstance instance,
54 ArgumentNullException.ThrowIfNull(
57 ArgumentNullException.ThrowIfNull(
61 instance.SupplyChain.ProductionRoutings.Count > 0;
83 LotSizingInstance instance,
86 CancellationToken cancellationToken)
89 instance.PlanningHorizon;
91 if (planningHorizon <= 0)
93 throw new InvalidOperationException(
94 "Production variables cannot be built for an " +
95 "instance with a non-positive planning horizon.");
98 var index =
new SupplyChainIndex(instance.SupplyChain);
101 ProductionRouting routing
102 in instance.SupplyChain.ProductionRoutings)
104 cancellationToken.ThrowIfCancellationRequested();
108 throw new InvalidOperationException(
109 "Every production routing must have a " +
110 "strictly positive identifier before the " +
111 "mathematical formulation is built.");
114 var workCenters = routing.WorkCenters.Select(index.GetRequiredWorkCenter).ToArray();
118 period <= planningHorizon;
121 cancellationToken.ThrowIfCancellationRequested();
134 string variableName =
135 $
"x_r{routing.Id}_t{period}";
138 double upperBound = workCenters.Any(center => center.GetProductionCapacity(period) == 0)
139 ? 0 :
double.PositiveInfinity;
145 $
"Production quantity for routing " +
146 $
"{routing.Id} in period {period}.");
150 return ValueTask.CompletedTask;
Builds stable business-domain keys for mathematical variables and constraints.
string Build()
Builds the immutable domain-key text.
MathematicalDomainKeyBuilder Add(string name, string value)
Adds a text segment.
Provides the shared state required while constructing a solver-independent mathematical model.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Production
Identifies production-quantity decision variables.
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...
const string Routing
Routing identifier segment.
const string Period
Period index segment.