LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
LotSizingSolverBootstrapper.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
6
8
9/// <summary>
10/// Initializes the complete lot-sizing solver infrastructure by
11/// discovering solver plugins, building the solver runtime, and
12/// creating the high-level solver service.
13/// </summary>
14public static class LotSizingSolverBootstrapper
15{
16 /// <summary>
17 /// Initializes the complete solver infrastructure using
18 /// default solver-discovery options.
19 /// </summary>
20 /// <param name="formulationRegistry">
21 /// Registry containing the mathematical formulations
22 /// available to the application.
23 /// </param>
24 /// <param name="cancellationToken">
25 /// Token used to cancel solver discovery and adapter
26 /// loading.
27 /// </param>
28 /// <returns>
29 /// Result containing the runtime-build information and, when
30 /// initialization succeeds, the high-level solver service.
31 /// </returns>
32 /// <exception cref="ArgumentNullException">
33 /// Thrown when <paramref name="formulationRegistry"/> is
34 /// <see langword="null"/>.
35 /// </exception>
36 public static ValueTask<LotSizingSolverBootstrapResult>
38 MathematicalModelFormulationRegistry formulationRegistry,
39 CancellationToken cancellationToken = default)
40 {
41 ArgumentNullException.ThrowIfNull(
42 formulationRegistry);
43
44 return InitializeAsync(
45 formulationRegistry,
47 cancellationToken);
48 }
49
50 /// <summary>
51 /// Initializes the complete solver infrastructure using the
52 /// supplied solver-discovery options.
53 /// </summary>
54 /// <param name="formulationRegistry">
55 /// Registry containing the mathematical formulations
56 /// available to the application.
57 /// </param>
58 /// <param name="discoveryOptions">
59 /// Solver-discovery options.
60 /// </param>
61 /// <param name="cancellationToken">
62 /// Token used to cancel solver discovery and adapter
63 /// loading.
64 /// </param>
65 /// <returns>
66 /// Result containing the runtime-build information and, when
67 /// initialization succeeds, the high-level solver service.
68 /// </returns>
69 /// <exception cref="ArgumentNullException">
70 /// Thrown when <paramref name="formulationRegistry"/> or
71 /// <paramref name="discoveryOptions"/> is
72 /// <see langword="null"/>.
73 /// </exception>
74 public static async ValueTask<LotSizingSolverBootstrapResult>
76 MathematicalModelFormulationRegistry formulationRegistry,
77 SolverDiscoveryOptions discoveryOptions,
78 CancellationToken cancellationToken = default)
79 {
80 ArgumentNullException.ThrowIfNull(
81 formulationRegistry);
82
83 ArgumentNullException.ThrowIfNull(
84 discoveryOptions);
85
86 SolverRuntimeBuildResult runtimeBuildResult =
88 discoveryOptions,
89 cancellationToken);
90
91 if (runtimeBuildResult.RuntimeContext is null)
92 {
94 runtimeBuildResult,
95 null);
96 }
97
98 LotSizingSolverService solverService =
100 formulationRegistry,
101 runtimeBuildResult.RuntimeContext);
102
104 runtimeBuildResult,
105 solverService);
106 }
107}
Configures how solver adapter plugins and native solver installations are discovered on the current c...
Represents the result of building the solver runtime from discovery information and dynamically loade...
SolverRuntimeContext? RuntimeContext
Gets or sets the runtime context created from the discovered and loaded solver infrastructure.
Provides convenient factory methods for constructing the default solver runtime without exposing the ...
static ValueTask< SolverRuntimeBuildResult > BuildAsync(SolverDiscoveryOptions options, CancellationToken cancellationToken=default)
Builds the default solver runtime using standard discovery and adapter-loading services.
Represents the result of initializing the complete lot-sizing solver infrastructure.
Initializes the complete lot-sizing solver infrastructure by discovering solver plugins,...
static ValueTask< LotSizingSolverBootstrapResult > InitializeAsync(MathematicalModelFormulationRegistry formulationRegistry, CancellationToken cancellationToken=default)
Initializes the complete solver infrastructure using default solver-discovery options.
static async ValueTask< LotSizingSolverBootstrapResult > InitializeAsync(MathematicalModelFormulationRegistry formulationRegistry, SolverDiscoveryOptions discoveryOptions, CancellationToken cancellationToken=default)
Initializes the complete solver infrastructure using the supplied solver-discovery options.
Provides convenient factory methods for creating the high-level lot-sizing solver service from a prep...
static LotSizingSolverService Create(MathematicalModelFormulationRegistry formulationRegistry, SolverRuntimeContext runtimeContext)
Creates the high-level solver service using the supplied formulation registry and solver runtime cont...
Orchestrates the complete solution of a lot-sizing instance, from formulation selection to normalized...