4using System.Threading.Tasks;
5using LotSizingDataModel.Core.PhysicalModel;
6using LotSizingDataModel.Core.Relationships;
7using LotSizingDataModel.Instance;
24 "transportSpecificCapacity";
31 LotSizingInstance instance,
34 ArgumentNullException.ThrowIfNull(instance);
35 ArgumentNullException.ThrowIfNull(options);
38 options.IncludeTransport &&
39 instance.SupplyChain.TransportCharacteristics.Any(
41 characteristic.CapacityConstraint is not
null);
48 LotSizingInstance instance,
51 CancellationToken cancellationToken)
53 foreach (TransportCharacteristic characteristic
54 in instance.SupplyChain.TransportCharacteristics)
56 if (characteristic.CapacityConstraint is
null)
61 TransportResource resource =
62 instance.SupplyChain.TransportResources
66 characteristic.TransportResourceId);
69 period <= instance.PlanningHorizon;
72 cancellationToken.ThrowIfCancellationRequested();
78 foreach (AssignedTransportLane lane
in instance.SupplyChain.GetTransportLanes(resource.Id))
83 characteristic.ItemId,
89 context.GetVariable(transportKey),
90 characteristic.UnitCapacityConsumption?[period] ??
94 characteristic.SetupTime?[period] ??
102 characteristic.ItemId,
107 if (context.VariableRegistry.TryGet(
110 setupVariable is not
null)
118 string additionalKey =
121 .TransportAdditionalCapacity,
122 characteristic.ItemId,
127 if (context.VariableRegistry.TryGet(
130 additionalVariable is not
null)
134 additionalAllocation.Add(additionalVariable);
138 if (characteristic.AdditionalCapacity is not
null)
140 AddConstraint(context, $
"transportAdditionalCapacityBudget_i{characteristic.ItemId}_r{resource.Id}_t{period}",
142 characteristic.AdditionalCapacity[period], description:
"Shared item-resource additional capacity across all assignments.");
147 $
"transportSpecificCapacity_i" +
148 $
"{characteristic.ItemId}_r{resource.Id}_t{period}",
151 characteristic.CapacityConstraint[period],
153 "Item-specific transport capacity " +
158 return ValueTask.CompletedTask;
161 private static string CreateKey(
165 AssignedTransportLane lane,
Provides a fluent builder for linear expressions.
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 AddDestinationWarehouse(MathematicalDomainKeyBuilder builder, WarehouseReference warehouse)
Adds a destination warehouse reference.
static MathematicalDomainKeyBuilder AddOriginWarehouse(MathematicalDomainKeyBuilder builder, WarehouseReference warehouse)
Adds an origin warehouse reference.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Transport
Identifies transported-quantity decision variables.
const string TransportSetup
Identifies transport setup decision variables.
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...
const string TransportResource
Transport-resource identifier segment.
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.