2using System.Collections.Generic;
4using System.Xml.Serialization;
5using LotSizingDataModel.Core.Common;
18[XmlType(TypeName =
"solutionGenerationMetadata")]
27 private string _methodName =
string.Empty;
28 private string _methodVersion =
string.Empty;
29 private string _implementationName =
string.Empty;
30 private string _implementationVersion =
string.Empty;
31 private string _comment =
string.Empty;
33 private DateTime _createdAtUtc =
36 private double? _durationSeconds;
37 private int? _randomSeed;
38 private long? _iterationCount;
39 private long? _evaluationCount;
40 private bool? _isDeterministic;
75 [XmlAttribute(
"methodKind")]
87 [XmlAttribute(
"terminationReason")]
90 get => _terminationReason;
92 ref _terminationReason,
104 [XmlAttribute(
"methodName")]
110 value?.Trim() ??
string.Empty);
117 [XmlAttribute(
"methodVersion")]
120 get => _methodVersion;
123 value?.Trim() ??
string.Empty);
134 [XmlAttribute(
"implementationName")]
137 get => _implementationName;
139 ref _implementationName,
140 value?.Trim() ??
string.Empty);
146 [XmlAttribute(
"implementationVersion")]
149 get => _implementationVersion;
151 ref _implementationVersion,
152 value?.Trim() ??
string.Empty);
159 [XmlElement(
"createdAtUtc")]
162 get => _createdAtUtc;
168 DateTimeKind.Utc => value,
170 DateTimeKind.Local =>
171 value.ToUniversalTime(),
173 _ => DateTime.SpecifyKind(
190 [XmlElement(
"durationSeconds", IsNullable =
true)]
193 get => _durationSeconds;
196 if (value.HasValue &&
197 (!
double.IsFinite(value.Value) ||
200 throw new ArgumentOutOfRangeException(
203 "The execution duration must be finite " +
204 "and non-negative.");
208 ref _durationSeconds,
220 [XmlElement(
"randomSeed", IsNullable =
true)]
237 [XmlElement(
"iterationCount", IsNullable =
true)]
240 get => _iterationCount;
245 throw new ArgumentOutOfRangeException(
248 "The iteration count cannot be negative.");
265 [XmlElement(
"evaluationCount", IsNullable =
true)]
268 get => _evaluationCount;
273 throw new ArgumentOutOfRangeException(
276 "The evaluation count cannot be negative.");
280 ref _evaluationCount,
293 [XmlElement(
"isDeterministic", IsNullable =
true)]
296 get => _isDeterministic;
298 ref _isDeterministic,
306 [XmlElement(
"comment")]
312 value ??
string.Empty);
319 [XmlArray(
"parameters")]
320 [XmlArrayItem(
"parameter")]
330 Parameters.Count > 0;
347 ArgumentNullException.ThrowIfNull(parameter);
354 StringComparison.OrdinalIgnoreCase)))
356 throw new InvalidOperationException(
357 $
"An algorithm parameter named " +
358 $
"'{parameter.Name}' already exists.");
379 ArgumentNullException.ThrowIfNull(parameter);
387 StringComparison.OrdinalIgnoreCase));
417 ArgumentException.ThrowIfNullOrWhiteSpace(name);
424 StringComparison.OrdinalIgnoreCase));
439 ArgumentException.ThrowIfNullOrWhiteSpace(name);
444 if (parameter is
null)
492 $
"{name} — {TerminationReason}";
Represents one named parameter used by a solution-generation method.
string Name
Gets or sets the parameter name.
SolutionMethodKind
Identifies the general type of method used to generate a lot-sizing solution.