6using LotSizingDataModel.Instance;
7using LotSizingDataModel.Instance.Results;
8using LotSizingDataModel.Solution;
9using LotSizingDataModel.Solver.Modeling;
43 throw new ArgumentNullException(nameof(checker));
47 throw new ArgumentNullException(nameof(applier));
60 LotSizingInstance instance,
61 LotSizingSolution solution,
63 CancellationToken cancellationToken =
default)
65 return VerifyCoreAsync(
69 mathematicalModel:
null,
70 CloneVerificationOptions(options),
87 LotSizingInstance instance,
88 LotSizingSolution solution,
89 MathematicalModel mathematicalModel,
91 CancellationToken cancellationToken =
default)
93 ArgumentNullException.ThrowIfNull(mathematicalModel);
95 return VerifyCoreAsync(
100 CloneVerificationOptions(options),
121 LotSizingInstance instance,
122 KnownResult knownResult,
124 CancellationToken cancellationToken =
default)
126 return VerifyKnownResultCoreAsync(
129 mathematicalModel:
null,
153 LotSizingInstance instance,
154 KnownResult knownResult,
155 MathematicalModel mathematicalModel,
157 CancellationToken cancellationToken =
default)
159 ArgumentNullException.ThrowIfNull(mathematicalModel);
161 return VerifyKnownResultCoreAsync(
169 private Task<LotSizingSolutionVerificationResult> VerifyKnownResultCoreAsync(
170 LotSizingInstance instance,
171 KnownResult knownResult,
172 MathematicalModel? mathematicalModel,
174 CancellationToken cancellationToken)
176 ArgumentNullException.ThrowIfNull(knownResult);
178 if (knownResult.DetailedSolution is
null)
180 throw new InvalidOperationException(
181 "The known result does not contain a detailed solution " +
182 "that can be independently checked.");
186 CloneVerificationOptions(options);
188 if (knownResult.ReportedObjectiveValue.HasValue)
190 effectiveOptions.CheckOptions.ReportedObjectiveValueOverride =
191 knownResult.ReportedObjectiveValue.Value;
194 return VerifyCoreAsync(
196 knownResult.DetailedSolution,
203 private async Task<LotSizingSolutionVerificationResult> VerifyCoreAsync(
204 LotSizingInstance instance,
205 LotSizingSolution solution,
206 KnownResult? knownResult,
207 MathematicalModel? mathematicalModel,
209 CancellationToken cancellationToken)
211 ArgumentNullException.ThrowIfNull(instance);
212 ArgumentNullException.ThrowIfNull(solution);
213 ArgumentNullException.ThrowIfNull(options);
218 mathematicalModel is
null
219 ? await _checker.CheckAsync(
224 .ConfigureAwait(
false)
225 : await _checker.CheckAsync(
231 .ConfigureAwait(
false);
233 cancellationToken.ThrowIfCancellationRequested();
235 DateTime evaluatedAtUtc =
246 return new LotSizingSolutionVerificationResult
255 private static SolutionVerificationOptions CloneVerificationOptions(
256 SolutionVerificationOptions? source)
259 new SolutionVerificationOptions();
263 return new SolutionVerificationOptions
267 ApplyToSolutionEvaluation =
269 UpdateKnownResultFeasibility =
271 PromoteFullyVerifiedKnownResult =
276 source.EvaluatorVersion
280 private static SolutionCheckOptions CloneCheckOptions(
281 SolutionCheckOptions source)
283 ArgumentNullException.ThrowIfNull(source);
285 return new SolutionCheckOptions
289 FeasibilityTolerance =
293 IntegralityTolerance =
295 ObjectiveAbsoluteTolerance =
297 ObjectiveRelativeTolerance =
299 ReportedObjectiveValueOverride =
301 IgnoreDisabledConstraints =
303 ContinueAfterStructuralErrors =
304 source.ContinueAfterStructuralErrors
double ObjectiveRelativeTolerance
Gets or sets the relative tolerance used when comparing objective values.
bool IgnoreDisabledConstraints
Gets or sets whether disabled mathematical constraints must be ignored.
double ZeroTolerance
Gets or sets the absolute tolerance used to identify numerical zero.
double FeasibilityTolerance
Gets or sets the absolute tolerance used for constraint feasibility.
double ObjectiveAbsoluteTolerance
Gets or sets the absolute tolerance used when comparing objective values.
SolutionCheckLevel Level
Gets or sets the requested checking depth.
double IntegralityTolerance
Gets or sets the tolerance used for integer and binary values.
double? ReportedObjectiveValueOverride
Gets or sets an optional externally reported objective value that takes precedence over the value sto...
Configures the high-level verification facade and the application of checker results back to domain o...
SolutionCheckOptions CheckOptions
Gets or sets the options used by the underlying solution checker.
bool UpdateKnownResultFeasibility
Gets or sets whether an explicitly supplied known result receives the independently established feasi...
bool ApplyToSolutionEvaluation
Gets or sets whether the computed checker result is written to LotSizingSolution.Evaluation.
string EvaluatorName
Gets or sets the evaluator name written to the solution evaluation.
bool PromoteFullyVerifiedKnownResult
Gets or sets whether a known result is promoted to AutomaticallyVerified when a complete Full check s...
void EnsureValid()
Validates this configuration.
Task< LotSizingSolutionVerificationResult > VerifyAsync(LotSizingInstance instance, LotSizingSolution solution, MathematicalModel mathematicalModel, SolutionVerificationOptions? options=null, CancellationToken cancellationToken=default)
Checks a standalone candidate solution while reusing a mathematical model already built for the same ...
Task< LotSizingSolutionVerificationResult > VerifyKnownResultAsync(LotSizingInstance instance, KnownResult knownResult, SolutionVerificationOptions? options=null, CancellationToken cancellationToken=default)
Checks the detailed solution attached to a known result and optionally updates both the detailed solu...
Task< LotSizingSolutionVerificationResult > VerifyKnownResultAsync(LotSizingInstance instance, KnownResult knownResult, MathematicalModel mathematicalModel, SolutionVerificationOptions? options=null, CancellationToken cancellationToken=default)
Checks the detailed solution attached to a known result while reusing a mathematical model already bu...
Task< LotSizingSolutionVerificationResult > VerifyAsync(LotSizingInstance instance, LotSizingSolution solution, SolutionVerificationOptions? options=null, CancellationToken cancellationToken=default)
Checks a standalone candidate solution and optionally writes the resulting evaluation into the candid...
LotSizingSolutionVerificationService(ILotSizingSolutionChecker checker, ISolutionCheckResultApplier applier)
Initializes the facade with explicit dependencies.
LotSizingSolutionVerificationService()
Initializes the facade with the standard checker and result applier.
Describes which domain objects were changed while applying a checker result.
Applies independent checker results back to the serializable solution evaluation and to an optional k...
Orchestrates the complete, solver-independent validation of a LotSizingSolution against a LotSizingIn...
Contains the complete result of checking one lot-sizing solution.
Defines a generic, solver-independent checker for lot-sizing solutions.
Applies a solver-independent checker result to the serializable solution evaluation and,...