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?.MaximumProducedItemCount is not
null);}
14 for(
int t=1;t<=instance.PlanningHorizon;t++){var count=
new LinearExpressionBuilder();
foreach(var r
in routings){var c=
GlspSchedulingData.
GetCharacteristic(instance,r,plantId,wc.Id);
double m=wc.CapacityConstraint![t]+(wc.AdditionalCapacity?[t]??0.0);var q=
GetVariable(context,
GlspFormulationVariableKeyFactory.
CreateMacroProductionActivationKey(r.Id,t));
AddConstraint(context,$
"glspMacroProductionActivation_r{r.Id}_t{t}",
new LinearExpressionBuilder().Add(
GetVariable(context,
StandardFormulationVariableKeyFactory.
CreateProductionKey(r.Id,t)),c.UnitCapacityConsumption![t]).
Subtract(q,m).
Build(),
MathematicalConstraintSense.LessThanOrEqual,0.0);count.Add(q);}
AddConstraint(context,$
"glspProducedItemCount_t{t}",count.
Build(),
MathematicalConstraintSense.LessThanOrEqual,limit.GetCount(t));}
15 return ValueTask.CompletedTask;
Provides a fluent builder for linear expressions.
LinearExpressionBuilder Subtract(MathematicalVariable variable, double coefficient=1.0)
Subtracts a variable term from the expression.
LinearExpression Build(bool clone=true)
Builds and validates the linear expression.
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.