3using LotSizingDataModel.Core.PhysicalModel;
4using LotSizingDataModel.Solution;
5using LotSizingDataModel.Solution.Decisions;
50 LotSizingSolution solution,
54 ArgumentNullException.ThrowIfNull(
57 ArgumentNullException.ThrowIfNull(
60 ArgumentNullException.ThrowIfNull(
63 ArgumentNullException.ThrowIfNull(
70 int transportResourceId =
78 WarehouseReference origin =
85 WarehouseReference destination =
92 TransportDecision? decision =
93 solution.TransportDecisions
102 if (decision is
null)
104 if (solution.PlanningHorizon <= 0)
106 throw new InvalidOperationException(
107 "The target lot-sizing solution must have a " +
108 "strictly positive planning horizon before " +
109 "transport decisions are mapped.");
113 new TransportDecision(
118 solution.PlanningHorizon);
120 solution.AddTransportDecision(
124 decision.SetSetupActivated(
126 variableValue.
Value >
130 private static WarehouseReference ResolveWarehouse(
132 string warehouseSegment,
136 bool hasStandaloneWarehouse =
139 out
int warehouseId);
141 bool hasPlantWarehouse =
146 if (hasStandaloneWarehouse ==
149 throw new InvalidOperationException(
150 $
"A transport-setup domain key must identify " +
151 $
"exactly one {role} warehouse using either " +
152 $
"'{warehouseSegment}' or '{plantSegment}'.");
155 if (hasStandaloneWarehouse)
157 return WarehouseReference
158 .ForStandaloneWarehouse(
162 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 TransportSetup
Identifies transport setup decision variables.
Provides a reusable base implementation for mathematical decision mappers handling one domain-key cat...
virtual double ZeroTolerance
Gets the absolute tolerance below which a solver value is considered equal to zero.
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 TransportResource
Transport-resource identifier segment.
const string Item
Item or product identifier segment.
const string DestinationWarehouse
Standalone destination-warehouse identifier segment.
const string OriginPlant
Origin-plant identifier segment.
const string DestinationPlant
Destination-plant identifier segment.
const string Period
Period index segment.
const string OriginWarehouse
Standalone origin-warehouse identifier segment.
Provides the shared state and lookup services required while mapping a mathematical solver result bac...
Maps mathematical item-specific transport setup values to transport decisions in a lot-sizing solutio...
override void MapValue(MathematicalSolutionMappingContext context, LotSizingSolution solution, MathematicalDomainKey domainKey, MathematicalVariableValue variableValue)
Maps one non-zero transport setup value.
override string Category
Gets the mathematical domain-key category handled by this mapper.