3using System.Threading.Tasks;
4using LotSizingDataModel.Core.Relationships;
5using LotSizingDataModel.Instance;
38 LotSizingInstance instance,
41 ArgumentNullException.ThrowIfNull(instance);
42 ArgumentNullException.ThrowIfNull(options);
44 foreach (Inventory inventory
in instance.SupplyChain.Inventories)
46 if (inventory.CapacityConstraint is not
null)
59 LotSizingInstance instance,
62 CancellationToken cancellationToken)
64 foreach (Inventory inventory
in instance.SupplyChain.Inventories)
66 if (inventory.CapacityConstraint is
null)
72 period <= instance.PlanningHorizon;
75 cancellationToken.ThrowIfCancellationRequested();
87 inventory.UnitCapacityConsumption?[period] ??
96 AddOptionalAdditionalCapacity(
104 $
"inventoryCapacity_i{inventory.ItemId}" +
105 $
"_w{inventory.Warehouse.ReferenceId}_t{period}",
108 inventory.CapacityConstraint[period],
110 "Item-specific inventory capacity " +
115 return ValueTask.CompletedTask;
132 inventory.Warehouse);
142 private static void AddOptionalSetupLoad(
149 inventory.SetupTime?[period] ??
152 if (setupTime == 0.0)
164 StandardFormulationDomainKeyFactory.AddWarehouse(
166 inventory.Warehouse);
178 setupVariable is not
null)
186 private static void AddOptionalAdditionalCapacity(
187 MathematicalModelBuildContext context,
188 LinearExpressionBuilder expression,
193 new MathematicalDomainKeyBuilder(
194 MathematicalDecisionCategory
195 .InventoryAdditionalCapacity)
197 MathematicalDomainKeySegment.Item,
200 StandardFormulationDomainKeyFactory.AddWarehouse(
202 inventory.Warehouse);
207 MathematicalDomainKeySegment.Period,
213 out MathematicalVariable? additionalVariable) &&
214 additionalVariable is not
null)
Provides a fluent builder for linear expressions.
LinearExpressionBuilder Subtract(MathematicalVariable variable, double coefficient=1.0)
Subtracts a variable term from the expression.
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.
MathematicalVariable GetVariable(string domainKey)
Gets a required mathematical variable from its business-domain key.
MathematicalVariableRegistry VariableRegistry
Gets the registry that maps business-domain keys to mathematical variables.
bool TryGet(string domainKey, out MathematicalVariable? variable)
Attempts to get the variable registered for a domain key.
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.
const string InventorySetup
Identifies inventory setup 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.