3using LotSizingDataModel.Core.PhysicalModel;
4using LotSizingDataModel.Solution;
5using LotSizingDataModel.Solution.Decisions;
49 LotSizingSolution solution,
53 ArgumentNullException.ThrowIfNull(
56 ArgumentNullException.ThrowIfNull(
59 ArgumentNullException.ThrowIfNull(
62 ArgumentNullException.ThrowIfNull(
77 WarehouseReference destinationWarehouse =
78 ResolveDestinationWarehouse(
81 PurchaseDecision? decision =
82 solution.PurchaseDecisions
88 destinationWarehouse));
92 if (solution.PlanningHorizon <= 0)
94 throw new InvalidOperationException(
95 "The target lot-sizing solution must have a " +
96 "strictly positive planning horizon before " +
97 "purchase decisions are mapped.");
101 new PurchaseDecision(
104 destinationWarehouse,
105 solution.PlanningHorizon);
107 solution.AddPurchaseDecision(
111 decision.SetPurchasedQuantity(
113 variableValue.
Value);
116 private static WarehouseReference ResolveDestinationWarehouse(
119 bool hasStandaloneWarehouse =
122 out
int warehouseId);
124 bool hasPlantWarehouse =
129 if (hasStandaloneWarehouse ==
132 throw new InvalidOperationException(
133 "A procurement domain key must identify exactly " +
134 "one destination warehouse using either " +
135 "'destinationWarehouse' or 'destinationPlant'.");
138 if (hasStandaloneWarehouse)
140 return WarehouseReference
141 .ForStandaloneWarehouse(
145 return WarehouseReference
Stores the value returned by a solver for one mathematical decision variable.
double Value
Gets or sets the value returned by the solver.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Procurement
Identifies supplier-procurement decision variables.
Provides a reusable base implementation for mathematical decision mappers handling one domain-key cat...
Represents a parsed mathematical-model business-domain key.
int GetRequiredInt32(string name)
Gets a required integer segment.
bool TryGetInt32(string name, out int value)
Attempts to get an integer segment.
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 Supplier
Supplier identifier segment.
const string DestinationWarehouse
Standalone destination-warehouse identifier segment.
const string DestinationPlant
Destination-plant identifier segment.
const string Period
Period index segment.
Provides the shared state and lookup services required while mapping a mathematical solver result bac...
Maps mathematical procurement-variable values to purchase decisions in a lot-sizing solution.
override void MapValue(MathematicalSolutionMappingContext context, LotSizingSolution solution, MathematicalDomainKey domainKey, MathematicalVariableValue variableValue)
Maps one non-zero purchased quantity.
override string Category
Gets the mathematical domain-key category handled by this mapper.