LotSizingDataModel.Checker 2.0.1
Reusable validation engine for structural, mathematical and objective consistency checks.
Loading...
Searching...
No Matches
ScientificSolverRequestFactory.cs
Go to the documentation of this file.
1using LotSizingDataModel.Solver.Execution;
2
4
5/// <summary>
6/// Creates the delegated technical solver request while preserving the caller's
7/// original request object.
8/// </summary>
9internal static class ScientificSolverRequestFactory
10{
11 public static SolverRequest CreateDelegated(
12 SolverRequest source,
13 string formulationId)
14 {
15 ArgumentNullException.ThrowIfNull(source);
16
17 if (string.IsNullOrWhiteSpace(formulationId))
18 {
19 throw new ArgumentException(
20 "A scientifically selected formulation identifier is required.",
21 nameof(formulationId));
22 }
23
24 source.EnsureValid();
25
26 var delegated =
27 new SolverRequest(source.Instance!)
28 {
29 PreferredSolver =
30 source.PreferredSolver,
31
32 FormulationName =
33 formulationId.Trim(),
34
35 RunName =
36 source.RunName ?? string.Empty,
37
38 // The scientific wrapper never mutates solver parameters.
39 // Reusing the same validated parameter object avoids an
40 // incomplete hand-written pseudo-clone of native settings.
41 Parameters =
42 source.Parameters
43 };
44
45 foreach (
46 var observer
47 in source.ProgressObservers)
48 {
49 delegated.AddProgressObserver(observer);
50 }
51
52 delegated.EnsureValid();
53
54 return delegated;
55 }
56}
Creates the delegated technical solver request while preserving the caller's original request object.
static SolverRequest CreateDelegated(SolverRequest source, string formulationId)