LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
GlspSetupStartVariableFamilyBuilder.cs
Go to the documentation of this file.
1using LotSizingDataModel.Core.Relationships;
2using LotSizingDataModel.Instance;
6{
7 public override string FamilyId=>"glspSetupStart";
8 protected override ValueTask BuildFamilyAsync(LotSizingInstance instance,MathematicalModelBuildContext context,StandardLotSizingFormulationOptions options,CancellationToken cancellationToken)
9 {
10 var (plantId,wc,profile)=GlspSchedulingData.GetSchedulingWorkCenter(instance);IReadOnlyList<ProductionRouting> routings=GlspSchedulingData.GetRoutings(instance,plantId,wc.Id);var ordered=profile.EnumerateMicroPeriods().ToArray();
11 for(int i=0;i<ordered.Length;i++){int from=GlspSequenceSemantics.GetFixedPredecessorItemId(profile,i);bool reset=i>0&&GlspSequenceSemantics.IsResetBoundary(profile,ordered[i-1],ordered[i]);foreach(var routing in routings)AddBinaryVariable(context,$"glspU_r{routing.Id}_t{ordered[i].MacroPeriod}_s{ordered[i].MicroPeriodIndex}",GlspFormulationVariableKeyFactory.CreateMicroSetupStartKey(plantId,wc.Id,routing.Id,routing.ItemId,ordered[i],from,reset),"GLSP setup-start occurrence.");}
12 return ValueTask.CompletedTask;
13 }
14}
Provides the shared state required while constructing a solver-independent mathematical model.
static string CreateMicroSetupStartKey(int plantId, int workCenterId, int routingId, int itemId, ProductionMicroPeriodReference microPeriod, int fixedPredecessorItemId, bool resetBoundary)
static int WorkCenter ProductionSchedulingProfile Profile GetSchedulingWorkCenter(LotSizingInstance instance)
static IReadOnlyList< ProductionRouting > GetRoutings(LotSizingInstance instance, int plantId, int workCenterId)
static bool IsResetBoundary(ProductionSchedulingProfile profile, ProductionMicroPeriodReference previous, ProductionMicroPeriodReference current)
static int GetFixedPredecessorItemId(ProductionSchedulingProfile profile, int index)
override ValueTask BuildFamilyAsync(LotSizingInstance instance, MathematicalModelBuildContext context, StandardLotSizingFormulationOptions options, CancellationToken cancellationToken)
override string FamilyId
Gets the unique identifier of the variable family.
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.