15 LotSizingInstance instance,
18 ArgumentNullException.ThrowIfNull(instance);
19 ArgumentNullException.ThrowIfNull(context);
21 OptimizationObjectivePolicy? policy =
22 instance.SupplyChain.ObjectivePolicy;
29 OptimizationObjectiveKind.Economic,
37 if (policy.AggregationMode ==
38 ObjectiveAggregationMode.Single)
43 policy.PrimaryObjectiveKind,
51 if (policy.AggregationMode is not
52 ObjectiveAggregationMode.WeightedSum and not
53 ObjectiveAggregationMode.Lexicographic)
55 throw new NotSupportedException(
56 $
"Objective aggregation mode '{policy.AggregationMode}' is not executable.");
59 if (!policy.HasExecutableCriterionSpecifications)
61 throw new InvalidOperationException(
62 "WeightedSum/Lexicographic execution requires explicit ExecutionCriteria.");
65 if (!policy.HasUniqueExecutableCriterionKinds)
67 throw new InvalidOperationException(
68 "Executable objective criterion kinds must be unique.");
71 if (policy.AggregationMode ==
72 ObjectiveAggregationMode.Lexicographic &&
73 !policy.HasUniqueLexicographicPriorities)
75 throw new InvalidOperationException(
76 "Lexicographic objective priorities must be unique.");
79 IEnumerable<ObjectiveCriterionExecutionSpecification>
81 policy.ExecutionCriteria;
83 if (policy.AggregationMode ==
84 ObjectiveAggregationMode.Lexicographic)
90 specification.Priority);
99 specification.Priority,
100 specification.AbsoluteTolerance,
155 ArgumentNullException.ThrowIfNull(context);
156 ArgumentNullException.ThrowIfNull(criterion);
157 ArgumentNullException.ThrowIfNull(preserved);
162 int nextConstraintId =
163 model.Constraints.Count == 0
165 : model.
Constraints.Max(constraint => constraint.Id) + 1;
167 foreach (var previous
in preserved)
170 previous.Criterion.Expression.
Clone();
174 previous.Criterion.AbsoluteTolerance -
177 expression.Constant = 0.0;
182 $
"lexicographicPreserve_{previous.Criterion.Kind}",
188 "Preserves an already optimized lexicographic criterion."
194 $
"lexicographic_{criterion.Kind}",
199 "One exact lexicographic optimization stage."