LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
SmallBucketStartUpVariableFamilyBuilder.cs
Go to the documentation of this file.
1using LotSizingDataModel.Core.DecisionModel.Scheduling;
2using LotSizingDataModel.Core.Relationships;
3using LotSizingDataModel.Instance;
5
7
10{
11 public override string FamilyId =>
12 "smallBucketProductionStartUp";
13
14 public override bool IsEnabled(
15 LotSizingInstance instance,
17 {
18 ArgumentNullException.ThrowIfNull(instance);
19 ArgumentNullException.ThrowIfNull(options);
20
21 return instance.SupplyChain.ProductionCharacteristics.Any(
22 characteristic =>
23 characteristic.StartUpCost is not null ||
24 characteristic.StartUpTime is not null);
25 }
26
27 protected override ValueTask BuildFamilyAsync(
28 LotSizingInstance instance,
31 CancellationToken cancellationToken)
32 {
33 ProductionSchedulingProfile profile =
34 instance.SupplyChain.WorkCenters
35 .Single(workCenter => workCenter.SchedulingProfile is not null)
36 .SchedulingProfile!;
37
38 foreach (ProductionRouting routing
39 in instance.SupplyChain.ProductionRoutings)
40 {
41 var reference =
42 routing.WorkCenters.Single();
43
44 ProductionCharacteristic characteristic =
45 instance.SupplyChain.ProductionCharacteristics.Single(
46 candidate =>
47 candidate.ItemId == routing.ItemId &&
48 candidate.WorkCenter.PlantId == reference.PlantId &&
49 candidate.WorkCenter.WorkCenterId == reference.WorkCenterId);
50
51 if (characteristic.StartUpCost is null &&
52 characteristic.StartUpTime is null)
53 {
54 continue;
55 }
56
57 for (int period = 1;
58 period <= instance.PlanningHorizon;
59 period++)
60 {
61 cancellationToken.ThrowIfCancellationRequested();
62
64 context,
65 $"smallBucketStartUp_r{routing.Id}_t{period}",
67 profile,
68 routing,
69 period),
70 "Small-bucket production start-up occurrence.");
71 }
72 }
73
74 return ValueTask.CompletedTask;
75 }
76}
Provides the shared state required while constructing a solver-independent mathematical model.
Builds canonical mathematical domain keys for production start-up events.
static string CreateSmallBucketKey(ProductionSchedulingProfile profile, ProductionRouting routing, int period)
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.