LotSizingDataModel.Instance 2.0.1
Lot-sizing instance representation, descriptors and problem characterization.
Loading...
Searching...
No Matches
LotSizingInstance.Recommendation.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
4
6
7/// <summary>
8/// Extends <see cref="LotSizingInstance"/> with
9/// solution-method recommendation information.
10/// </summary>
11public sealed partial class LotSizingInstance
12{
14 _solutionMethodRecommendationReport =
15 new();
16
17 /// <summary>
18 /// Gets or sets the solution-method recommendation report
19 /// generated for this problem instance.
20 /// </summary>
21 /// <remarks>
22 /// The report records the evaluated methods, their
23 /// compatibility levels, their ranks and the supply-chain
24 /// fingerprint used during the evaluation.
25 ///
26 /// An empty report indicates that no recommendation has
27 /// yet been generated.
28 /// </remarks>
29 [XmlElement("solutionMethodRecommendationReport")]
32 {
33 get =>
34 _solutionMethodRecommendationReport;
35
36 set
37 {
39 normalizedValue =
40 value ??
42
43 if (SetProperty(
44 ref _solutionMethodRecommendationReport,
45 normalizedValue))
46 {
47 NotifySolutionMethodRecommendationProperties();
48 }
49 }
50 }
51
52 /// <summary>
53 /// Gets a value indicating whether a recommendation
54 /// report has been generated or contains recommendations.
55 /// </summary>
56 [XmlIgnore]
59 SolutionMethodRecommendationReport.HasRecommendations;
60
61 /// <summary>
62 /// Gets a value indicating whether at least one
63 /// solution-method recommendation is available.
64 /// </summary>
65 [XmlIgnore]
67 SolutionMethodRecommendationReport.HasRecommendations;
68
69 /// <summary>
70 /// Gets the number of solution-method recommendations
71 /// available for this instance.
72 /// </summary>
73 [XmlIgnore]
76 .RecommendationCount;
77
78 /// <summary>
79 /// Gets the number of methods marked as recommended.
80 /// </summary>
81 [XmlIgnore]
84 .RecommendedMethodCount;
85
86 /// <summary>
87 /// Gets a value indicating whether at least one method is
88 /// directly compatible with the complete problem.
89 /// </summary>
90 [XmlIgnore]
93 .HasDirectlyCompatibleMethod;
94
95 /// <summary>
96 /// Gets a value indicating whether at least one method is
97 /// directly applicable or applicable after adaptation.
98 /// </summary>
99 [XmlIgnore]
102 .HasApplicableMethod;
103
104 /// <summary>
105 /// Gets the best applicable solution-method
106 /// recommendation.
107 /// </summary>
108 [XmlIgnore]
112 .BestRecommendation;
113
114 /// <summary>
115 /// Gets a value indicating whether a best applicable
116 /// solution-method recommendation exists.
117 /// </summary>
118 [XmlIgnore]
121
122 /// <summary>
123 /// Replaces the complete solution-method recommendation
124 /// report.
125 /// </summary>
126 /// <param name="report">
127 /// New recommendation report.
128 /// </param>
129 /// <exception cref="ArgumentNullException">
130 /// Thrown when <paramref name="report"/> is
131 /// <see langword="null"/>.
132 /// </exception>
133 /// <exception cref="InvalidOperationException">
134 /// Thrown when the supplied report is invalid.
135 /// </exception>
138 {
139 ArgumentNullException.ThrowIfNull(
140 report);
141
142 report.EnsureValid();
143
145 report;
146 }
147
148 /// <summary>
149 /// Determines whether the recommendation report was
150 /// generated for the supplied supply-chain fingerprint.
151 /// </summary>
152 /// <param name="currentSupplyChainFingerprint">
153 /// Current supply-chain fingerprint.
154 /// </param>
155 /// <returns>
156 /// <see langword="true"/> when the report has been
157 /// generated and its fingerprint matches the supplied
158 /// fingerprint; otherwise, <see langword="false"/>.
159 /// </returns>
160 public bool
162 string currentSupplyChainFingerprint)
163 {
164 return
166 .HasBeenGenerated &&
168 .MatchesSupplyChainFingerprint(
169 currentSupplyChainFingerprint);
170 }
171
172 /// <summary>
173 /// Clears the complete solution-method recommendation
174 /// report.
175 /// </summary>
176 /// <remarks>
177 /// This method should be called whenever the supply-chain
178 /// data or the derived problem classification changes.
179 /// </remarks>
181 {
183 .ClearReport();
184
185 NotifySolutionMethodRecommendationProperties();
186 }
187
188 /// <summary>
189 /// Determines whether the recommendation report must be
190 /// serialized.
191 /// </summary>
192 /// <returns>
193 /// <see langword="true"/> when the report has been
194 /// generated or contains recommendations; otherwise,
195 /// <see langword="false"/>.
196 /// </returns>
197 /// <remarks>
198 /// This method follows the naming convention recognized
199 /// by <see cref="XmlSerializer"/>.
200 /// </remarks>
201 public bool
206
207 private void
208 NotifySolutionMethodRecommendationProperties()
209 {
210 OnPropertyChanged(
211 nameof(
213
214 OnPropertyChanged(
215 nameof(
217
218 OnPropertyChanged(
219 nameof(
221
222 OnPropertyChanged(
223 nameof(
225
226 OnPropertyChanged(
227 nameof(
229
230 OnPropertyChanged(
231 nameof(
233
234 OnPropertyChanged(
235 nameof(
237
238 OnPropertyChanged(
239 nameof(
241
242 OnPropertyChanged(
243 nameof(
245 }
246}
Adds explicit closed-loop return streams to a lot-sizing instance without changing the historical Sup...
bool ShouldSerializeSolutionMethodRecommendationReport()
Determines whether the recommendation report must be serialized.
int RecommendedSolutionMethodCount
Gets the number of methods marked as recommended.
int SolutionMethodRecommendationCount
Gets the number of solution-method recommendations available for this instance.
bool HasBestSolutionMethodRecommendation
Gets a value indicating whether a best applicable solution-method recommendation exists.
SolutionMethodRecommendationReport SolutionMethodRecommendationReport
Gets or sets the solution-method recommendation report generated for this problem instance.
void ClearSolutionMethodRecommendationReport()
Clears the complete solution-method recommendation report.
bool HasSolutionMethodRecommendationReport
Gets a value indicating whether a recommendation report has been generated or contains recommendation...
bool HasApplicableSolutionMethod
Gets a value indicating whether at least one method is directly applicable or applicable after adapta...
bool HasDirectlyCompatibleSolutionMethod
Gets a value indicating whether at least one method is directly compatible with the complete problem.
bool SolutionMethodRecommendationsMatchFingerprint(string currentSupplyChainFingerprint)
Determines whether the recommendation report was generated for the supplied supply-chain fingerprint.
void ReplaceSolutionMethodRecommendationReport(SolutionMethodRecommendationReport report)
Replaces the complete solution-method recommendation report.
SolutionMethodRecommendation? BestSolutionMethodRecommendation
Gets the best applicable solution-method recommendation.
bool HasSolutionMethodRecommendations
Gets a value indicating whether at least one solution-method recommendation is available.
Represents the evaluated compatibility of one solution method with a specific lot-sizing problem inst...
Stores the solution-method recommendations generated for one lot-sizing problem instance.
void EnsureValid()
Validates the report and throws an exception when at least one error is found.
bool HasBeenGenerated
Gets a value indicating whether this report has been generated.