LotSizingDataModel.Instance 2.0.1
Lot-sizing instance representation, descriptors and problem characterization.
Loading...
Searching...
No Matches
BenchmarkBestKnownResultSelectionService.cs
Go to the documentation of this file.
2
4
5/// <summary>
6/// Selects an eligible benchmark reference objective from
7/// native KnownResult records.
8/// </summary>
10{
12 _auditService =
13 new();
14
16 IEnumerable<KnownResult> results,
18 bool allowReproduced = false,
19 bool requireSourceEvidence = true)
20 {
21 ArgumentNullException.ThrowIfNull(
22 results);
23
24 if (!Enum.IsDefined(
26 direction))
27 {
28 throw new ArgumentOutOfRangeException(
29 nameof(direction));
30 }
31
32 KnownResult[] normalized =
33 results.ToArray();
34
35 var audits =
36 normalized.ToDictionary(
37 result =>
38 result.ResultId,
39 result =>
40 _auditService.Audit(
41 result,
42 allowReproduced,
43 requireSourceEvidence),
44 StringComparer.Ordinal);
45
46 IEnumerable<KnownResult> eligible =
47 normalized.Where(
48 result =>
49 audits[result.ResultId]
50 .IsReferenceEligible);
51
52 KnownResult? selected =
53 direction ==
55 ? eligible
56 .OrderBy(
57 result =>
58 result.ReportedObjectiveValue!.Value)
59 .ThenBy(
60 result =>
61 result.ResultId,
62 StringComparer.Ordinal)
63 .FirstOrDefault()
64 : eligible
65 .OrderByDescending(
66 result =>
67 result.ReportedObjectiveValue!.Value)
68 .ThenBy(
69 result =>
70 result.ResultId,
71 StringComparer.Ordinal)
72 .FirstOrDefault();
73
75 selected,
76 audits.Values
77 .OrderBy(
78 audit =>
79 audit.ResultId,
80 StringComparer.Ordinal)
81 .ToArray());
82 }
83}
Selects an eligible benchmark reference objective from native KnownResult records.
BenchmarkBestKnownResultSelection Select(IEnumerable< KnownResult > results, BenchmarkObjectiveDirection direction, bool allowReproduced=false, bool requireSourceEvidence=true)
Audits native KnownResult metadata for benchmark/BKS use. No parallel verification-status enum is int...
Represents a known result associated with a lot-sizing problem instance.