1using LotSizingDataModel.Core.DecisionModel.Scheduling;
2using LotSizingDataModel.Core.Relationships;
3using LotSizingDataModel.Instance;
10 public override bool IsEnabled(LotSizingInstance instance,
StandardLotSizingFormulationOptions options){ArgumentNullException.ThrowIfNull(instance);ArgumentNullException.ThrowIfNull(options);
return instance.SupplyChain.WorkCenters.Any(w=>w.SchedulingProfile?.MaximumSetupCount is not
null);}
13 var (plantId,wc,profile)=
GlspSchedulingData.
GetSchedulingWorkCenter(instance);MaximumSetupCount limit=profile.MaximumSetupCount??
throw new InvalidOperationException(
"MaximumSetupCount required.");IReadOnlyList<ProductionRouting> routings=
GlspSchedulingData.
GetRoutings(instance,plantId,wc.Id);var ordered=profile.EnumerateMicroPeriods().ToArray();
14 for(
int t=1;t<=instance.PlanningHorizon;t++){var e=
new LinearExpressionBuilder();
for(
int i=0;i<ordered.Length;i++){
if(ordered[i].MacroPeriod!=t)
continue;
int from=
GlspSequenceSemantics.
GetFixedPredecessorItemId(profile,i);
bool reset=i>0&&
GlspSequenceSemantics.
IsResetBoundary(profile,ordered[i-1],ordered[i]);
foreach(var r
in routings)e.Add(
GetVariable(context,
GlspFormulationVariableKeyFactory.
CreateMicroSetupStartKey(plantId,wc.Id,r.Id,r.ItemId,ordered[i],from,reset)));}
AddConstraint(context,$
"glspMaximumSetupCount_t{t}",e.
Build(),
MathematicalConstraintSense.LessThanOrEqual,limit.GetCount(t));}
15 return ValueTask.CompletedTask;
Provides a fluent builder for linear expressions.
Provides the shared state required while constructing a solver-independent mathematical model.
MathematicalModel Build(bool clone=true)
Builds and validates the mathematical model.
MathematicalConstraintSense
Identifies the relational sense of a mathematical constraint.