3using LotSizingDataModel.Core.PhysicalModel;
4using LotSizingDataModel.Solution;
5using LotSizingDataModel.Solution.Decisions;
51 LotSizingSolution solution,
55 ArgumentNullException.ThrowIfNull(
58 ArgumentNullException.ThrowIfNull(
61 ArgumentNullException.ThrowIfNull(
64 ArgumentNullException.ThrowIfNull(
67 int distributionCenterId =
79 WarehouseReference warehouse =
83 DistributionDecision? decision =
84 solution.DistributionDecisions
94 if (solution.PlanningHorizon <= 0)
96 throw new InvalidOperationException(
97 "The target lot-sizing solution must have a " +
98 "strictly positive planning horizon before " +
99 "distribution decisions are mapped.");
103 new DistributionDecision(
104 distributionCenterId,
107 solution.PlanningHorizon);
109 solution.AddDistributionDecision(
113 decision.SetDeliveredQuantity(
115 variableValue.
Value);
118 private static WarehouseReference ResolveWarehouse(
121 bool hasStandaloneWarehouse =
124 out
int warehouseId);
126 bool hasPlantWarehouse =
131 if (hasStandaloneWarehouse ==
134 throw new InvalidOperationException(
135 "A delivery domain key must identify exactly one " +
136 "warehouse using either 'warehouse' or 'plant'.");
139 if (hasStandaloneWarehouse)
141 return WarehouseReference
142 .ForStandaloneWarehouse(
146 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.
Maps mathematical delivery-variable values to distribution decisions in a lot-sizing solution.
override string Category
Gets the mathematical domain-key category handled by this mapper.
override void MapValue(MathematicalSolutionMappingContext context, LotSizingSolution solution, MathematicalDomainKey domainKey, MathematicalVariableValue variableValue)
Maps one non-zero delivered quantity.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Delivery
Identifies delivered-quantity 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 Plant
Plant identifier segment.
const string DistributionCenter
Distribution-center identifier segment.
const string Item
Item or product identifier segment.
const string Period
Period index segment.
const string Warehouse
Warehouse identifier segment.
Provides the shared state and lookup services required while mapping a mathematical solver result bac...