3using System.Threading.Tasks;
4using LotSizingDataModel.Core.Relationships;
5using LotSizingDataModel.Instance;
39 LotSizingInstance instance,
42 ArgumentNullException.ThrowIfNull(instance);
43 ArgumentNullException.ThrowIfNull(options);
50 foreach (Inventory inventory
in instance.SupplyChain.Inventories)
52 if (inventory.SafetyStock is not
null)
66 LotSizingInstance instance,
69 CancellationToken cancellationToken)
71 foreach (Inventory inventory
in instance.SupplyChain.Inventories)
73 if (inventory.SafetyStock is
null)
79 period <= instance.PlanningHorizon;
82 cancellationToken.ThrowIfCancellationRequested();
84 var inventoryKeyBuilder =
111 if (options.IncludeSafetyStockViolation &&
112 inventory.SafetyStockViolationCost is not
null)
114 var violationKeyBuilder =
117 .InventorySafetyStockViolation)
124 inventory.Warehouse);
126 string violationKey =
133 if (context.VariableRegistry.TryGet(
136 violationVariable is not
null)
145 $
"safetyStock_i{inventory.ItemId}" +
146 $
"_w{inventory.Warehouse.ReferenceId}_t{period}",
149 inventory.SafetyStock[period],
151 "Inventory safety-stock constraint.");
155 return ValueTask.CompletedTask;
Provides a fluent builder for linear expressions.
LinearExpressionBuilder Add(MathematicalVariable variable, double coefficient=1.0)
Adds a variable term to the expression.
Builds stable business-domain keys for mathematical variables and constraints.
string Build()
Builds the immutable domain-key text.
MathematicalDomainKeyBuilder Add(string name, string value)
Adds a text segment.
Provides the shared state required while constructing a solver-independent mathematical model.
Creates canonical domain-key fragments shared by standard formulation builders and provides warehouse...
static MathematicalDomainKeyBuilder AddWarehouse(MathematicalDomainKeyBuilder builder, WarehouseReference warehouse)
Adds a warehouse reference using the generic warehouse or plant segment.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Inventory
Identifies inventory-level decision variables.
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...
const string Item
Item or product identifier segment.
const string Period
Period index segment.
Represents one decision variable in a mathematical optimization model.
MathematicalConstraintSense
Identifies the relational sense of a mathematical constraint.