24 if (!
double.IsFinite(running))
26 throw new ArithmeticException(
27 "Cumulative demand overflowed.");
38 double[] cumulativeDemand,
44 last >= cumulativeDemand.Length)
46 throw new ArgumentOutOfRangeException();
49 return cumulativeDemand[last] -
52 : cumulativeDemand[first - 1]);
56 IReadOnlyDictionary<int, int> semanticMap,
58 IReadOnlyDictionary<int, double> values,
61 if (!semanticMap.TryGetValue(
65 throw new InvalidOperationException(
66 $
"The formulation has no {family} variable for period {period}.");
69 if (!values.TryGetValue(
72 !
double.IsFinite(value))
74 throw new InvalidOperationException(
75 $
"No finite LP value exists for {family}[{period}].");
83 IReadOnlyDictionary<int, int> semanticMap,
87 if (!semanticMap.TryGetValue(
91 throw new InvalidOperationException(
92 $
"The formulation has no {family} variable for period {period}.");
95 return formulation.Model
96 .GetVariable(variableId)
102 IEnumerable<CutCoefficient> coefficients)
104 double squaredNorm = 0.0;
109 coefficient.Coefficient *
113 return squaredNorm > 0.0
115 Math.Sqrt(squaredNorm)
123 period < problem.Horizon - 1;
140 if (left + 1.0e-12 * scale <
156 throw new ArgumentException(
157 "An (l,S) separator requires aggregate production and setup " +
158 "variable mappings.",
159 nameof(formulation));
static double[] BuildCumulativeDemand(UlsProblem problem)
static void RequireAggregateVariables(UlsFormulation formulation)
static string GetVariableName(UlsFormulation formulation, IReadOnlyDictionary< int, int > semanticMap, int period, string family)
static double GetSemanticValue(IReadOnlyDictionary< int, int > semanticMap, int period, IReadOnlyDictionary< int, double > values, string family)
static double Efficacy(double violation, IEnumerable< CutCoefficient > coefficients)
static bool HasWagnerWhitinCosts(UlsProblem problem)
static double IntervalDemand(double[] cumulativeDemand, int first, int last)
Represents a validated classical uncapacitated lot-sizing problem.
ReadOnlySpan< double > UnitProductionCosts
Gets unit production costs by period.
int Horizon
Gets the number of planning periods.
ReadOnlySpan< double > HoldingCosts
Gets end-of-period unit holding costs by period.
ReadOnlySpan< double > Demands
Gets demand by period.
Stores one nonzero coefficient of a generated linear inequality.
double Coefficient
Gets the coefficient value.