LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
SmallBucketSetupStartCostObjectiveTermBuilder.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 TermFamilyId => "smallBucketSetupStartCost";
12
13 protected override ValueTask BuildTermsAsync(
14 LotSizingInstance instance,
16 LinearExpressionBuilder expressionBuilder,
18 CancellationToken cancellationToken)
19 {
20 ProductionSchedulingProfile profile =
21 instance.SupplyChain.WorkCenters
22 .Single(workCenter => workCenter.SchedulingProfile is not null)
23 .SchedulingProfile!;
24
25 foreach (ProductionRouting routing in instance.SupplyChain.ProductionRoutings)
26 {
27 var reference = routing.WorkCenters.Single();
28 ProductionCharacteristic characteristic =
29 instance.SupplyChain.ProductionCharacteristics.Single(candidate =>
30 candidate.ItemId == routing.ItemId &&
31 candidate.WorkCenter.PlantId == reference.PlantId &&
32 candidate.WorkCenter.WorkCenterId == reference.WorkCenterId);
33
34 for (int period=1; period<=instance.PlanningHorizon; period++)
35 {
36 double cost = characteristic.FixedSetupCost?[period] ?? 0.0;
37 if (cost == 0.0) continue;
38 AddCostTerm(context,expressionBuilder,
40 }
41 }
42 return ValueTask.CompletedTask;
43 }
44}
Provides a fluent builder for linear expressions.
Provides the shared state required while constructing a solver-independent mathematical model.
static string CreateSetupStartKey(ProductionSchedulingProfile profile, ProductionRouting routing, int period)
override ValueTask BuildTermsAsync(LotSizingInstance instance, MathematicalModelBuildContext context, LinearExpressionBuilder expressionBuilder, StandardLotSizingFormulationOptions options, CancellationToken cancellationToken)
Configures the standard solver-independent mixed-integer lot-sizing formulation.
Provides common validation and helper methods for one objective-term family of the standard lot-sizin...
static void AddCostTerm(MathematicalModelBuildContext context, LinearExpressionBuilder expressionBuilder, string domainKey, double coefficient)
Adds one variable cost term to the shared objective.