LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
GlspMacroProductionActivationVariableFamilyBuilder.cs
Go to the documentation of this file.
1using LotSizingDataModel.Core.Relationships;
2using LotSizingDataModel.Instance;
6{
7 public override string FamilyId=>"glspMacroProductionActivation";
8 public override bool IsEnabled(LotSizingInstance instance,StandardLotSizingFormulationOptions options){ArgumentNullException.ThrowIfNull(instance);ArgumentNullException.ThrowIfNull(options);return instance.SupplyChain.WorkCenters.Any(w=>w.SchedulingProfile?.MaximumProducedItemCount is not null);}
9 protected override ValueTask BuildFamilyAsync(LotSizingInstance instance,MathematicalModelBuildContext context,StandardLotSizingFormulationOptions options,CancellationToken cancellationToken){var (plantId,wc,profile)=GlspSchedulingData.GetSchedulingWorkCenter(instance);foreach(var r in GlspSchedulingData.GetRoutings(instance,plantId,wc.Id))for(int t=1;t<=instance.PlanningHorizon;t++)AddBinaryVariable(context,$"glspMacroProductionActive_r{r.Id}_t{t}",GlspFormulationVariableKeyFactory.CreateMacroProductionActivationKey(r.Id,t),"GLSP positive macro production flag.");return ValueTask.CompletedTask;}
10}
Provides the shared state required while constructing a solver-independent mathematical model.
override ValueTask BuildFamilyAsync(LotSizingInstance instance, MathematicalModelBuildContext context, StandardLotSizingFormulationOptions options, CancellationToken cancellationToken)
override bool IsEnabled(LotSizingInstance instance, StandardLotSizingFormulationOptions options)
Determines whether this variable family is enabled for the supplied instance and formulation options.
static int WorkCenter ProductionSchedulingProfile Profile GetSchedulingWorkCenter(LotSizingInstance instance)
static IReadOnlyList< ProductionRouting > GetRoutings(LotSizingInstance instance, int plantId, int workCenterId)
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.