LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
SolverRuntimeFactory.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
6
7/// <summary>
8/// Provides convenient factory methods for constructing the
9/// default solver runtime without exposing the discovery and
10/// adapter-loading implementation details to application code.
11/// </summary>
12public static class SolverRuntimeFactory
13{
14 /// <summary>
15 /// Builds the default solver runtime using standard
16 /// discovery and adapter-loading services.
17 /// </summary>
18 /// <param name="options">
19 /// Solver discovery options.
20 /// </param>
21 /// <param name="cancellationToken">
22 /// Token used to cancel solver discovery and adapter
23 /// loading.
24 /// </param>
25 /// <returns>
26 /// Complete solver-runtime build result.
27 /// </returns>
28 /// <exception cref="ArgumentNullException">
29 /// Thrown when <paramref name="options"/> is
30 /// <see langword="null"/>.
31 /// </exception>
32 public static ValueTask<SolverRuntimeBuildResult> BuildAsync(
34 CancellationToken cancellationToken = default)
35 {
36 ArgumentNullException.ThrowIfNull(
37 options);
38
39 var discoveryService =
41
42 var runtimeBuilder =
44 discoveryService);
45
46 return runtimeBuilder.BuildAsync(
47 options,
48 cancellationToken);
49 }
50
51 /// <summary>
52 /// Builds the default solver runtime using default discovery
53 /// options.
54 /// </summary>
55 /// <param name="cancellationToken">
56 /// Token used to cancel solver discovery and adapter
57 /// loading.
58 /// </param>
59 /// <returns>
60 /// Complete solver-runtime build result.
61 /// </returns>
62 public static ValueTask<SolverRuntimeBuildResult>
64 CancellationToken cancellationToken = default)
65 {
66 return BuildAsync(
68 cancellationToken);
69 }
70}
Provides the default solver discovery implementation used by the generic solver infrastructure.
Configures how solver adapter plugins and native solver installations are discovered on the current c...
Discovers solver infrastructure, loads adapter plugins, and validates loaded adapters against their n...
Provides convenient factory methods for constructing the default solver runtime without exposing the ...
static ValueTask< SolverRuntimeBuildResult > BuildDefaultAsync(CancellationToken cancellationToken=default)
Builds the default solver runtime using default discovery options.
static ValueTask< SolverRuntimeBuildResult > BuildAsync(SolverDiscoveryOptions options, CancellationToken cancellationToken=default)
Builds the default solver runtime using standard discovery and adapter-loading services.