4using System.Threading.Tasks;
5using LotSizingDataModel.Core.PhysicalModel;
6using LotSizingDataModel.Core.Querying;
7using LotSizingDataModel.Core.Relationships;
8using LotSizingDataModel.Instance;
32 LotSizingInstance instance,
35 ArgumentNullException.ThrowIfNull(instance);
36 ArgumentNullException.ThrowIfNull(options);
42 entry.WorkCenter.CapacityConstraint is not
null);
49 LotSizingInstance instance,
52 CancellationToken cancellationToken)
55 new SupplyChainQueries(
56 instance.SupplyChain);
59 .EnumerateWorkCenters(instance.SupplyChain))
61 WorkCenter workCenter =
64 if (workCenter.CapacityConstraint is
null)
70 new WorkCenterReference
79 foreach (
int period
in Enumerable.Range(
81 instance.PlanningHorizon))
83 cancellationToken.ThrowIfCancellationRequested();
88 foreach (ProductionRouting routing
89 in instance.SupplyChain.ProductionRoutings)
91 if (!routing.WorkCenters.Any(
95 candidate.WorkCenterId ==
96 reference.WorkCenterId))
101 ProductionCharacteristic characteristic =
102 queries.GetRequiredProductionCharacteristic(
106 string productionKey =
118 context.GetVariable(productionKey),
119 characteristic.UnitCapacityConsumption?[period] ??
123 characteristic.SetupTime?[period] ??
139 if (context.VariableRegistry.TryGet(
142 setupVariable is not
null)
151 foreach (ProductionSetupFamily family
in
152 instance.SupplyChain.ProductionSetupFamilies.Where(
154 family.WorkCenter.PlantId == entry.PlantId &&
155 family.WorkCenter.WorkCenterId == workCenter.Id &&
156 family.SetupTime is not
null))
158 double familySetupTime =
159 family.SetupTime?[period] ?? 0.0;
161 if (familySetupTime <= 0.0)
166 string familySetupKey =
169 .AuxiliaryProductionFamilySetup)
179 context.GetVariable(familySetupKey),
183 string additionalKey =
186 .WorkCenterAdditionalCapacity)
198 if (context.VariableRegistry.TryGet(
201 additionalVariable is not
null)
209 $
"workCenterCapacity_p{entry.PlantId}" +
210 $
"_w{workCenter.Id}_t{period}",
213 workCenter.CapacityConstraint[period],
215 "Global work-center capacity constraint.");
219 return ValueTask.CompletedTask;
Provides a fluent builder for linear expressions.
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.
const string Setup
Identifies production setup decision variables.
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...
const string Plant
Plant identifier segment.
const string Routing
Routing identifier segment.
const string WorkCenter
Work-center identifier segment.
const string Period
Period index segment.
Represents one decision variable in a mathematical optimization model.
MathematicalConstraintSense
Identifies the relational sense of a mathematical constraint.