LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
ProductionFamilySetupVariableFamilyBuilder.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4using LotSizingDataModel.Core.Relationships;
5using LotSizingDataModel.Instance;
8
10
13{
14 public override string FamilyId =>
16
17 public override bool IsEnabled(
18 LotSizingInstance instance,
20 {
21 ArgumentNullException.ThrowIfNull(instance);
22 ArgumentNullException.ThrowIfNull(options);
23
24 if (instance.SupplyChain.ProductionSetupFamilies.Count == 0)
25 {
26 return false;
27 }
28
29 if (!options.IncludeProductionSetups)
30 {
31 throw new InvalidOperationException(
32 "Production-family setup semantics require item-level production setups.");
33 }
34
35 return true;
36 }
37
38 protected override ValueTask BuildFamilyAsync(
39 LotSizingInstance instance,
42 CancellationToken cancellationToken)
43 {
44 foreach (ProductionSetupFamily family
45 in instance.SupplyChain.ProductionSetupFamilies)
46 {
47 for (int period = 1;
48 period <= instance.PlanningHorizon;
49 period++)
50 {
51 string domainKey =
54 .AuxiliaryProductionFamilySetup)
55 .Add(
57 family.Id)
58 .Add(
60 period)
61 .Build();
62
64 context,
65 $"wf_f{family.Id}_t{period}",
66 domainKey,
67 "Shared production-family setup activation.");
68 }
69 }
70
71 return ValueTask.CompletedTask;
72 }
73}
Builds stable business-domain keys for mathematical variables and constraints.
MathematicalDomainKeyBuilder Add(string name, string value)
Adds a text segment.
Provides the shared state required while constructing a solver-independent mathematical model.
override bool IsEnabled(LotSizingInstance instance, StandardLotSizingFormulationOptions options)
Determines whether this variable family is enabled for the supplied instance and formulation options.
override ValueTask BuildFamilyAsync(LotSizingInstance instance, MathematicalModelBuildContext context, StandardLotSizingFormulationOptions options, CancellationToken cancellationToken)
Configures the standard solver-independent mixed-integer lot-sizing formulation.
Provides common validation and variable-registration helpers for one variable family of the standard ...
static MathematicalVariable AddBinaryVariable(MathematicalModelBuildContext context, string name, string domainKey, string description="")
Creates and registers one binary variable.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...