45 DateTime startedAtUtc,
48 ArgumentNullException.ThrowIfNull(
51 ArgumentNullException.ThrowIfNull(
54 if (elapsed < TimeSpan.Zero)
56 throw new ArgumentOutOfRangeException(
59 "The total solve duration cannot be negative.");
62 DateTime normalizedStartedAtUtc =
70 solveResult.RunName ??
string.Empty,
76 solveResult.SolverName ??
string.Empty,
79 solveResult.SolverVersion ??
string.Empty,
82 solveResult.FormulationId ??
string.Empty,
85 normalizedStartedAtUtc,
88 normalizedStartedAtUtc + elapsed,
115 solveResult.HasFeasibleSolution
120 mappingResult.IsSuccessful
121 ? mappingResult.Solution
125 result.AddDiagnostics(
128 result.AddDiagnostics(
134 private static DateTime NormalizeUtc(
137 return value.Kind
switch
142 DateTimeKind.Local =>
143 value.ToUniversalTime(),
146 DateTime.SpecifyKind(
152 private static void AddDiagnostics(
153 this SolverRunResult target,
154 MathematicalModelSolveResult source)
158 in source.Diagnostics)
160 if (!
string.IsNullOrWhiteSpace(
163 target.AddDiagnostic(
169 private static void AddDiagnostics(
170 this SolverRunResult target,
171 MathematicalSolutionMappingResult source)
177 if (!
string.IsNullOrWhiteSpace(
180 target.AddDiagnostic(
186 !
string.IsNullOrWhiteSpace(
189 bool alreadyPresent =
195 StringComparison.Ordinal));
199 target.AddDiagnostic(
Stores the solver result for a solver-independent mathematical model.
double? RelativeGap
Gets or sets the relative optimality gap.
double? ObjectiveValue
Gets or sets the objective value.
SolverTerminationReason TerminationReason
Gets or sets the termination reason.
long? IterationCount
Gets or sets the number of simplex or barrier iterations, when available.
long? ExploredNodeCount
Gets or sets the number of explored branch-and-bound nodes, when available.
SolverKind SolverKind
Gets or sets the solver kind.
double? BestBound
Gets or sets the best objective bound.
double? AbsoluteGap
Gets or sets the absolute optimality gap.
Creates the public solver-run result from the generic mathematical-model result and the normalized so...
static SolverRunResult Create(MathematicalModelSolveResult solveResult, MathematicalSolutionMappingResult mappingResult, DateTime startedAtUtc, TimeSpan elapsed)
Creates a normalized solver-run result.
Represents the normalized result of a solver execution.
Describes the result of mapping a mathematical solver result back to a normalized lot-sizing solution...
bool IsSuccessful
Gets or sets a value indicating whether mapping succeeded.
List< string > Diagnostics
Gets the mapping diagnostics.
string FailureMessage
Gets or sets the mapping failure message.