LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
StandardLotSizingIntegrationCheck.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4using LotSizingDataModel.Instance;
9
11
12/// <summary>
13/// Executes the complete standard lot-sizing workflow against an
14/// existing instance.
15/// </summary>
16/// <remarks>
17/// This helper is intended for integration validation. It checks
18/// the same path used by an application:
19/// formulation registration, solver discovery, adapter loading,
20/// mathematical-model construction, native optimization, and
21/// normalized solution mapping.
22/// </remarks>
24{
25 /// <summary>
26 /// Runs the integration check with default formulation,
27 /// discovery, and solver parameters.
28 /// </summary>
29 /// <param name="instance">
30 /// Lot-sizing instance to solve.
31 /// </param>
32 /// <param name="preferredSolver">
33 /// Preferred solver. The default is automatic selection.
34 /// </param>
35 /// <param name="cancellationToken">
36 /// Cancellation token.
37 /// </param>
38 /// <returns>
39 /// Complete integration-check result.
40 /// </returns>
41 public static ValueTask<StandardLotSizingIntegrationCheckResult>
43 LotSizingInstance instance,
44 SolverKind preferredSolver = SolverKind.Automatic,
45 CancellationToken cancellationToken = default)
46 {
47 return RunAsync(
48 instance,
51 new SolverParameters(),
52 preferredSolver,
53 cancellationToken);
54 }
55
56 /// <summary>
57 /// Runs the integration check with explicit configuration.
58 /// </summary>
59 /// <param name="instance">
60 /// Lot-sizing instance to solve.
61 /// </param>
62 /// <param name="formulationOptions">
63 /// Standard formulation options.
64 /// </param>
65 /// <param name="discoveryOptions">
66 /// Solver discovery options.
67 /// </param>
68 /// <param name="solverParameters">
69 /// Normalized solver parameters.
70 /// </param>
71 /// <param name="preferredSolver">
72 /// Preferred solver.
73 /// </param>
74 /// <param name="cancellationToken">
75 /// Cancellation token.
76 /// </param>
77 /// <returns>
78 /// Complete integration-check result.
79 /// </returns>
80 public static async ValueTask<StandardLotSizingIntegrationCheckResult>
82 LotSizingInstance instance,
83 StandardLotSizingFormulationOptions formulationOptions,
84 SolverDiscoveryOptions discoveryOptions,
85 SolverParameters solverParameters,
86 SolverKind preferredSolver,
87 CancellationToken cancellationToken = default)
88 {
89 ArgumentNullException.ThrowIfNull(instance);
90 ArgumentNullException.ThrowIfNull(formulationOptions);
91 ArgumentNullException.ThrowIfNull(discoveryOptions);
92 ArgumentNullException.ThrowIfNull(solverParameters);
93
96 formulationOptions,
97 discoveryOptions,
98 cancellationToken);
99
100 if (!bootstrap.CanSolve ||
101 bootstrap.SolverService is null)
102 {
104 bootstrap,
105 null);
106 }
107
108 var request =
109 new SolverRequest(instance)
110 {
111 PreferredSolver = preferredSolver,
112 FormulationName = "standard",
113 RunName = "Standard lot-sizing integration check",
114 Parameters = solverParameters
115 };
116
117 SolverRunResult runResult =
118 await bootstrap.SolverService.SolveAsync(
119 request,
120 cancellationToken);
121
123 bootstrap,
124 runResult);
125 }
126}
Defines solver-independent parameters for an optimization run.
Configures how solver adapter plugins and native solver installations are discovered on the current c...
async ValueTask< SolverRunResult > SolveAsync(SolverRequest request, CancellationToken cancellationToken=default)
Solves a complete lot-sizing instance.
Describes a request to solve a lot-sizing instance.
Represents the normalized result of a solver execution.
Executes the complete standard lot-sizing workflow against an existing instance.
static ValueTask< StandardLotSizingIntegrationCheckResult > RunAsync(LotSizingInstance instance, SolverKind preferredSolver=SolverKind.Automatic, CancellationToken cancellationToken=default)
Runs the integration check with default formulation, discovery, and solver parameters.
static async ValueTask< StandardLotSizingIntegrationCheckResult > RunAsync(LotSizingInstance instance, StandardLotSizingFormulationOptions formulationOptions, SolverDiscoveryOptions discoveryOptions, SolverParameters solverParameters, SolverKind preferredSolver, CancellationToken cancellationToken=default)
Runs the integration check with explicit configuration.
Represents the result of a complete standard lot-sizing integration check.
Represents the complete initialization result for the standard lot-sizing solver infrastructure.
bool CanSolve
Gets a value indicating whether at least one discovered solver can currently solve mathematical model...
LotSizingSolverService? SolverService
Gets the initialized high-level solver service, or null when initialization did not produce a service...
Provides one-step initialization of the standard lot-sizing formulation together with solver discover...
static ValueTask< StandardLotSizingSolverBootstrapResult > InitializeAsync(CancellationToken cancellationToken=default)
Initializes the standard formulation and discovers available solver adapters using default options.
Configures the standard solver-independent mixed-integer lot-sizing formulation.
SolverKind
Identifies a supported mathematical optimization solver.
Definition SolverKind.cs:12