2using System.Collections.Generic;
5using System.Threading.Tasks;
40 private readonly IReadOnlyCollection<SolverCapability>
59 IEnumerable<SolverCapability> capabilities)
61 ArgumentNullException.ThrowIfNull(
69 if (normalizedCapabilities.Contains(
72 throw new InvalidOperationException(
73 "A solver plugin cannot declare the Unknown " +
79 normalizedCapabilities);
85 public event EventHandler<SolverProgressEventArgs>?
140 return _capabilities.Contains(
154 public abstract ValueTask<SolverAvailabilityInfo>
156 CancellationToken cancellationToken =
default);
185 CancellationToken cancellationToken)
187 ArgumentNullException.ThrowIfNull(
190 throw new NotSupportedException(
191 $
"Adapter '{AdapterName}' executes already-built " +
192 "mathematical models. Use LotSizingSolverService " +
193 "for complete lot-sizing-instance orchestration.");
215 CancellationToken cancellationToken =
default)
217 ArgumentNullException.ThrowIfNull(
220 ArgumentNullException.ThrowIfNull(
232 cancellationToken.ThrowIfCancellationRequested();
Provides common execution-state and cancellation handling for solver adapters that solve solver-indep...
bool SupportsCapability(SolverCapability capability)
Gets a value indicating whether the plugin supports the specified capability.
MathematicalModelSolverPluginBase(IEnumerable< SolverCapability > capabilities)
Initializes the plugin base with its declared capabilities.
EventHandler< SolverProgressEventArgs >? ProgressChanged
Occurs when a new solver progress snapshot is available.
string MinimumSupportedSolverVersion
Gets the minimum supported native solver version.
ValueTask< SolverAvailabilityInfo > CheckAvailabilityAsync(CancellationToken cancellationToken=default)
Checks whether the native solver is installed, loadable, and licensed when a license is required.
string AdapterVersion
Gets the adapter implementation version.
string AdapterId
Gets the unique adapter identifier.
async ValueTask PublishProgressAsync(MathematicalModelSolveRequest request, SolverProgressSnapshot snapshot, CancellationToken cancellationToken=default)
Publishes a progress snapshot to the .NET event and all observers attached to the mathematical solve ...
string AdapterName
Gets the adapter display name.
IReadOnlyCollection< SolverCapability > Capabilities
Gets the capabilities implemented by this plugin.
Provides solver progress information to .NET event subscribers.
Describes a request to solve an already built, solver-independent mathematical model.
Describes a request to solve a lot-sizing instance.
IList< ISolverProgressObserver > ProgressObservers
Gets the progress observers attached to this request.
Represents an immutable snapshot of the current progress of a mathematical optimization run.
Defines a dynamically discoverable solver adapter capable of solving solver-independent mathematical ...
Defines the common contract implemented by every lot-sizing solver adapter.
Task< SolverRunResult > SolveAsync(SolverRequest request, CancellationToken cancellationToken=default)
Solves a lot-sizing instance.
Receives progress notifications produced during a solver execution.
ValueTask OnProgressAsync(SolverProgressSnapshot snapshot, CancellationToken cancellationToken=default)
Processes a solver progress snapshot.
SolverCapability
Identifies an optional capability implemented by a solver adapter.