LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
ScientificSolutionMethodDefinition.cs
Go to the documentation of this file.
1using LotSizingDataModel.Instance.ProblemClasses;
2
4
5/// <summary>
6/// One scientific solution-method definition.
7/// </summary>
9{
11 string methodId,
12 string name,
15 IEnumerable<CanonicalLotSizingProblemClassId>
16 applicableProblemClasses,
17 bool requiresMathematicalFormulation,
18 bool requiresMilpBackend,
19 IEnumerable<string>? evidence = null,
20 string? note = null)
21 {
22 if (string.IsNullOrWhiteSpace(methodId))
23 {
24 throw new ArgumentException(
25 "A solution-method identifier is required.",
26 nameof(methodId));
27 }
28
29 if (string.IsNullOrWhiteSpace(name))
30 {
31 throw new ArgumentException(
32 "A solution-method name is required.",
33 nameof(name));
34 }
35
36 ArgumentNullException.ThrowIfNull(applicableProblemClasses);
37
38 MethodId = methodId.Trim();
39 Name = name.Trim();
40 Category = category;
41 SupportLevel = supportLevel;
43 requiresMathematicalFormulation;
45 requiresMilpBackend;
46
48 applicableProblemClasses
49 .Distinct()
50 .OrderBy(value => (int)value)
51 .ToArray();
52
53 Evidence =
54 (evidence ?? Array.Empty<string>())
55 .Where(value => !string.IsNullOrWhiteSpace(value))
56 .Select(value => value.Trim())
57 .Distinct(StringComparer.Ordinal)
58 .ToArray();
59
60 Note = note ?? string.Empty;
61 }
62
63 public string MethodId { get; }
64 public string Name { get; }
67
68 public IReadOnlyList<CanonicalLotSizingProblemClassId>
70
72 public bool RequiresMilpBackend { get; }
73 public IReadOnlyList<string> Evidence { get; }
74 public string Note { get; }
75
76 public bool IsApplicableTo(
77 CanonicalLotSizingProblemClassId problemClass) =>
78 ApplicableProblemClasses.Contains(problemClass);
79
80 public override string ToString() =>
81 $"{MethodId} — {Name}";
82}
ScientificSolutionMethodDefinition(string methodId, string name, ScientificSolutionMethodCategory category, ScientificSolutionMethodSupportLevel supportLevel, IEnumerable< CanonicalLotSizingProblemClassId > applicableProblemClasses, bool requiresMathematicalFormulation, bool requiresMilpBackend, IEnumerable< string >? evidence=null, string? note=null)
ScientificSolutionMethodSupportLevel
Current implementation support of one scientific solution-method family.
ScientificSolutionMethodCategory
Orthogonal algorithmic solution-method categories.